add quickInstall script

This commit is contained in:
Ran Greenberg 2017-02-28 15:56:06 +02:00
parent cc847b089b
commit 10090cd813
2 changed files with 36 additions and 1 deletions

View File

@ -3,7 +3,8 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
"start": "node node_modules/react-native/local-cli/cli.js start",
"quickinstall": "node scripts/quickinstall"
},
"dependencies": {
"lodash": "^4.13.1",

View File

@ -0,0 +1,34 @@
const exec = require('shell-utils').exec;
function removeHardlinks() {
exec.execSync(`hardlink ./node_modules/react-native-camera-kit/ -u || true`);
}
function removeNodeModules() {
exec.execSync(`rm -rf ./node_modules || true`);
}
function copyNodeModules() {
exec.execSync(`cp -Rf ../node_modules ./`);
}
function installMain() {
exec.execSync(`mkdir -p ./node_modules/react-native-camera-kit`);
const tar = exec.execSyncRead(`cd .. && npm pack`);
exec.execSync(`tar -xf ../${tar} -C ./node_modules/react-native-camera-kit --strip 1`);
exec.execSync(`rm ../${tar}`);
}
function hardlink() {
exec.execSync(`hardlink ../ ./node_modules/react-native-camera-kit || true`);
}
function run() {
removeHardlinks();
removeNodeModules();
copyNodeModules();
installMain();
hardlink();
}
run();