mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 12:34:17 +00:00
be70e32de2
Summary: This integrates React Native into Xcode's build process, which lets us automatically handle bundling and packaging image assets. Tested the script via https://github.com/frantic/ReactNativeAssetsExample Loaded from packager: <img width="432" alt="screen shot 2015-10-19 at 3 11 12 pm" src="https://cloud.githubusercontent.com/assets/192222/10593447/be5bc7e8-7678-11e5-8c70-ecc2a1ee24fc.png"> Loaded from offline bundle: <img width="432" alt="screen shot 2015-10-19 at 3 10 58 pm" src="https://cloud.githubusercontent.com/assets/192222/10593448/be5d5194-7678-11e5-8b02-d492a26cfb81.png"> Android: <img width="639" alt="screen shot 2015-10-19 at 3 11 20 pm" src="https://cloud.githubusercontent.com/assets/192222/10593449/be5de2d0-7678-11e5-8d3c-0378fc447f15.png"> Closes https://github.com/facebook/react-native/pull/3523 Reviewed By: mkonicek Differential Revision: D2557923 Pulled By: frantic fb-gh-sync-id: 19957e255993696e793b0162662772efd89f5c1a
56 lines
1.9 KiB
JavaScript
56 lines
1.9 KiB
JavaScript
/**
|
|
* 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(' Open ' + projectPath + '.xcodeproj in Xcode'));
|
|
this.log(chalk.white(' Hit Run button'));
|
|
}
|
|
});
|