From a477aec10d29b4651944cb4292daf06dfa953ea3 Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Fri, 18 Nov 2016 18:25:02 -0800 Subject: [PATCH] Rewrite 'react-native init' and 'react-native upgrade' without using Yeoman in preparation for templates support Summary: This is the manually imported version of https://github.com/facebook/react-native/pull/10786 This was mostly straigthforward by replacing the local-cli folder with the version I had in my local git checkout, plus a few other files I listed with git diff --name-only. Reviewed By: hramos Differential Revision: D4201118 fbshipit-source-id: 4d0fb54b0edda9de1abba427958e420fd2ac105c --- .flowconfig | 4 +- local-cli/__tests__/generators-test.js | 268 ------ local-cli/android/android.js | 38 - local-cli/commands.js | 1 - local-cli/generate-android.js | 31 - local-cli/generate/generate.js | 63 -- local-cli/generator-android/index.js | 91 -- .../src/app/src/main/res/values/strings.xml | 3 - .../templates/src/settings.gradle | 3 - local-cli/generator-ios/index.js | 58 -- .../templates/xcodeproj/project.pbxproj | 814 ------------------ .../xcshareddata/xcschemes/_xcscheme | 112 --- local-cli/generator-utils.js | 43 - .../copyProjectTemplateAndReplace.js | 101 +++ local-cli/generator/index.js | 213 ----- local-cli/generator/printRunInstructions.js | 35 + local-cli/generator/promptSync.js | 118 +++ local-cli/init/gen.js | 6 + local-cli/init/init.js | 118 ++- local-cli/runAndroid/runAndroid.js | 11 +- .../server/middleware/heapCapture/.gitignore | 2 - local-cli/templates/HelloWorld/.babelrc | 3 + .../HelloWorld/.buckconfig} | 0 local-cli/templates/HelloWorld/.buckversion | 1 + local-cli/templates/HelloWorld/.flowconfig | 45 + .../HelloWorld/.gitattributes} | 0 .../HelloWorld/.gitignore} | 5 +- local-cli/templates/HelloWorld/.nobuckcheck | 0 .../HelloWorld/.watchmanconfig} | 0 .../HelloWorld}/__tests__/index.android.js | 0 .../HelloWorld}/__tests__/index.ios.js | 0 .../HelloWorld/android}/app/BUCK | 4 +- .../HelloWorld/android}/app/build.gradle | 2 +- .../android}/app/proguard-rules.pro | 0 .../android}/app/src/main/AndroidManifest.xml | 2 +- .../java/com/helloworld}/MainActivity.java | 4 +- .../java/com/helloworld}/MainApplication.java | 2 +- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 0 .../HelloWorld/android}/build.gradle | 0 .../HelloWorld/android}/gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 .../HelloWorld/android}/gradlew | 0 .../HelloWorld/android}/gradlew.bat | 0 .../HelloWorld/android}/keystores/BUCK | 0 .../keystores/debug.keystore.properties | 0 .../HelloWorld/android/settings.gradle | 3 + .../HelloWorld}/index.android.js | 4 +- .../HelloWorld}/index.ios.js | 4 +- .../HelloWorld/ios/HelloWorld}/AppDelegate.h | 0 .../HelloWorld/ios/HelloWorld}/AppDelegate.m | 2 +- .../HelloWorld}/Base.lproj/LaunchScreen.xib | 2 +- .../AppIcon.appiconset/Contents.json | 0 .../HelloWorld/ios/HelloWorld}/Info.plist | 0 .../HelloWorld/ios/HelloWorld}/main.m | 0 .../ios/HelloWorldTests/HelloWorldTests.m} | 4 +- .../ios/HelloWorldTests}/Info.plist | 0 local-cli/upgrade/doUpgrade.js | 3 + local-cli/upgrade/upgrade.js | 200 +++-- local-cli/util/copyAndReplace.js | 116 ++- local-cli/util/yarn.js | 58 ++ package.json | 2 +- react-native-cli/index.js | 2 +- scripts/run-ci-e2e-tests.js | 8 +- 69 files changed, 723 insertions(+), 1889 deletions(-) delete mode 100644 local-cli/__tests__/generators-test.js delete mode 100644 local-cli/android/android.js delete mode 100644 local-cli/generate-android.js delete mode 100644 local-cli/generate/generate.js delete mode 100644 local-cli/generator-android/index.js delete mode 100644 local-cli/generator-android/templates/src/app/src/main/res/values/strings.xml delete mode 100644 local-cli/generator-android/templates/src/settings.gradle delete mode 100644 local-cli/generator-ios/index.js delete mode 100644 local-cli/generator-ios/templates/xcodeproj/project.pbxproj delete mode 100644 local-cli/generator-ios/templates/xcodeproj/xcshareddata/xcschemes/_xcscheme delete mode 100644 local-cli/generator-utils.js create mode 100644 local-cli/generator/copyProjectTemplateAndReplace.js delete mode 100644 local-cli/generator/index.js create mode 100644 local-cli/generator/printRunInstructions.js create mode 100644 local-cli/generator/promptSync.js create mode 100644 local-cli/init/gen.js delete mode 100644 local-cli/server/middleware/heapCapture/.gitignore create mode 100644 local-cli/templates/HelloWorld/.babelrc rename local-cli/{generator/templates/_buckconfig => templates/HelloWorld/.buckconfig} (100%) create mode 100644 local-cli/templates/HelloWorld/.buckversion create mode 100644 local-cli/templates/HelloWorld/.flowconfig rename local-cli/{generator/templates/_gitattributes => templates/HelloWorld/.gitattributes} (100%) rename local-cli/{generator/templates/_gitignore => templates/HelloWorld/.gitignore} (93%) create mode 100644 local-cli/templates/HelloWorld/.nobuckcheck rename local-cli/{generator/templates/_watchmanconfig => templates/HelloWorld/.watchmanconfig} (100%) rename local-cli/{generator/templates => templates/HelloWorld}/__tests__/index.android.js (100%) rename local-cli/{generator/templates => templates/HelloWorld}/__tests__/index.ios.js (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/app/BUCK (96%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/app/build.gradle (99%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/app/proguard-rules.pro (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/app/src/main/AndroidManifest.xml (97%) rename local-cli/{generator-android/templates/package => templates/HelloWorld/android/app/src/main/java/com/helloworld}/MainActivity.java (85%) rename local-cli/{generator-android/templates/package => templates/HelloWorld/android/app/src/main/java/com/helloworld}/MainApplication.java (97%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/app/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/app/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/app/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) create mode 100644 local-cli/templates/HelloWorld/android/app/src/main/res/values/strings.xml rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/app/src/main/res/values/styles.xml (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/build.gradle (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/gradle.properties (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/gradle/wrapper/gradle-wrapper.jar (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/gradle/wrapper/gradle-wrapper.properties (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/gradlew (100%) rename local-cli/{generator-android/templates/bin => templates/HelloWorld/android}/gradlew.bat (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/keystores/BUCK (100%) rename local-cli/{generator-android/templates/src => templates/HelloWorld/android}/keystores/debug.keystore.properties (100%) create mode 100644 local-cli/templates/HelloWorld/android/settings.gradle rename local-cli/{generator/templates => templates/HelloWorld}/index.android.js (89%) rename local-cli/{generator/templates => templates/HelloWorld}/index.ios.js (89%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/AppDelegate.h (100%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/AppDelegate.m (98%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/Base.lproj/LaunchScreen.xib (93%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/Images.xcassets/AppIcon.appiconset/Contents.json (100%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/Info.plist (100%) rename local-cli/{generator-ios/templates/app => templates/HelloWorld/ios/HelloWorld}/main.m (100%) rename local-cli/{generator-ios/templates/tests/Tests.m => templates/HelloWorld/ios/HelloWorldTests/HelloWorldTests.m} (96%) rename local-cli/{generator-ios/templates/tests => templates/HelloWorld/ios/HelloWorldTests}/Info.plist (100%) create mode 100644 local-cli/upgrade/doUpgrade.js create mode 100644 local-cli/util/yarn.js diff --git a/.flowconfig b/.flowconfig index fb2bb2b37..086c54ac2 100644 --- a/.flowconfig +++ b/.flowconfig @@ -2,8 +2,8 @@ ; We fork some components by platform .*/*[.]android.js -; Ignore generators because they are not real JS files -.*/local-cli/generator/templates/.* +; Ignore templates for 'react-native init' +.*/local-cli/templates/.* ; Ignore the website subdir /website/.* diff --git a/local-cli/__tests__/generators-test.js b/local-cli/__tests__/generators-test.js deleted file mode 100644 index c08925403..000000000 --- a/local-cli/__tests__/generators-test.js +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -jest.autoMockOff(); - -var path = require('path'); -var fs = require('fs'); - -// eslint-disable-next-line improperly-disabled-jasmine-tests -xdescribe('React Yeoman Generators', function() { - describe('react:react', function() { - var assert; - - beforeEach(function() { - // A deep dependency of yeoman spams console.log with giant json objects. - // yeoman-generator/node_modules/ - // download/node_modules/ - // caw/node_modules/ - // get-proxy/node_modules/ - // rc/index.js - var log = console.log; - console.log = function() {}; - assert = require('yeoman-generator').assert; - var helpers = require('yeoman-generator').test; - console.log = log; - - var generated = false; - - runs(function() { - helpers.run(path.resolve(__dirname, '../generator')) - .withArguments(['TestApp']) - .on('end', function() { - generated = true; - }); - }); - - waitsFor(function() { - jest.runAllTicks(); - jest.runOnlyPendingTimers(); - return generated; - }, 'generation', 750); - }); - - it('creates files', function() { - assert.file([ - '.flowconfig', - '.gitignore', - '.watchmanconfig', - 'index.ios.js', - 'index.android.js' - ]); - }); - - it('replaces vars in index.ios.js', function() { - assert.fileContent('index.ios.js', 'var TestApp = React.createClass({'); - assert.fileContent( - 'index.ios.js', - 'AppRegistry.registerComponent(\'TestApp\', () => TestApp);' - ); - - assert.noFileContent('index.ios.js', '<%= name %>'); - }); - - it('replaces vars in index.android.js', function() { - assert.fileContent('index.android.js', 'var TestApp = React.createClass({'); - assert.fileContent( - 'index.android.js', - 'AppRegistry.registerComponent(\'TestApp\', () => TestApp);' - ); - - assert.noFileContent('index.ios.js', '<%= name %>'); - }); - - it('composes with ios generator', function() { - var stat = fs.statSync('ios'); - - expect(stat.isDirectory()).toBe(true); - }); - - it('composes with android generator', function() { - var stat = fs.statSync('android'); - - expect(stat.isDirectory()).toBe(true); - }); - }); - - describe('react:android', function () { - var assert; - - beforeEach(function (done) { - // A deep dependency of yeoman spams console.log with giant json objects. - // yeoman-generator/node_modules/ - // download/node_modules/ - // caw/node_modules/ - // get-proxy/node_modules/ - // rc/index.js - var log = console.log; - console.log = function() {}; - assert = require('yeoman-generator').assert; - var helpers = require('yeoman-generator').test; - console.log = log; - - var generated = false; - - runs(function() { - helpers.run(path.resolve(__dirname, '..', 'generator-android')) - .withArguments(['TestAppAndroid']) - .withOptions({ - 'package': 'com.reactnative.test', - }) - .on('end', function() { - generated = true; - }); - }); - - waitsFor(function() { - jest.runAllTicks(); - jest.runOnlyPendingTimers(); - return generated; - }, 'generation', 750); - }); - - it('creates files', function () { - assert.file([ - path.join('android', 'build.gradle'), - path.join('android', 'gradle.properties'), - path.join('android', 'gradlew.bat'), - path.join('android', 'gradlew'), - path.join('android', 'settings.gradle'), - path.join('android', 'app', 'build.gradle'), - path.join('android', 'app', 'proguard-rules.pro'), - path.join('android', 'app', 'src', 'main', 'AndroidManifest.xml'), - path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'), - path.join('android', 'app', 'src', 'main', 'res', 'mipmap-hdpi', 'ic_launcher.png'), - path.join('android', 'app', 'src', 'main', 'res', 'mipmap-mdpi', 'ic_launcher.png'), - path.join('android', 'app', 'src', 'main', 'res', 'mipmap-xhdpi', 'ic_launcher.png'), - path.join('android', 'app', 'src', 'main', 'res', 'mipmap-xxhdpi', 'ic_launcher.png'), - path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'), - path.join('android', 'app', 'src', 'main', 'res', 'values', 'styles.xml'), - path.join('android', 'gradle', 'wrapper', 'gradle-wrapper.jar'), - path.join('android', 'gradle', 'wrapper', 'gradle-wrapper.properties') - ]); - }); - - it('replaces variables', function() { - assert.fileContent(path.join('android', 'app', 'build.gradle'), 'applicationId "com.reactnative.test"'); - assert.fileContent( - path.join('android', 'app', 'src', 'main', 'AndroidManifest.xml'), - 'package="com.reactnative.test"' - ); - assert.fileContent( - path.join('android', 'app', 'src', 'main', 'AndroidManifest.xml'), - 'name=".MainActivity"' - ); - assert.fileContent( - path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'), - 'package com.reactnative.test;' - ); - assert.fileContent( - path.join('android', 'app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'MainActivity.java'), - 'mReactRootView.startReactApplication(mReactInstanceManager, "TestAppAndroid", null);' - ); - assert.fileContent( - path.join('android', 'app', 'src', 'main', 'res', 'values', 'strings.xml'), - 'TestAppAndroid' - ); - }); - }); - - describe('react:ios', function() { - var assert; - - beforeEach(function() { - // A deep dependency of yeoman spams console.log with giant json objects. - // yeoman-generator/node_modules/ - // download/node_modules/ - // caw/node_modules/ - // get-proxy/node_modules/ - // rc/index.js - var log = console.log; - console.log = function() {}; - assert = require('yeoman-generator').assert; - var helpers = require('yeoman-generator').test; - console.log = log; - - var generated = false; - - runs(function() { - helpers.run(path.resolve(__dirname, '../generator-ios')) - .withArguments(['TestAppIOS']) - .on('end', function() { - generated = true; - }); - }); - - waitsFor(function() { - jest.runAllTicks(); - jest.runOnlyPendingTimers(); - return generated; - }, 'generation', 750); - }); - - it('creates files', function() { - assert.file([ - 'ios/TestAppIOS/AppDelegate.h', - 'ios/TestAppIOS/AppDelegate.m', - 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib', - 'ios/TestAppIOS/Images.xcassets/AppIcon.appiconset/Contents.json', - 'ios/TestAppIOS/Info.plist', - 'ios/TestAppIOS/main.m', - 'ios/TestAppIOS.xcodeproj/project.pbxproj', - 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme', - 'ios/TestAppIOSTests/TestAppIOSTests.m', - 'ios/TestAppIOSTests/Info.plist' - ]); - }); - - it('replaces vars in AppDelegate.m', function() { - var appDelegate = 'ios/TestAppIOS/AppDelegate.m'; - - assert.fileContent(appDelegate, 'moduleName:@"TestAppIOS"'); - assert.noFileContent(appDelegate, '<%= name %>'); - }); - - it('replaces vars in LaunchScreen.xib', function() { - var launchScreen = 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib'; - - assert.fileContent(launchScreen, 'text="TestAppIOS"'); - assert.noFileContent(launchScreen, '<%= name %>'); - }); - - it('replaces vars in TestAppIOSTests.m', function() { - var tests = 'ios/TestAppIOSTests/TestAppIOSTests.m'; - - assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase'); - assert.fileContent(tests, '@implementation TestAppIOSTests'); - assert.noFileContent(tests, '<%= name %>'); - }); - - it('replaces vars in project.pbxproj', function() { - var pbxproj = 'ios/TestAppIOS.xcodeproj/project.pbxproj'; - assert.fileContent(pbxproj, '"TestAppIOS"'); - assert.fileContent(pbxproj, '"TestAppIOSTests"'); - assert.fileContent(pbxproj, 'TestAppIOS.app'); - assert.fileContent(pbxproj, 'TestAppIOSTests.xctest'); - - assert.noFileContent(pbxproj, '<%= name %>'); - }); - - it('replaces vars in xcscheme', function() { - var xcscheme = 'ios/TestAppIOS.xcodeproj/xcshareddata/xcschemes/TestAppIOS.xcscheme'; - assert.fileContent(xcscheme, '"TestAppIOS"'); - assert.fileContent(xcscheme, '"TestAppIOS.app"'); - assert.fileContent(xcscheme, 'TestAppIOS.xcodeproj'); - assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"'); - assert.fileContent(xcscheme, '"TestAppIOSTests"'); - - assert.noFileContent(xcscheme, '<%= name %>'); - }); - }); -}); diff --git a/local-cli/android/android.js b/local-cli/android/android.js deleted file mode 100644 index 173da600c..000000000 --- a/local-cli/android/android.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var fs = require('fs'); -var generate = require('../generate/generate'); - -function android(argv, config, args) { - return generate([ - '--platform', 'android', - '--project-path', process.cwd(), - '--project-name', args.projectName, - ], config); -} - -module.exports = { - name: 'android', - description: 'creates an empty android project', - func: android, - options: [{ - command: '--project-name [name]', - default: () => { - try { - return JSON.parse( - fs.readFileSync('package.json', 'utf8') - ).name; - } catch (e) { - return 'unknown-app-name'; - } - }, - }], -}; diff --git a/local-cli/commands.js b/local-cli/commands.js index 1dcac57fc..5f2fe27bb 100644 --- a/local-cli/commands.js +++ b/local-cli/commands.js @@ -36,7 +36,6 @@ export type Command = { }; const documentedCommands = [ - require('./android/android'), require('./server/server'), require('./runIOS/runIOS'), require('./runAndroid/runAndroid'), diff --git a/local-cli/generate-android.js b/local-cli/generate-android.js deleted file mode 100644 index c3a43d2b9..000000000 --- a/local-cli/generate-android.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var path = require('path'); -var yeoman = require('yeoman-environment'); - -/** - * Simple utility for running the android yeoman generator. - * - * @param {String} projectDir root project directory (i.e. contains index.js) - * @param {String} name name of the root JS module for this app - */ -module.exports = function(projectDir, name) { - var oldCwd = process.cwd(); - process.chdir(projectDir); - - var env = yeoman.createEnv(); - var generatorPath = path.join(__dirname, 'generator'); - env.register(generatorPath, 'react:app'); - var args = ['react:app', name].concat(process.argv.slice(4)); - env.run(args, {'skip-ios': true}, function() { - process.chdir(oldCwd); - }); -}; diff --git a/local-cli/generate/generate.js b/local-cli/generate/generate.js deleted file mode 100644 index 8e43f8b43..000000000 --- a/local-cli/generate/generate.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -const parseCommandLine = require('../util/parseCommandLine'); -const path = require('path'); -const Promise = require('promise'); -const yeoman = require('yeoman-environment'); - -/** - * Generates the template for the given platform. - */ -function generate(argv, config) { - return new Promise((resolve, reject) => { - _generate(argv, config, resolve, reject); - }); -} - -function _generate(argv, config, resolve, reject) { - const args = parseCommandLine([{ - command: 'platform', - description: 'Platform (ios|android)', - type: 'string', - required: true, - }, - { - command: 'project-path', - description: 'Path to the project directory', - type: 'string', - required: true, - }, - { - command: 'project-name', - description: 'Name of the project', - type: 'string', - required: true, - }], argv); - - const oldCwd = process.cwd(); - process.chdir(args['project-path']); - - const env = yeoman.createEnv(); - env.register(path.join(__dirname, '../generator'), 'react:app'); - env.run( - ['react:app', args['project-name']], - { - 'skip-ios': args.platform !== 'ios', - 'skip-android': args.platform !== 'android' - }, - () => { - process.chdir(oldCwd); - resolve(); - } - ); -} - -module.exports = generate; diff --git a/local-cli/generator-android/index.js b/local-cli/generator-android/index.js deleted file mode 100644 index b1540528a..000000000 --- a/local-cli/generator-android/index.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var chalk = require('chalk'); -var fs = require('fs'); -var path = require('path'); -var yeoman = require('yeoman-generator'); - -function validatePackageName(name) { - if (!name.match(/^([a-zA-Z][a-zA-Z\d_]*\.)+([a-zA-Z_][a-zA-Z\d_]*)$/)) { - return false; - } - return true; -} - -module.exports = yeoman.generators.NamedBase.extend({ - constructor: function() { - yeoman.generators.NamedBase.apply(this, arguments); - - this.option('package', { - desc: 'Package name for the application (com.example.app)', - type: String, - defaults: 'com.' + this.name.toLowerCase() - }); - this.option('upgrade', { - desc: 'Specify an upgrade', - type: Boolean, - defaults: false - }); - }, - - initializing: function() { - if (!validatePackageName(this.options.package)) { - throw new Error('Package name ' + this.options.package + ' is invalid'); - } - }, - - writing: function() { - var templateParams = { - package: this.options.package, - name: this.name - }; - if (!this.options.upgrade) { - this.fs.copyTpl( - this.templatePath(path.join('src', '**')), - this.destinationPath('android'), - templateParams - ); - this.fs.copy( - this.templatePath(path.join('bin', '**')), - this.destinationPath('android') - ); - } else { - this.fs.copyTpl( - this.templatePath(path.join('src', '*')), - this.destinationPath('android'), - templateParams - ); - this.fs.copyTpl( - this.templatePath(path.join('src', 'app', '*')), - this.destinationPath(path.join('android', 'app')), - templateParams - ); - } - - var javaPath = path.join.apply( - null, - ['android', 'app', 'src', 'main', 'java'].concat(this.options.package.split('.')) - ); - this.fs.copyTpl( - this.templatePath(path.join('package', '**')), - this.destinationPath(javaPath), - templateParams - ); - }, - - end: function() { - var projectPath = this.destinationRoot(); - this.log(chalk.white.bold('To run your app on Android:')); - this.log(chalk.white(' Have an Android emulator running (quickest way to get started), or a device connected')); - this.log(chalk.white(' cd ' + projectPath)); - this.log(chalk.white(' react-native run-android')); - } -}); diff --git a/local-cli/generator-android/templates/src/app/src/main/res/values/strings.xml b/local-cli/generator-android/templates/src/app/src/main/res/values/strings.xml deleted file mode 100644 index 08ffc02f1..000000000 --- a/local-cli/generator-android/templates/src/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - <%= name %> - diff --git a/local-cli/generator-android/templates/src/settings.gradle b/local-cli/generator-android/templates/src/settings.gradle deleted file mode 100644 index f202604b3..000000000 --- a/local-cli/generator-android/templates/src/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -rootProject.name = '<%= name %>' - -include ':app' diff --git a/local-cli/generator-ios/index.js b/local-cli/generator-ios/index.js deleted file mode 100644 index 28e3c442d..000000000 --- a/local-cli/generator-ios/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var chalk = require('chalk'); -var path = require('path'); -var yeoman = require('yeoman-generator'); - -module.exports = yeoman.generators.NamedBase.extend({ - writing: function() { - var templateVars = {name: this.name}; - // SomeApp/ios/SomeApp - this.fs.copyTpl( - this.templatePath(path.join('app', '**')), - this.destinationPath(path.join('ios', this.name)), - templateVars - ); - - // SomeApp/ios/SomeAppTests - this.fs.copyTpl( - this.templatePath(path.join('tests', 'Tests.m')), - this.destinationPath(path.join('ios', this.name + 'Tests', this.name + 'Tests.m')), - templateVars - ); - this.fs.copy( - this.templatePath(path.join('tests', 'Info.plist')), - this.destinationPath(path.join('ios', this.name + 'Tests', 'Info.plist')) - ); - - // SomeApp/ios/SomeApp.xcodeproj - this.fs.copyTpl( - this.templatePath(path.join('xcodeproj', 'project.pbxproj')), - this.destinationPath(path.join('ios', this.name + '.xcodeproj', 'project.pbxproj')), - templateVars - ); - this.fs.copyTpl( - this.templatePath(path.join('xcodeproj', 'xcshareddata', 'xcschemes', '_xcscheme')), - this.destinationPath(path.join('ios', this.name + '.xcodeproj', 'xcshareddata', 'xcschemes', this.name + '.xcscheme')), - templateVars - ); - }, - - end: function() { - var projectPath = path.resolve(this.destinationRoot(), 'ios', this.name); - this.log(chalk.white.bold('To run your app on iOS:')); - this.log(chalk.white(' cd ' + this.destinationRoot())); - this.log(chalk.white(' react-native run-ios')); - this.log(chalk.white(' - or -')); - this.log(chalk.white(' Open ' + projectPath + '.xcodeproj in Xcode')); - this.log(chalk.white(' Hit the Run button')); - } -}); diff --git a/local-cli/generator-ios/templates/xcodeproj/project.pbxproj b/local-cli/generator-ios/templates/xcodeproj/project.pbxproj deleted file mode 100644 index 7558e4add..000000000 --- a/local-cli/generator-ios/templates/xcodeproj/project.pbxproj +++ /dev/null @@ -1,814 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* <%= name %>Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* <%= name %>Tests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = <%= name %>; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* <%= name %>Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = <%= name %>Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* <%= name %>Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = <%= name %>Tests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* <%= name %>.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = <%= name %>.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = <%= name %>/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = <%= name %>/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = <%= name %>/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = <%= name %>/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = <%= name %>/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../node_modules/react-native/React/React.xcodeproj; sourceTree = ""; }; - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = ../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* <%= name %>Tests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* <%= name %>Tests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = <%= name %>Tests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* <%= name %> */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = <%= name %>; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - ); - name = Products; - sourceTree = ""; - }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { - isa = PBXGroup; - children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* <%= name %> */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* <%= name %>Tests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* <%= name %>.app */, - 00E356EE1AD99517003FC87E /* <%= name %>Tests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* <%= name %>Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "<%= name %>Tests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = <%= name %>Tests; - productName = <%= name %>Tests; - productReference = 00E356EE1AD99517003FC87E /* <%= name %>Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* <%= name %> */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= name %>" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = <%= name %>; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* <%= name %>.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "<%= name %>" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; - ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* <%= name %> */, - 00E356ED1AD99517003FC87E /* <%= name %>Tests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; - remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; - showEnvVarsInLog = 1; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* <%= name %>Tests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* <%= name %> */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = <%= name %>; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = <%= name %>Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/<%= name %>.app/<%= name %>"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - INFOPLIST_FILE = <%= name %>Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/<%= name %>.app/<%= name %>"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - ); - INFOPLIST_FILE = "<%= name %>/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = <%= name %>; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - ); - INFOPLIST_FILE = "<%= name %>/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = <%= name %>; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../node_modules/react-native/React/**", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "<%= name %>Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= name %>" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "<%= name %>" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/local-cli/generator-ios/templates/xcodeproj/xcshareddata/xcschemes/_xcscheme b/local-cli/generator-ios/templates/xcodeproj/xcshareddata/xcschemes/_xcscheme deleted file mode 100644 index 8f66b1884..000000000 --- a/local-cli/generator-ios/templates/xcodeproj/xcshareddata/xcschemes/_xcscheme +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/local-cli/generator-utils.js b/local-cli/generator-utils.js deleted file mode 100644 index 26debe31d..000000000 --- a/local-cli/generator-utils.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var fs = require('fs'); -var path = require('path'); - -function copyAndReplace(src, dest, replacements) { - if (fs.lstatSync(src).isDirectory()) { - if (!fs.existsSync(dest)) { - fs.mkdirSync(dest); - } - } else { - var content = fs.readFileSync(src, 'utf8'); - Object.keys(replacements).forEach(function(regex) { - content = content.replace(new RegExp(regex, 'gm'), replacements[regex]); - }); - fs.writeFileSync(dest, content); - } -} - -function walk(current) { - if (!fs.lstatSync(current).isDirectory()) { - return [current]; - } - - var files = fs.readdirSync(current).map(function(child) { - child = path.join(current, child); - return walk(child); - }); - return [].concat.apply([current], files); -} - -module.exports = { - copyAndReplace: copyAndReplace, - walk: walk -}; diff --git a/local-cli/generator/copyProjectTemplateAndReplace.js b/local-cli/generator/copyProjectTemplateAndReplace.js new file mode 100644 index 000000000..d202434d4 --- /dev/null +++ b/local-cli/generator/copyProjectTemplateAndReplace.js @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +'use strict'; + +const chalk = require('chalk'); +const copyAndReplace = require('../util/copyAndReplace'); +const path = require('path'); +const prompt = require('./promptSync')(); +const walk = require('../util/walk'); + +/** + * Util for creating a new React Native project. + * Copy the project from a template and use the correct project name in + * all files. + * @param srcPath e.g. '/Users/martin/AwesomeApp/node_modules/react-native/local-cli/templates/HelloWorld' + * @param destPath e.g. '/Users/martin/AwesomeApp' + * @param newProjectName e.g. 'AwesomeApp' + */ +function copyProjectTemplateAndReplace(srcPath, destPath, newProjectName, options) { + if (!srcPath) { throw new Error('Need a path to copy from'); } + if (!destPath) { throw new Error('Need a path to copy to'); } + if (!newProjectName) { throw new Error('Need a project name'); } + + walk(srcPath).forEach(absoluteSrcFilePath => { + + // 'react-native upgrade' + if (options && options.upgrade) { + // Don't upgrade these files + const fileName = path.basename(absoluteSrcFilePath); + // This also includes __tests__/index.*.js + if (fileName === 'index.ios.js') { return; } + if (fileName === 'index.android.js') { return; } + } + + const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath); + const relativeRenamedPath = relativeFilePath + .replace(/HelloWorld/g, newProjectName) + .replace(/helloworld/g, newProjectName.toLowerCase()); + + + let contentChangedCallback = null; + if (options && options.upgrade && (!options.force)) { + contentChangedCallback = (_, contentChanged) => { + return upgradeFileContentChangedCallback( + absoluteSrcFilePath, + relativeRenamedPath, + contentChanged, + ); + }; + } + copyAndReplace( + absoluteSrcFilePath, + path.resolve(destPath, relativeRenamedPath), + { + 'HelloWorld': newProjectName, + 'helloworld': newProjectName.toLowerCase(), + }, + contentChangedCallback, + ); + }); +} + +function upgradeFileContentChangedCallback( + absoluteSrcFilePath, + relativeDestPath, + contentChanged +) { + if (contentChanged === 'new') { + console.log(chalk.bold('new') + ' ' + relativeDestPath); + return 'overwrite'; + } else if (contentChanged === 'changed') { + console.log(chalk.bold(relativeDestPath) + ' ' + + 'has changed in the new version.\nDo you want to keep your ' + + relativeDestPath + ' or replace it with the ' + + 'latest version?\nIf you ever made any changes ' + + 'to this file, you\'ll probably want to keep it.\n' + + 'You can see the new version here: ' + absoluteSrcFilePath + '\n' + + 'Do you want to replace ' + relativeDestPath + '? ' + + 'Answer y to replace, n to keep your version: '); + const answer = prompt(); + if (answer === 'y') { + console.log('Replacing ' + relativeDestPath); + return 'overwrite'; + } else { + console.log('Keeping your ' + relativeDestPath); + return 'keep'; + } + } else if (contentChanged === 'identical') { + return 'keep'; + } else { + throw new Error(`Unkown file changed state: ${relativeDestPath}, ${contentChanged}`); + } +} + +module.exports = copyProjectTemplateAndReplace; diff --git a/local-cli/generator/index.js b/local-cli/generator/index.js deleted file mode 100644 index 1899b35fe..000000000 --- a/local-cli/generator/index.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -'use strict'; - -var execSync = require('child_process').execSync; -var fs = require('fs'); -var path = require('path'); -var semver = require('semver') -var utils = require('../generator-utils'); -var yeoman = require('yeoman-generator'); - -// Use Yarn if available, it's much faster than the npm client. -// Return the version of yarn installed on the system, null if yarn is not available. -function getYarnVersionIfAvailable() { - let yarnVersion; - try { - // execSync returns a Buffer -> convert to string - if (process.platform.startsWith('win')) { - yarnVersion = (execSync('yarn --version').toString() || '').trim(); - } else { - yarnVersion = (execSync('yarn --version 2>/dev/null').toString() || '').trim(); - } - } catch (error) { - return null; - } - // yarn < 0.16 has a 'missing manifest' bug - try { - if (semver.gte(yarnVersion, '0.16.0')) { - return yarnVersion; - } else { - return null; - } - } catch (error) { - console.error('Cannot parse yarn version: ' + yarnVersion); - return null; - } -} - -/** - * Check that 'react-native init' itself used yarn to install React Native. - * When using an old global react-native-cli@1.0.0 (or older), we don't want - * to install React Native with npm, and React + Jest with yarn. - * Let's be safe and not mix yarn and npm in a single project. - * @param projectDir e.g. /Users/martin/AwesomeApp - */ -function isGlobalCliUsingYarn(projectDir) { - return fs.existsSync(path.join(projectDir, 'yarn.lock')); -} - -module.exports = yeoman.generators.NamedBase.extend({ - constructor: function() { - yeoman.generators.NamedBase.apply(this, arguments); - this.option('skip-ios', { - desc: 'Skip generating iOS files', - type: Boolean, - defaults: false - }); - this.option('skip-android', { - desc: 'Skip generating Android files', - type: Boolean, - defaults: false - }); - this.option('skip-jest', { - desc: 'Skip installing Jest', - type: Boolean, - defaults: false - }); - this.option('upgrade', { - desc: 'Specify an upgrade', - type: Boolean, - defaults: false - }); - // Temporary option until yarn becomes stable. - this.option('npm', { - desc: 'Use the npm client, even if yarn is available.', - type: Boolean, - defaults: false - }); - - // this passes command line arguments down to the composed generators - var args = {args: arguments[0], options: this.options}; - if (!this.options['skip-ios']) { - this.composeWith('react:ios', args, { - local: require.resolve(path.resolve(__dirname, '..', 'generator-ios')) - }); - } - if (!this.options['skip-android']) { - this.composeWith('react:android', args, { - local: require.resolve(path.resolve(__dirname, '..', 'generator-android')) - }); - } - }, - - configuring: function() { - utils.copyAndReplace( - this.templatePath('../../../.flowconfig'), - this.destinationPath('.flowconfig'), - { - 'Libraries\/react-native\/react-native-interface.js' : 'node_modules/react-native/Libraries/react-native/react-native-interface.js', - '^flow/$' : 'node_modules/react-native/flow\nflow/' - } - ); - - this.fs.copy( - this.templatePath('_gitignore'), - this.destinationPath('.gitignore') - ); - this.fs.copy( - this.templatePath('_gitattributes'), - this.destinationPath('.gitattributes') - ); - this.fs.copy( - this.templatePath('_watchmanconfig'), - this.destinationPath('.watchmanconfig') - ); - this.fs.copy( - this.templatePath('_buckconfig'), - this.destinationPath('.buckconfig') - ); - }, - - writing: function() { - if (this.options.upgrade) { - // never upgrade index.*.js files - return; - } - if (!this.options['skip-ios']) { - this.fs.copyTpl( - this.templatePath('index.ios.js'), - this.destinationPath('index.ios.js'), - {name: this.name} - ); - } - if (!this.options['skip-android']) { - this.fs.copyTpl( - this.templatePath('index.android.js'), - this.destinationPath('index.android.js'), - {name: this.name} - ); - } - }, - - install: function() { - if (this.options.upgrade) { - return; - } - - var reactNativePackageJson = require('../../package.json'); - var { peerDependencies } = reactNativePackageJson; - if (!peerDependencies) { - return; - } - - var reactVersion = peerDependencies.react; - if (!reactVersion) { - return; - } - - const yarnVersion = (!this.options['npm']) && getYarnVersionIfAvailable() && isGlobalCliUsingYarn(this.destinationRoot()); - - console.log('Installing React...'); - if (yarnVersion) { - execSync(`yarn add react@${reactVersion}`); - } else { - this.npmInstall(`react@${reactVersion}`, { '--save': true, '--save-exact': true }); - } - if (!this.options['skip-jest']) { - console.log('Installing Jest...'); - if (yarnVersion) { - execSync(`yarn add jest babel-jest jest-react-native babel-preset-react-native react-test-renderer@${reactVersion} --dev --exact`); - } else { - this.npmInstall(`jest babel-jest babel-preset-react-native react-test-renderer@${reactVersion}`.split(' '), { - saveDev: true, - '--save-exact': true - }); - } - fs.writeFileSync( - path.join( - this.destinationRoot(), - '.babelrc' - ), - '{\n"presets": ["react-native"]\n}' - ); - this.fs.copy( - this.templatePath('__tests__'), - this.destinationPath('__tests__'), - { - nodir: false - } - ); - var packageJSONPath = path.join( - this.destinationRoot(), - 'package.json' - ); - var packageJSON = JSON.parse( - fs.readFileSync( - packageJSONPath - ) - ); - packageJSON.scripts.test = 'jest'; - packageJSON.jest = { - preset: 'react-native' - }; - fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, '\t')); - } - } -}); diff --git a/local-cli/generator/printRunInstructions.js b/local-cli/generator/printRunInstructions.js new file mode 100644 index 000000000..7db8cda96 --- /dev/null +++ b/local-cli/generator/printRunInstructions.js @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +'use strict'; + +var chalk = require('chalk'); +var path = require('path'); + +function printRunInstructions(projectDir, projectName) { + const absoluteProjectDir = path.resolve(projectDir); + const relativeProjectDir = path.relative(process.cwd(), absoluteProjectDir); + // If we're in the project directory already, no need to 'cd' into it + const needToCd = !!relativeProjectDir; + // iOS + const xcodeProjectPath = path.resolve(projectDir, 'ios', projectName) + '.xcodeproj'; + const relativeXcodeProjectPath = path.relative(process.cwd(), xcodeProjectPath); + console.log(chalk.white.bold('To run your app on iOS:')); + if (needToCd) { console.log(' cd ' + relativeProjectDir); } + console.log(' react-native run-ios'); + console.log(' - or -'); + console.log(' Open ' + relativeXcodeProjectPath + ' in Xcode'); + console.log(' Hit the Run button'); + // Android + console.log(chalk.white.bold('To run your app on Android:')); + console.log(' Have an Android emulator running (quickest way to get started), or a device connected'); + if (needToCd) { console.log(' cd ' + relativeProjectDir); } + console.log(' react-native run-android'); +} + +module.exports = printRunInstructions; diff --git a/local-cli/generator/promptSync.js b/local-cli/generator/promptSync.js new file mode 100644 index 000000000..262764813 --- /dev/null +++ b/local-cli/generator/promptSync.js @@ -0,0 +1,118 @@ +// Simplified version of: +// https://github.com/0x00A/prompt-sync/blob/master/index.js + +'use strict'; + +var fs = require('fs'); +var term = 13; // carriage return + +function create() { + + return prompt; + + function prompt(ask, value, opts) { + var insert = 0, savedinsert = 0, res, i, savedstr; + opts = opts || {}; + + if (Object(ask) === ask) { + opts = ask; + ask = opts.ask; + } else if (Object(value) === value) { + opts = value; + value = opts.value; + } + ask = ask || ''; + var echo = opts.echo; + var masked = 'echo' in opts; + + var fd = (process.platform === 'win32') ? + process.stdin.fd : + fs.openSync('/dev/tty', 'rs'); + + var wasRaw = process.stdin.isRaw; + if (!wasRaw) { process.stdin.setRawMode(true); } + + var buf = new Buffer(3); + var str = '', character, read; + + savedstr = ''; + + if (ask) { + process.stdout.write(ask); + } + + var cycle = 0; + var prevComplete; + + while (true) { + read = fs.readSync(fd, buf, 0, 3); + if (read > 1) { // received a control sequence + if (buf.toString()) { + str = str + buf.toString(); + str = str.replace(/\0/g, ''); + insert = str.length; + process.stdout.write('\u001b[2K\u001b[0G'+ ask + str); + process.stdout.write('\u001b[' + (insert+ask.length+1) + 'G'); + buf = new Buffer(3); + } + continue; // any other 3 character sequence is ignored + } + + // if it is not a control character seq, assume only one character is read + character = buf[read-1]; + + // catch a ^C and return null + if (character == 3){ + process.stdout.write('^C\n'); + fs.closeSync(fd); + process.exit(130); + process.stdin.setRawMode(wasRaw); + return null; + } + + // catch the terminating character + if (character == term) { + fs.closeSync(fd); + break; + } + + if (character == 127 || (process.platform == 'win32' && character == 8)) { //backspace + if (!insert) continue; + str = str.slice(0, insert-1) + str.slice(insert); + insert--; + process.stdout.write('\u001b[2D'); + } else { + if ((character < 32 ) || (character > 126)) + continue; + str = str.slice(0, insert) + String.fromCharCode(character) + str.slice(insert); + insert++; + }; + + if (masked) { + process.stdout.write('\u001b[2K\u001b[0G' + ask + Array(str.length+1).join(echo)); + } else { + process.stdout.write('\u001b[s'); + if (insert == str.length) { + process.stdout.write('\u001b[2K\u001b[0G'+ ask + str); + } else { + if (ask) { + process.stdout.write('\u001b[2K\u001b[0G'+ ask + str); + } else { + process.stdout.write('\u001b[2K\u001b[0G'+ str + '\u001b[' + (str.length - insert) + 'D'); + } + } + process.stdout.write('\u001b[u'); + process.stdout.write('\u001b[1C'); + } + + } + + process.stdout.write('\n') + + process.stdin.setRawMode(wasRaw); + + return str || value || ''; + }; +}; + +module.exports = create; \ No newline at end of file diff --git a/local-cli/init/gen.js b/local-cli/init/gen.js new file mode 100644 index 000000000..fcc52f16c --- /dev/null +++ b/local-cli/init/gen.js @@ -0,0 +1,6 @@ +const init = require('./init'); + +init( + '/Users/mkonicek/code/testapps/ignite', + ['AwesomeApp', '--verbose'] +); \ No newline at end of file diff --git a/local-cli/init/init.js b/local-cli/init/init.js index 92df12bc5..5ade86637 100644 --- a/local-cli/init/init.js +++ b/local-cli/init/init.js @@ -8,48 +8,104 @@ */ 'use strict'; +const copyProjectTemplateAndReplace = require('../generator/copyProjectTemplateAndReplace'); +const execSync = require('child_process').execSync; +const fs = require('fs'); +const minimist = require('minimist'); const path = require('path'); -const TerminalAdapter = require('yeoman-environment/lib/adapter.js'); -const yeoman = require('yeoman-environment'); - -class CreateSuppressingTerminalAdapter extends TerminalAdapter { - constructor() { - super(); - // suppress 'create' output generated by yeoman - this.log.create = function() {}; - } -} +const printRunInstructions = require('../generator/printRunInstructions'); +const process = require('process'); +const yarn = require('../util/yarn'); /** * Creates the template for a React Native project given the provided * parameters: - * - projectDir: templates will be copied here. - * - argsOrName: project name or full list of custom arguments to pass to the - * generator. + * @param projectDir Templates will be copied here. + * @param argsOrName Project name or full list of custom arguments + * for the generator. */ function init(projectDir, argsOrName) { console.log('Setting up new React Native app in ' + projectDir); - const env = yeoman.createEnv( - undefined, - undefined, - new CreateSuppressingTerminalAdapter() - ); - env.register( - require.resolve(path.join(__dirname, '../generator')), - 'react:app' - ); - - // argv is for instance - // ['node', 'react-native', 'init', 'AwesomeApp', '--verbose'] - // args should be ['AwesomeApp', '--verbose'] const args = Array.isArray(argsOrName) - ? argsOrName - : [argsOrName].concat(process.argv.slice(4)); + ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose'] + : [argsOrName].concat(process.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp' - const generator = env.create('react:app', {args: args}); - generator.destinationRoot(projectDir); - generator.run(); + // args array is e.g. ['AwesomeApp', '--verbose'] + if (!args || args.lentgh == 0) { + console.error('react-native init requires a project name.'); + return; + } + + const newProjectName = args[0]; + const options = minimist(args); + + generateProject(projectDir, newProjectName, options); +} + +/** + * Generates a new React Native project based on the template. + * @param Absolute path at which the project folder should be created. + * @param options Command line arguments parsed by minimist. + */ +function generateProject(destinationRoot, newProjectName, options) { + var reactNativePackageJson = require('../../package.json'); + var { peerDependencies } = reactNativePackageJson; + if (!peerDependencies) { + console.error('Missing React peer dependency in React Native\'s package.json. Aborting.'); + return; + } + + var reactVersion = peerDependencies.react; + if (!reactVersion) { + console.error('Missing React peer dependency in React Native\'s package.json. Aborting.'); + return; + } + + const yarnVersion = + (!options['npm']) && + yarn.getYarnVersionIfAvailable() && + yarn.isGlobalCliUsingYarn(destinationRoot); + + copyProjectTemplateAndReplace( + path.resolve('node_modules', 'react-native', 'local-cli', 'templates', 'HelloWorld'), + destinationRoot, + newProjectName + ); + + if (yarnVersion) { + console.log('Adding React...'); + execSync(`yarn add react@${reactVersion}`); + } else { + console.log('Installing React...'); + execSync(`npm install react@${reactVersion} --save --save-exact`); + } + if (!options['skip-jest']) { + const jestDeps = `jest babel-jest jest-react-native babel-preset-react-native react-test-renderer@${reactVersion}`; + if (yarnVersion) { + console.log('Adding Jest...'); + execSync(`yarn add ${jestDeps} --dev --exact`); + } else { + console.log('Installing Jest...'); + execSync(`npm install ${jestDeps} --save-dev --save-exact`); + } + addJestToPackageJson(destinationRoot); + } + printRunInstructions(destinationRoot, newProjectName); +} + +/** + * Add Jest-related stuff to package.json, which was created by the react-native-cli. + */ +function addJestToPackageJson(destinationRoot) { + var packageJSONPath = path.join(destinationRoot, 'package.json'); + var packageJSON = JSON.parse(fs.readFileSync(packageJSONPath)); + + packageJSON.scripts.test = 'jest'; + packageJSON.jest = { + preset: 'react-native' + }; + fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, '\t')); } module.exports = init; diff --git a/local-cli/runAndroid/runAndroid.js b/local-cli/runAndroid/runAndroid.js index 90be361f4..d9796a197 100644 --- a/local-cli/runAndroid/runAndroid.js +++ b/local-cli/runAndroid/runAndroid.js @@ -8,13 +8,14 @@ */ 'use strict'; +const Promise = require('promise'); + +const adb = require('./adb'); const chalk = require('chalk'); const child_process = require('child_process'); const fs = require('fs'); -const path = require('path'); const isPackagerRunning = require('../util/isPackagerRunning'); -const Promise = require('promise'); -const adb = require('./adb'); +const path = require('path'); // Verifies this is an Android project function checkAndroid(root) { @@ -104,7 +105,7 @@ function buildAndRun(args) { if (args.configuration.toUpperCase() === 'RELEASE') { console.log(chalk.bold( - `Generating the bundle for the release build...` + 'Generating the bundle for the release build...' )); child_process.execSync(`react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output ${androidProjectDir}/app/src/main/assets/index.android.bundle --assets-dest ${androidProjectDir}/app/src/main/res/`, { @@ -121,7 +122,7 @@ function buildAndRun(args) { : './gradlew'; console.log(chalk.bold( - `Building and installing the app on the device (cd android && ${cmd} ${gradleArgs.join(' ')}...` + `Building and installing the app on the device (cd android && ${cmd} ${gradleArgs.join(' ')})...` )); child_process.execFileSync(cmd, gradleArgs, { diff --git a/local-cli/server/middleware/heapCapture/.gitignore b/local-cli/server/middleware/heapCapture/.gitignore deleted file mode 100644 index 70534df0a..000000000 --- a/local-cli/server/middleware/heapCapture/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/captures/* -preLoadedCapture.js diff --git a/local-cli/templates/HelloWorld/.babelrc b/local-cli/templates/HelloWorld/.babelrc new file mode 100644 index 000000000..8df53fe43 --- /dev/null +++ b/local-cli/templates/HelloWorld/.babelrc @@ -0,0 +1,3 @@ +{ +"presets": ["react-native"] +} \ No newline at end of file diff --git a/local-cli/generator/templates/_buckconfig b/local-cli/templates/HelloWorld/.buckconfig similarity index 100% rename from local-cli/generator/templates/_buckconfig rename to local-cli/templates/HelloWorld/.buckconfig diff --git a/local-cli/templates/HelloWorld/.buckversion b/local-cli/templates/HelloWorld/.buckversion new file mode 100644 index 000000000..b50d7ae20 --- /dev/null +++ b/local-cli/templates/HelloWorld/.buckversion @@ -0,0 +1 @@ +a528552661748a6cc72c37824ade3722d94eeb48 diff --git a/local-cli/templates/HelloWorld/.flowconfig b/local-cli/templates/HelloWorld/.flowconfig new file mode 100644 index 000000000..5912f47fc --- /dev/null +++ b/local-cli/templates/HelloWorld/.flowconfig @@ -0,0 +1,45 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ + +[options] +module.system=haste + +experimental.strict_type_args=true + +munge_underscores=true + +module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-5]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-5]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy + +unsafe.enable_getters_and_setters=true + +[version] +^0.35.0 diff --git a/local-cli/generator/templates/_gitattributes b/local-cli/templates/HelloWorld/.gitattributes similarity index 100% rename from local-cli/generator/templates/_gitattributes rename to local-cli/templates/HelloWorld/.gitattributes diff --git a/local-cli/generator/templates/_gitignore b/local-cli/templates/HelloWorld/.gitignore similarity index 93% rename from local-cli/generator/templates/_gitignore rename to local-cli/templates/HelloWorld/.gitignore index 73359e1a8..93fd76464 100644 --- a/local-cli/generator/templates/_gitignore +++ b/local-cli/templates/HelloWorld/.gitignore @@ -22,12 +22,13 @@ DerivedData *.xcuserstate project.xcworkspace -# Android/IJ +# Android/IntelliJ # -*.iml +build/ .idea .gradle local.properties +*.iml # node.js # diff --git a/local-cli/templates/HelloWorld/.nobuckcheck b/local-cli/templates/HelloWorld/.nobuckcheck new file mode 100644 index 000000000..e69de29bb diff --git a/local-cli/generator/templates/_watchmanconfig b/local-cli/templates/HelloWorld/.watchmanconfig similarity index 100% rename from local-cli/generator/templates/_watchmanconfig rename to local-cli/templates/HelloWorld/.watchmanconfig diff --git a/local-cli/generator/templates/__tests__/index.android.js b/local-cli/templates/HelloWorld/__tests__/index.android.js similarity index 100% rename from local-cli/generator/templates/__tests__/index.android.js rename to local-cli/templates/HelloWorld/__tests__/index.android.js diff --git a/local-cli/generator/templates/__tests__/index.ios.js b/local-cli/templates/HelloWorld/__tests__/index.ios.js similarity index 100% rename from local-cli/generator/templates/__tests__/index.ios.js rename to local-cli/templates/HelloWorld/__tests__/index.ios.js diff --git a/local-cli/generator-android/templates/src/app/BUCK b/local-cli/templates/HelloWorld/android/app/BUCK similarity index 96% rename from local-cli/generator-android/templates/src/app/BUCK rename to local-cli/templates/HelloWorld/android/app/BUCK index 30774f5da..a952351d9 100644 --- a/local-cli/generator-android/templates/src/app/BUCK +++ b/local-cli/templates/HelloWorld/android/app/BUCK @@ -46,13 +46,13 @@ android_library( android_build_config( name = 'build_config', - package = '<%= package %>', + package = 'com.helloworld', ) android_resource( name = 'res', res = 'src/main/res', - package = '<%= package %>', + package = 'com.helloworld', ) android_binary( diff --git a/local-cli/generator-android/templates/src/app/build.gradle b/local-cli/templates/HelloWorld/android/app/build.gradle similarity index 99% rename from local-cli/generator-android/templates/src/app/build.gradle rename to local-cli/templates/HelloWorld/android/app/build.gradle index d15d6c6c8..59340fad8 100644 --- a/local-cli/generator-android/templates/src/app/build.gradle +++ b/local-cli/templates/HelloWorld/android/app/build.gradle @@ -87,7 +87,7 @@ android { buildToolsVersion "23.0.1" defaultConfig { - applicationId "<%= package %>" + applicationId "com.helloworld" minSdkVersion 16 targetSdkVersion 22 versionCode 1 diff --git a/local-cli/generator-android/templates/src/app/proguard-rules.pro b/local-cli/templates/HelloWorld/android/app/proguard-rules.pro similarity index 100% rename from local-cli/generator-android/templates/src/app/proguard-rules.pro rename to local-cli/templates/HelloWorld/android/app/proguard-rules.pro diff --git a/local-cli/generator-android/templates/src/app/src/main/AndroidManifest.xml b/local-cli/templates/HelloWorld/android/app/src/main/AndroidManifest.xml similarity index 97% rename from local-cli/generator-android/templates/src/app/src/main/AndroidManifest.xml rename to local-cli/templates/HelloWorld/android/app/src/main/AndroidManifest.xml index 3da058c9f..128fd2300 100644 --- a/local-cli/generator-android/templates/src/app/src/main/AndroidManifest.xml +++ b/local-cli/templates/HelloWorld/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ diff --git a/local-cli/generator-android/templates/package/MainActivity.java b/local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainActivity.java similarity index 85% rename from local-cli/generator-android/templates/package/MainActivity.java rename to local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainActivity.java index c027ca136..1e9c18948 100644 --- a/local-cli/generator-android/templates/package/MainActivity.java +++ b/local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainActivity.java @@ -1,4 +1,4 @@ -package <%= package %>; +package com.helloworld; import com.facebook.react.ReactActivity; @@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity { */ @Override protected String getMainComponentName() { - return "<%= name %>"; + return "HelloWorld"; } } diff --git a/local-cli/generator-android/templates/package/MainApplication.java b/local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainApplication.java similarity index 97% rename from local-cli/generator-android/templates/package/MainApplication.java rename to local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainApplication.java index 601f53936..ed63744b7 100644 --- a/local-cli/generator-android/templates/package/MainApplication.java +++ b/local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainApplication.java @@ -1,4 +1,4 @@ -package <%= package %>; +package com.helloworld; import android.app.Application; import android.util.Log; diff --git a/local-cli/generator-android/templates/bin/app/src/main/res/mipmap-hdpi/ic_launcher.png b/local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from local-cli/generator-android/templates/bin/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/local-cli/generator-android/templates/bin/app/src/main/res/mipmap-mdpi/ic_launcher.png b/local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from local-cli/generator-android/templates/bin/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/local-cli/generator-android/templates/bin/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from local-cli/generator-android/templates/bin/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/local-cli/generator-android/templates/bin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from local-cli/generator-android/templates/bin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to local-cli/templates/HelloWorld/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/local-cli/templates/HelloWorld/android/app/src/main/res/values/strings.xml b/local-cli/templates/HelloWorld/android/app/src/main/res/values/strings.xml new file mode 100644 index 000000000..b89cc1489 --- /dev/null +++ b/local-cli/templates/HelloWorld/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + HelloWorld + diff --git a/local-cli/generator-android/templates/src/app/src/main/res/values/styles.xml b/local-cli/templates/HelloWorld/android/app/src/main/res/values/styles.xml similarity index 100% rename from local-cli/generator-android/templates/src/app/src/main/res/values/styles.xml rename to local-cli/templates/HelloWorld/android/app/src/main/res/values/styles.xml diff --git a/local-cli/generator-android/templates/src/build.gradle b/local-cli/templates/HelloWorld/android/build.gradle similarity index 100% rename from local-cli/generator-android/templates/src/build.gradle rename to local-cli/templates/HelloWorld/android/build.gradle diff --git a/local-cli/generator-android/templates/src/gradle.properties b/local-cli/templates/HelloWorld/android/gradle.properties similarity index 100% rename from local-cli/generator-android/templates/src/gradle.properties rename to local-cli/templates/HelloWorld/android/gradle.properties diff --git a/local-cli/generator-android/templates/bin/gradle/wrapper/gradle-wrapper.jar b/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from local-cli/generator-android/templates/bin/gradle/wrapper/gradle-wrapper.jar rename to local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.jar diff --git a/local-cli/generator-android/templates/bin/gradle/wrapper/gradle-wrapper.properties b/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from local-cli/generator-android/templates/bin/gradle/wrapper/gradle-wrapper.properties rename to local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties diff --git a/local-cli/generator-android/templates/bin/gradlew b/local-cli/templates/HelloWorld/android/gradlew similarity index 100% rename from local-cli/generator-android/templates/bin/gradlew rename to local-cli/templates/HelloWorld/android/gradlew diff --git a/local-cli/generator-android/templates/bin/gradlew.bat b/local-cli/templates/HelloWorld/android/gradlew.bat similarity index 100% rename from local-cli/generator-android/templates/bin/gradlew.bat rename to local-cli/templates/HelloWorld/android/gradlew.bat diff --git a/local-cli/generator-android/templates/src/keystores/BUCK b/local-cli/templates/HelloWorld/android/keystores/BUCK similarity index 100% rename from local-cli/generator-android/templates/src/keystores/BUCK rename to local-cli/templates/HelloWorld/android/keystores/BUCK diff --git a/local-cli/generator-android/templates/src/keystores/debug.keystore.properties b/local-cli/templates/HelloWorld/android/keystores/debug.keystore.properties similarity index 100% rename from local-cli/generator-android/templates/src/keystores/debug.keystore.properties rename to local-cli/templates/HelloWorld/android/keystores/debug.keystore.properties diff --git a/local-cli/templates/HelloWorld/android/settings.gradle b/local-cli/templates/HelloWorld/android/settings.gradle new file mode 100644 index 000000000..32e6f44c4 --- /dev/null +++ b/local-cli/templates/HelloWorld/android/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'HelloWorld' + +include ':app' diff --git a/local-cli/generator/templates/index.android.js b/local-cli/templates/HelloWorld/index.android.js similarity index 89% rename from local-cli/generator/templates/index.android.js rename to local-cli/templates/HelloWorld/index.android.js index c39ea87cf..71e391f53 100644 --- a/local-cli/generator/templates/index.android.js +++ b/local-cli/templates/HelloWorld/index.android.js @@ -12,7 +12,7 @@ import { View } from 'react-native'; -export default class <%= name %> extends Component { +export default class HelloWorld extends Component { render() { return ( @@ -50,4 +50,4 @@ const styles = StyleSheet.create({ }, }); -AppRegistry.registerComponent('<%= name %>', () => <%= name %>); +AppRegistry.registerComponent('HelloWorld', () => HelloWorld); diff --git a/local-cli/generator/templates/index.ios.js b/local-cli/templates/HelloWorld/index.ios.js similarity index 89% rename from local-cli/generator/templates/index.ios.js rename to local-cli/templates/HelloWorld/index.ios.js index 9d0faa286..ede2dc268 100644 --- a/local-cli/generator/templates/index.ios.js +++ b/local-cli/templates/HelloWorld/index.ios.js @@ -12,7 +12,7 @@ import { View } from 'react-native'; -export default class <%= name %> extends Component { +export default class HelloWorld extends Component { render() { return ( @@ -50,4 +50,4 @@ const styles = StyleSheet.create({ }, }); -AppRegistry.registerComponent('<%= name %>', () => <%= name %>); +AppRegistry.registerComponent('HelloWorld', () => HelloWorld); diff --git a/local-cli/generator-ios/templates/app/AppDelegate.h b/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.h similarity index 100% rename from local-cli/generator-ios/templates/app/AppDelegate.h rename to local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.h diff --git a/local-cli/generator-ios/templates/app/AppDelegate.m b/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m similarity index 98% rename from local-cli/generator-ios/templates/app/AppDelegate.m rename to local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m index edaccd8aa..a0b1d9ca6 100644 --- a/local-cli/generator-ios/templates/app/AppDelegate.m +++ b/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m @@ -21,7 +21,7 @@ jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation - moduleName:@"<%= name %>" + moduleName:@"HelloWorld" initialProperties:nil launchOptions:launchOptions]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; diff --git a/local-cli/generator-ios/templates/app/Base.lproj/LaunchScreen.xib b/local-cli/templates/HelloWorld/ios/HelloWorld/Base.lproj/LaunchScreen.xib similarity index 93% rename from local-cli/generator-ios/templates/app/Base.lproj/LaunchScreen.xib rename to local-cli/templates/HelloWorld/ios/HelloWorld/Base.lproj/LaunchScreen.xib index 8ce4f2a11..0b83e7b2d 100644 --- a/local-cli/generator-ios/templates/app/Base.lproj/LaunchScreen.xib +++ b/local-cli/templates/HelloWorld/ios/HelloWorld/Base.lproj/LaunchScreen.xib @@ -18,7 +18,7 @@ -