Skip to content

Commit

Permalink
Use node instead of bash for sdk link so it works on windows as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Thomas committed Dec 18, 2017
1 parent 48fddfb commit 541e0a8
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 76 deletions.
43 changes: 2 additions & 41 deletions helpers/local_sdk.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
'use strict';

const path = require('path');
const fse = require('fs-extra');
const child_process = require('child_process');
const localSdk = require(path.join(process.env.BB_SDK_SRC_DIR, 'bespoke-gulp-tasks', 'helpers', 'local_sdk.js'));
const localSDK = require(path.join(process.env.BB_SDK_SRC_DIR, 'bespoke-gulp-tasks', 'helpers', 'local_sdk.js'));
const projectRootPath = path.join(__dirname, '..');

// check / empty tmp
console.log('Preparing tmp dir');
if (fse.existsSync('tmp')) {
fse.emptyDirSync('tmp');
} else {
fse.ensureDirSync('tmp');
}

console.log('Preparing node_modules');
if (fse.existsSync('node_modules')) {
fse.removeSync('node_modules/bookingbug-angular');
fse.moveSync('node_modules', 'tmp/node_modules');
}

console.log('Local sdk prepare');
localSdk.prepare(projectRootPath);

console.log('Change dir to tmp');
process.chdir('tmp');

console.log('Exec npm install');
child_process.exec('npm install --global-style --no-package-lock', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
process.exit(1);
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);

console.log('Change dir ..');
process.chdir('..');

console.log('Put node_modules back');
fse.moveSync('tmp/node_modules', 'node_modules');

console.log('Local sdk symlink');
localSdk.symlink(projectRootPath);
});
localSDK.link(projectRootPath);
20 changes: 0 additions & 20 deletions helpers/local_sdk.sh

This file was deleted.

7 changes: 0 additions & 7 deletions helpers/local_sdk_prepare.js

This file was deleted.

7 changes: 0 additions & 7 deletions helpers/local_sdk_symlink.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"i": "rm -rf ./node_modules/bookingbug-angular package-lock.json && npm install --global-style --no-package-lock",
"il": "sh ./helpers/local_sdk.sh",
"il": "node ./helpers/local_sdk.js",
"p": "gulp --root public",
"p-dev": "gulp --root public --env development",
"p-staging": "gulp --root public --env staging",
Expand Down

0 comments on commit 541e0a8

Please sign in to comment.