react-native-repackager
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "react-native-repackager", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Custom extension for react-native packager", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -16,6 +16,12 @@ #!/usr/bin/env node | ||
function run() { | ||
console.log(`rootDir: ${rootDir}`); | ||
console.log(`scriptDir: ${scriptDir}`); | ||
assertRN44(); | ||
if (shouldSetup) { | ||
if (alreadyApplied()) { | ||
console.log(`repackager was already applied successfully, exiting`); | ||
return; | ||
} | ||
console.log(`injecting support for --customExtensions`); | ||
exec.execSync(`git apply --verbose --no-index --directory ${reactNativeDir} ${scriptDir}/rn44PackagerCustomExtensions.patch`); | ||
exec.execSync(`git apply --verbose --no-index --directory node_modules/react-native ${scriptDir}/rn44PackagerCustomExtensions.patch`); | ||
} | ||
@@ -26,5 +32,9 @@ } | ||
const rnPackageJson = JSON.parse(fs.readFileSync(`${reactNativeDir}/package.json`)); | ||
if (!_.startsWith(rnPackageJson, '0.44')) { | ||
if (!_.startsWith(rnPackageJson.version, '0.44')) { | ||
throw new Error(`Only react-native 0.44.x is supported currently`); | ||
} | ||
} | ||
function alreadyApplied() { | ||
return _.includes(String(fs.readFileSync(`${reactNativeDir}/local-cli/cli.js`)), 'repackager applied successfully'); | ||
} |
Sorry, the diff of this file is not supported yet
20886
32