mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +08:00
Fix few paths for react-native cli scripts
This commit is contained in:
4
cli.js
4
cli.js
@@ -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 = {
|
||||||
|
|||||||
@@ -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|
|
||||||
23
react-native-cli/index.js
vendored
23
react-native-cli/index.js
vendored
@@ -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() {
|
||||||
process.cwd(),
|
return path.resolve(
|
||||||
'node_modules',
|
process.cwd(),
|
||||||
'react-native',
|
'node_modules',
|
||||||
'cli'
|
'react-native',
|
||||||
);
|
'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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user