From 9b9df21c9317333cfb294c47c25d807c242fb752 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 13 Dec 2016 17:57:54 -0800 Subject: [PATCH] fix(script/bootstrap) Properly remove already present lns + error handling --- script/bootstrap | 23 ++++++++++++++++++----- src/K2 | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index d085667de..4bde73fa8 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -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) +}) diff --git a/src/K2 b/src/K2 index 35e040d7d..67d1e14e6 160000 --- a/src/K2 +++ b/src/K2 @@ -1 +1 @@ -Subproject commit 35e040d7d0835ba966dc7f71cdf97adca8725db6 +Subproject commit 67d1e14e60fe204faf56622de38f2124ac7ffe24