fix(script/bootstrap) Properly remove already present lns + error handling

This commit is contained in:
Juan Tejada 2016-12-13 17:57:54 -08:00
parent cb9802daf2
commit 9b9df21c93
2 changed files with 19 additions and 6 deletions

View file

@ -41,17 +41,26 @@ function installPrivateResources() {
const privateDir = path.resolve(path.join('src', 'K2', 'packages', 'local-private'))
const canaryFileExists = fs.existsSync(path.join(privateDir, "README.md"))
if (!canaryFileExists) {
console.log(`Could not find pro submodule at ${privateDir}. Skipping...`)
console.log(`Could not find submodule at ${privateDir}. Skipping...`)
return;
}
const unlinkIfExistsSync = (p) => {
try { if (fs.lstatSync(p)) { fs.removeSync(p); } } catch (err) { return }
try {
if (fs.lstatSync(p)) {
fs.removeSync(p);
}
} catch (err) {
return
}
}
// copy Arc Files
unlinkIfExistsSync('.arcconfig');
fs.symlinkSync(path.join('src', 'K2', '.arcconfig'), '.arcconfig', 'file');
unlinkIfExistsSync('.arclint');
fs.symlinkSync(path.join('src', 'K2', '.arclint'), '.arclint', 'file');
unlinkIfExistsSync('arclib');
fs.symlinkSync(path.join('src', 'K2', 'arclib'), 'arclib', 'dir');
// copy Source Extensions
@ -74,10 +83,10 @@ function installPrivateResources() {
}
function verifySubmodule() {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
try {
var exec = require('child_process').exec;
var cmd = 'git submodule update --init --recursive';
const exec = require('child_process').exec;
const cmd = 'git submodule update --init --recursive';
exec(cmd, (error, stdout) => {
console.log(stdout);
if (error) console.error(error);
@ -102,3 +111,7 @@ verifySubmodule()
.then(() => npm('rebuild', {cwd: path.join('src', 'K2', 'packages', 'cloud-api'), env: 'system'}))
.then(() => npm('rebuild', {cwd: path.join('src', 'K2', 'packages', 'cloud-workers'), env: 'system'}))
.then(() => installPrivateResources())
.catch((err) => {
console.log('script/bootstrap encountered an error')
console.log(err)
})

2
src/K2

@ -1 +1 @@
Subproject commit 35e040d7d0835ba966dc7f71cdf97adca8725db6
Subproject commit 67d1e14e60fe204faf56622de38f2124ac7ffe24