react-cross-platform-cli
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -24,3 +24,3 @@ import React from 'react'; | ||
<Text style={styles.instructions}> | ||
To get started, edit index.<platform>.js | ||
To get started, edit app.js | ||
</Text> | ||
@@ -27,0 +27,0 @@ <Text style={styles.instructions}> |
@@ -60,23 +60,25 @@ #!/usr/bin/env node | ||
checkForYarn(function() { | ||
console.log('Please answer the following questions:'); | ||
console.log(''); | ||
var project = readInput(); | ||
checkForYarn(function(yarn) { | ||
checkForReactNativeCli(function() { | ||
console.log('Please answer the following questions:'); | ||
console.log(''); | ||
var project = readInput(); | ||
console.log(''); | ||
console.log('Initializing application...'); | ||
execSync('react-native init ' + project.project.name); | ||
fs.writeFileSync(path.join(path.resolve('.'), project.project.name, 'package.json'), JSON.stringify(project.project, null, 2)); | ||
execSync('cd ' + project.project.name + ' && rm -r -f node_modules && yarn'); | ||
console.log(''); | ||
console.log('Initializing application...'); | ||
execSync('react-native init ' + project.project.name); | ||
fs.writeFileSync(path.join(path.resolve('.'), project.project.name, 'package.json'), JSON.stringify(project.project, null, 2)); | ||
execSync('cd ' + project.project.name + ' && rm -r -f node_modules && ' + (yarn ? 'yarn' : 'npm install')); | ||
console.log('Copying files...'); | ||
copyFiles(project.project.name, project.web, project.desktop); | ||
console.log(''); | ||
console.log('Doing stuff...'); | ||
correctXcodeProject(project.project.name); | ||
console.log('Copying files...'); | ||
copyFiles(project.project.name, project.web, project.desktop); | ||
console.log(''); | ||
console.log('Doing stuff...'); | ||
correctXcodeProject(project.project.name); | ||
console.log(''); | ||
console.log('We did it! Happy coding :)'); | ||
console.log(''); | ||
process.exit(); | ||
console.log(''); | ||
console.log('We did it! Happy coding :)'); | ||
console.log(''); | ||
process.exit(); | ||
}); | ||
}); | ||
@@ -88,5 +90,34 @@ } | ||
if (stderr === '' && stdout.replace('\n', '').match(/^[0-9]+.[0-9]+.[0-9]+$/)) { | ||
callback(true); | ||
} else { | ||
console.log('It seems that you don\'t have yarn installed. We recommend it as package manager as it is much faster than npm.'); | ||
console.log(''); | ||
var install = readline.question('\tDo you want to install yarn globally now? Enter Y/n: '); | ||
console.log(''); | ||
if (install === 'y' || install === 'Y') { | ||
installYarn(callback); | ||
} else { | ||
callback(false); | ||
} | ||
} | ||
}); | ||
} | ||
function installYarn(callback) { | ||
console.log('Installing yarn...'); | ||
let response = execSync('npm install -g yarn').toString(); | ||
if (response.indexOf('npm ERR!') > -1) { | ||
console.log('Oh no, something went wrong! Try to install yarn manually and come back later!'); | ||
process.exit(); | ||
} | ||
console.log('Horray! You now have yarn installed.'); | ||
callback(true); | ||
} | ||
function checkForReactNativeCli(callback) { | ||
require('child_process').exec('react-native --version', (error, stdout, stderr) => { | ||
if (stderr === '' && stdout.substr(0, 17) === 'react-native-cli:') { | ||
callback(); | ||
} else { | ||
installYarn(callback); | ||
installReactNativeCli(callback); | ||
} | ||
@@ -96,15 +127,15 @@ }); | ||
function installYarn(callback) { | ||
console.log('It seems that you don\'t have yarn installed. You will like it, believe me!'); | ||
function installReactNativeCli(callback) { | ||
console.log('It seems that you don\'t have react-native-cli installed. We need this to initialize your application.'); | ||
console.log(''); | ||
var install = readline.question('\tDo you want to install yarn globally now? Enter Y/n: '); | ||
var install = readline.question('\tDo you want to install react-native-cli globally now? Enter Y/n: '); | ||
console.log(''); | ||
if (install === 'y' || install === 'Y') { | ||
console.log('Installing yarn...'); | ||
let response = execSync('npm install -g yarn').toString(); | ||
console.log('Installing react-native-cli...'); | ||
let response = execSync('npm install -g react-native-cli').toString(); | ||
if (response.indexOf('npm ERR!') > -1) { | ||
console.log('Oh no, something went wrong! Try to install yarn manually and come back later!'); | ||
console.log('Oh no, something went wrong! Try to install react-native-cli manually and come back later!'); | ||
process.exit(); | ||
} | ||
console.log('Horray! You now have yarn installed.'); | ||
console.log('Horray! You now have react-native-cli installed.'); | ||
callback(); | ||
@@ -192,3 +223,3 @@ } else { | ||
project['main'] = 'index.desktop.js'; | ||
project['scripts']['desktop'] = 'npm run web:build && electron .'; | ||
project['scripts']['desktop'] = 'npm run web:build & electron .'; | ||
project['dependencies']['electron'] = '^1.6.11'; | ||
@@ -195,0 +226,0 @@ } |
{ | ||
"name": "react-cross-platform-cli", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Command line interface to create a boilerplate for a cross platform react application.", | ||
@@ -32,5 +32,4 @@ "bin": { | ||
"minimist": "^1.2.0", | ||
"react-native-cli": "^2.0.1", | ||
"readline-sync": "^1.4.7" | ||
} | ||
} |
@@ -22,4 +22,6 @@ # react-cross-platform-cli | ||
The CLI uses `yarn` as package manager. You can either install `yarn` manually or let the CLI do this for you. (In the future this CLI shall also work using native `npm` instead of `yarn`.) | ||
The recommended package manager is `yarn`. If you don't have it installed, you can let the CLI do it for you. If you don't want to use yarn, the CLI will go on using `npm` as package manager. | ||
The CLI uses `react-native-cli` to initialize the application. You can either install `react-native-cli` manually or let the CLI do this for you. | ||
## Usage | ||
@@ -26,0 +28,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25999
2
576
51
3
- Removedreact-native-cli@^2.0.1
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarray-buffer-byte-length@1.0.2(transitive)
- Removedasync@0.2.10(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcolors@0.6.2(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcycle@1.0.3(transitive)
- Removeddeep-equal@2.2.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-get-iterator@1.1.3(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedeyes@0.1.8(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedglob@7.2.3(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-bigints@1.1.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedi@0.3.7(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinternal-slot@1.1.0(transitive)
- Removedis-arguments@1.2.0(transitive)
- Removedis-array-buffer@3.0.5(transitive)
- Removedis-bigint@1.1.0(transitive)
- Removedis-boolean-object@1.2.1(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-date-object@1.1.0(transitive)
- Removedis-map@2.0.3(transitive)
- Removedis-number-object@1.1.1(transitive)
- Removedis-regex@1.2.1(transitive)
- Removedis-set@2.0.3(transitive)
- Removedis-shared-array-buffer@1.0.4(transitive)
- Removedis-string@1.1.1(transitive)
- Removedis-symbol@1.1.1(transitive)
- Removedis-weakmap@2.0.2(transitive)
- Removedis-weakset@2.0.4(transitive)
- Removedisarray@2.0.5(transitive)
- Removedisstream@0.1.2(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmute-stream@0.0.8(transitive)
- Removedncp@0.4.2(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.7(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpkginfo@0.3.10.4.1(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedprompt@0.2.14(transitive)
- Removedreact-native-cli@2.0.1(transitive)
- Removedread@1.0.7(transitive)
- Removedregexp.prototype.flags@1.5.4(transitive)
- Removedrevalidator@0.1.8(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-regex-test@1.1.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.1.0(transitive)
- Removedside-channel-list@1.0.0(transitive)
- Removedside-channel-map@1.0.1(transitive)
- Removedside-channel-weakmap@1.0.2(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstop-iteration-iterator@1.1.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedutile@0.2.1(transitive)
- Removedwhich-boxed-primitive@1.1.1(transitive)
- Removedwhich-collection@1.0.2(transitive)
- Removedwhich-typed-array@1.1.18(transitive)
- Removedwinston@0.8.3(transitive)
- Removedwrappy@1.0.2(transitive)