ignite-andross
Advanced tools
Comparing version 3.0.4 to 4.0.0-alpha.1
@@ -13,3 +13,3 @@ const options = require('./options') | ||
*/ | ||
const isAndroidInstalled = function (context) { | ||
const isAndroidInstalled = function(context) { | ||
const androidHome = process.env['ANDROID_HOME'] | ||
@@ -27,22 +27,11 @@ const hasAndroidEnv = !context.strings.isBlank(androidHome) | ||
*/ | ||
async function install (context) { | ||
const { | ||
filesystem, | ||
parameters, | ||
ignite, | ||
reactNative, | ||
print, | ||
system, | ||
prompt, | ||
template | ||
} = context | ||
async function install(context) { | ||
const { filesystem, parameters, ignite, reactNative, print, system, prompt, template } = context | ||
const { colors } = print | ||
const { red, yellow, bold, gray, blue } = colors | ||
const perfStart = (new Date()).getTime() | ||
const perfStart = new Date().getTime() | ||
const name = parameters.third | ||
const spinner = print | ||
.spin(`using the ${red('Infinite Red')} boilerplate v2 (code name 'Andross')`) | ||
.succeed() | ||
const name = parameters.first | ||
const spinner = print.spin(`using the ${red('Infinite Red')} boilerplate v2 (code name 'Andross')`).succeed() | ||
@@ -75,2 +64,3 @@ // attempt to install React Native or die trying | ||
}) | ||
filesystem.dir(`${process.cwd()}/ignite`) | ||
spinner.stop() | ||
@@ -109,3 +99,3 @@ | ||
await ignite.copyBatch(context, templates, templateProps, { | ||
quiet: true, | ||
quiet: !parameters.options.debug, | ||
directory: `${ignite.ignitePluginPath()}/boilerplate` | ||
@@ -125,36 +115,25 @@ }) | ||
*/ | ||
async function mergePackageJsons () { | ||
// transform our package.json in case we need to replace variables | ||
const rawJson = await template.generate({ | ||
directory: `${ignite.ignitePluginPath()}/boilerplate`, | ||
template: 'package.json.ejs', | ||
props: templateProps | ||
}) | ||
const newPackageJson = JSON.parse(rawJson) | ||
// read in the react-native created package.json | ||
const currentPackage = filesystem.read('package.json', 'json') | ||
// transform our package.json in case we need to replace variables | ||
const rawJson = await template.generate({ | ||
directory: `${ignite.ignitePluginPath()}/boilerplate`, | ||
template: 'package.json.ejs', | ||
props: templateProps | ||
}) | ||
const newPackageJson = JSON.parse(rawJson) | ||
// deep merge, lol | ||
const newPackage = pipe( | ||
assoc( | ||
'dependencies', | ||
merge(currentPackage.dependencies, newPackageJson.dependencies) | ||
), | ||
assoc( | ||
'devDependencies', | ||
merge(currentPackage.devDependencies, newPackageJson.devDependencies) | ||
), | ||
assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)), | ||
merge( | ||
__, | ||
omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson) | ||
) | ||
)(currentPackage) | ||
// read in the react-native created package.json | ||
const currentPackage = filesystem.read('package.json', 'json') | ||
// write this out | ||
filesystem.write('package.json', newPackage, { jsonIndent: 2 }) | ||
} | ||
await mergePackageJsons() | ||
// deep merge, lol | ||
const newPackage = pipe( | ||
assoc('dependencies', merge(currentPackage.dependencies, newPackageJson.dependencies)), | ||
assoc('devDependencies', merge(currentPackage.devDependencies, newPackageJson.devDependencies)), | ||
assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)), | ||
merge(__, omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson)) | ||
)(currentPackage) | ||
// write this out | ||
filesystem.write('package.json', newPackage, { jsonIndent: 2 }) | ||
spinner.stop() | ||
@@ -195,11 +174,12 @@ | ||
after: `public class MainActivity extends ReactActivity {`, | ||
insert: '\n @Override\n' + | ||
' protected ReactActivityDelegate createReactActivityDelegate() {\n' + | ||
' return new ReactActivityDelegate(this, getMainComponentName()) {\n' + | ||
' @Override\n' + | ||
' protected ReactRootView createRootView() {\n' + | ||
' return new RNGestureHandlerEnabledRootView(MainActivity.this);\n' + | ||
' }\n' + | ||
' };\n' + | ||
' }' | ||
insert: | ||
'\n @Override\n' + | ||
' protected ReactActivityDelegate createReactActivityDelegate() {\n' + | ||
' return new ReactActivityDelegate(this, getMainComponentName()) {\n' + | ||
' @Override\n' + | ||
' protected ReactRootView createRootView() {\n' + | ||
' return new RNGestureHandlerEnabledRootView(MainActivity.this);\n' + | ||
' }\n' + | ||
' };\n' + | ||
' }' | ||
}) | ||
@@ -236,3 +216,3 @@ if (answers['vector-icons'] === 'react-native-vector-icons') { | ||
if (parameters.options.lint !== 'false') { | ||
if (parameters.options.lint !== false) { | ||
await system.spawn(`ignite add standard@1.0.0 ${debugFlag}`, { | ||
@@ -260,7 +240,10 @@ stdio: 'inherit' | ||
const perfDuration = parseInt(((new Date()).getTime() - perfStart) / 10) / 100 | ||
const perfDuration = parseInt((new Date().getTime() - perfStart) / 10) / 100 | ||
spinner.succeed(`ignited ${yellow(name)} in ${perfDuration}s`) | ||
const androidInfo = isAndroidInstalled(context) ? '' | ||
: `\n\nTo run in Android, make sure you've followed the latest react-native setup instructions at https://facebook.github.io/react-native/docs/getting-started.html before using ignite.\nYou won't be able to run ${bold('react-native run-android')} successfully until you have.` | ||
const androidInfo = isAndroidInstalled(context) | ||
? '' | ||
: `\n\nTo run in Android, make sure you've followed the latest react-native setup instructions at https://facebook.github.io/react-native/docs/getting-started.html before using ignite.\nYou won't be able to run ${bold( | ||
'react-native run-android' | ||
)} successfully until you have.` | ||
@@ -277,3 +260,5 @@ const successMessage = ` | ||
${gray('Read the walkthrough at https://github.com/infinitered/ignite-andross/blob/master/readme.md#boilerplate-walkthrough')} | ||
${gray( | ||
'Read the walkthrough at https://github.com/infinitered/ignite-andross/blob/master/readme.md#boilerplate-walkthrough' | ||
)} | ||
@@ -280,0 +265,0 @@ ${blue('Need additional help? Join our Slack community at http://community.infinite.red.')} |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/infinitered/ignite-andross", | ||
"version": "3.0.4", | ||
"version": "4.0.0-alpha.1", | ||
"files": [ | ||
@@ -47,2 +47,7 @@ "boilerplate", | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
}, | ||
"release": { | ||
@@ -49,0 +54,0 @@ "plugins": [ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1422444
2200
1