Skip to content

Commit

Permalink
Convert NavigationPlayground project to a CRNA project
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Miskiewicz committed May 16, 2017
1 parent d145332 commit 1cd16bc
Show file tree
Hide file tree
Showing 15 changed files with 2,330 additions and 517 deletions.
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
./scripts/deploy-website.sh
# deploy expo playground demo
yarn global add exp && exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
cd examples/ExpoNavigationPlayground && npm install && exp publish
exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
cd examples/ExpoNavigationPlayground && yarn && exp publish
fi
9 changes: 6 additions & 3 deletions examples/NavigationPlayground/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"presets": [
"react-native"
]
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
26 changes: 22 additions & 4 deletions examples/NavigationPlayground/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/commoner/test/source/widget/share.js
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
Expand All @@ -15,6 +14,22 @@
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

; Additional create-react-native-app ignores

; Ignore duplicate module providers
.*/node_modules/fbemitter/lib/*

; Ignore misbehaving dev-dependencies
.*/node_modules/xdl/build/*
.*/node_modules/reqwest/tests/*

; Ignore missing expo-sdk dependencies (temporarily)
; https://github.com/exponent/exponent-sdk/issues/36
.*/node_modules/expo/src/*

; Ignore react-native-fbads dependency of the expo sdk
.*/node_modules/react-native-fbads/*

[include]

[libs]
Expand All @@ -25,6 +40,8 @@ flow/
[options]
module.system=haste

emoji=true

experimental.strict_type_args=true

munge_underscores=true
Expand All @@ -35,11 +52,12 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.36.0
^0.40.0
54 changes: 2 additions & 52 deletions examples/NavigationPlayground/.gitignore
Original file line number Diff line number Diff line change
@@ -1,53 +1,3 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log

# BUCK
buck-out/
\.buckd/
android/app/libs
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
.expo/
npm-debug.*
2 changes: 1 addition & 1 deletion examples/NavigationPlayground/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 2 additions & 0 deletions examples/NavigationPlayground/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import App from './js/App';
export default App;
10 changes: 10 additions & 0 deletions examples/NavigationPlayground/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import 'react-native';
import renderer from 'react-test-renderer';

import App from './App';

it('renders without crashing', () => {
const rendered = renderer.create(<App />).toJSON();
expect(rendered).toBeTruthy();
});
31 changes: 28 additions & 3 deletions examples/NavigationPlayground/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
{
"name": "NavigationPlayground",
"displayName": "NavigationPlayground"
}
"expo": {
"name": "NavigationPlayground",
"description": "Try out react-navigation now with this awesome playground",
"version": "1.0.0",
"slug": "NavigationPlayground",
"privacy": "public",
"orientation": "portrait",
"primaryColor": "#cccccc",
"icon": "./assets/icons/react-navigation.png",
"loading": {
"icon": "./assets/icons/react-navigation.png",
"hideExponentText": false
},
"sdkVersion": "16.0.0",
"entryPoint": "./examples/NavigationPlayground/node_modules/react-native-scripts/build/bin/crna-entry.js",
"packagerOpts": {
"projectRoots": "",
"assetExts": [
"ttf",
"mp4"
],
"config": "./rn-cli.config.js"
},
"ios": {
"supportsTablet": true
}
}
}
28 changes: 16 additions & 12 deletions examples/NavigationPlayground/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
{
"name": "NavigationPlayground",
"version": "0.0.1",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "0.0.29",
"jest-expo": "^0.4.0",
"react-test-renderer": "16.0.0-alpha.6"
},
"main": "./examples/node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"test": "jest"
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"dependencies": {
"expo": "^16.0.0",
"react": "16.0.0-alpha.6",
"react-native": "^0.44.0",
"react-native-vector-icons": "^4.1.1",
"react-navigation": "file:../.."
},
"devDependencies": {
"babel-jest": "^20.0.1",
"jest": "^20.0.1",
"react-test-renderer": "^15.5.4"
"react-native": "^0.43.4"
},
"jest": {
"preset": "react-native",
"preset": "jest-expo",
"setupFiles": [
"<rootDir>/../../jest-setup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!react-native|react-navigation)/",
"__exponent"
"examples/ReduxExample/"
]
}
}
50 changes: 50 additions & 0 deletions examples/NavigationPlayground/rn-cli.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* RN CLI Config that allows Exponent to work with this project
*
* Extends the base rn-cli.config.js at the root of the project to use a custom transfomer and a
* special blacklist.
*/

const fs = require('fs');
const path = require('path');
const blacklist = require('react-native/packager/blacklist');
const config = require('react-native/packager/rn-cli.config');

const examples = getDirectories(path.join(__dirname, '..'));
const CURRENT_EXAMPLE = 'NavigationPlayground';

const getBlacklistForExample = (example) => [
...examples.filter(x => x !== example).map(exampleName => new RegExp(`${path.resolve(__dirname, '..')}/${exampleName}/(.*)`))
];

config.getBlacklist = () => [
new RegExp(
`${path.resolve(__dirname, '../..')}/node_modules/react-native/(.*)`
),
new RegExp(`${path.resolve(__dirname, '../..')}/node_modules/react/(.*)`),
...getBlacklistForExample(CURRENT_EXAMPLE)
];

config.getBlacklistRE = () => blacklist(config.getBlacklist());

config.getTransformModulePath = () =>
path.resolve(__dirname, 'transformer.js');

config.getTransformOptions = () => ({
reactNativePath: path.resolve(__dirname, 'node_modules/react-native/'),
reactPath: path.resolve(__dirname, 'node_modules/react/'),
});

config.getProjectRoots = () => getRoots();
config.getAssetRoots = () => getRoots();

function getRoots() {
return [path.join(__dirname, '..', '..')];
}

function getDirectories (srcpath) {
return fs.readdirSync(srcpath)
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory())
}

module.exports = config;
Loading

0 comments on commit 1cd16bc

Please sign in to comment.