Fix few paths for react-native cli scripts

This commit is contained in:
Alex Kotliarskyi 2015-03-22 14:04:55 -07:00
parent df73a485cc
commit 4d077f4ee8
3 changed files with 17 additions and 12 deletions

4
cli.js
View File

@ -38,8 +38,8 @@ function run() {
// Here goes any cli commands we need to // Here goes any cli commands we need to
} }
function init() { function init(root, projectName) {
spawn('sh', [path.resolve(__dirname, 'init.sh')], {stdio:'inherit'}); spawn(path.resolve(__dirname, 'init.sh'), [projectName], {stdio:'inherit'});
} }
module.exports = { module.exports = {

View File

@ -14,7 +14,7 @@ def cp(src, dest, app_name)
end end
def main(dest, app_name) def main(dest, app_name)
source = File.expand_path("../../Examples/SampleApp", __FILE__) source = File.expand_path("../Examples/SampleApp", __FILE__)
files = Dir.chdir(source) { Dir["**/*"] } files = Dir.chdir(source) { Dir["**/*"] }
.reject { |file| file["project.xcworkspace"] || file["xcuserdata"] } .reject { |file| file["project.xcworkspace"] || file["xcuserdata"] }
.each { |file| .each { |file|

View File

@ -8,16 +8,18 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var CLI_MODULE_PATH = path.resolve( var CLI_MODULE_PATH = function() {
return path.resolve(
process.cwd(), process.cwd(),
'node_modules', 'node_modules',
'react-native', 'react-native',
'cli' 'cli'
); );
};
var cli; var cli;
try { try {
cli = require(CLI_MODULE_PATH); cli = require(CLI_MODULE_PATH());
} catch(e) {} } catch(e) {}
if (cli) { if (cli) {
@ -66,7 +68,10 @@ function init(name) {
var packageJson = { var packageJson = {
name: projectName, name: projectName,
version: '0.0.1', version: '0.0.1',
private: true private: true,
scripts: {
start: "react-native start"
}
}; };
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson)); fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson));
process.chdir(root); process.chdir(root);
@ -77,7 +82,7 @@ function init(name) {
process.exit(1); process.exit(1);
} }
var cli = require(CLI_MODULE_PATH); var cli = require(CLI_MODULE_PATH());
cli.init(root, projectName); cli.init(root, projectName);
}); });
} }