Fix few paths for react-native cli scripts
This commit is contained in:
parent
df73a485cc
commit
4d077f4ee8
4
cli.js
4
cli.js
|
@ -38,8 +38,8 @@ function run() {
|
|||
// Here goes any cli commands we need to
|
||||
}
|
||||
|
||||
function init() {
|
||||
spawn('sh', [path.resolve(__dirname, 'init.sh')], {stdio:'inherit'});
|
||||
function init(root, projectName) {
|
||||
spawn(path.resolve(__dirname, 'init.sh'), [projectName], {stdio:'inherit'});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -14,7 +14,7 @@ def cp(src, dest, app_name)
|
|||
end
|
||||
|
||||
def main(dest, app_name)
|
||||
source = File.expand_path("../../Examples/SampleApp", __FILE__)
|
||||
source = File.expand_path("../Examples/SampleApp", __FILE__)
|
||||
files = Dir.chdir(source) { Dir["**/*"] }
|
||||
.reject { |file| file["project.xcworkspace"] || file["xcuserdata"] }
|
||||
.each { |file|
|
|
@ -8,16 +8,18 @@ var fs = require('fs');
|
|||
var path = require('path');
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
var CLI_MODULE_PATH = path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules',
|
||||
'react-native',
|
||||
'cli'
|
||||
);
|
||||
var CLI_MODULE_PATH = function() {
|
||||
return path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules',
|
||||
'react-native',
|
||||
'cli'
|
||||
);
|
||||
};
|
||||
|
||||
var cli;
|
||||
try {
|
||||
cli = require(CLI_MODULE_PATH);
|
||||
cli = require(CLI_MODULE_PATH());
|
||||
} catch(e) {}
|
||||
|
||||
if (cli) {
|
||||
|
@ -66,7 +68,10 @@ function init(name) {
|
|||
var packageJson = {
|
||||
name: projectName,
|
||||
version: '0.0.1',
|
||||
private: true
|
||||
private: true,
|
||||
scripts: {
|
||||
start: "react-native start"
|
||||
}
|
||||
};
|
||||
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson));
|
||||
process.chdir(root);
|
||||
|
@ -77,7 +82,7 @@ function init(name) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
var cli = require(CLI_MODULE_PATH);
|
||||
var cli = require(CLI_MODULE_PATH());
|
||||
cli.init(root, projectName);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue