check deps before launching

This commit is contained in:
Jonathan Rainville 2018-09-07 12:37:18 -04:00
parent a622f22dcd
commit 542462faed
2 changed files with 61 additions and 43 deletions

View File

@ -4,11 +4,30 @@ try {
eval('let __nodeTest = 123;');
} catch(e) {
if (e.name === 'SyntaxError') {
console.error("unsupported version of NodeJS. Make sure you are running nodejs 6.9.5 or above");
console.error("unsupported version of NodeJS. Make sure you are running nodejs 8.11.3 or above");
process.exit();
}
}
function launchEmbark() {
var Cmd = require('../cmd/cmd');
var cli = new Cmd();
cli.process(process.argv);
}
const path = require('path');
require('colors');
try {
const dappPackage = require(path.join(process.cwd(), 'package.json'));
require('check-dependencies')(dappPackage, (state) => {
if (state.status) {
console.error('\nMissing dependencies. Please run npm install'.red);
process.exit();
}
launchEmbark();
});
} catch (e) {
launchEmbark();
}

View File

@ -26,9 +26,9 @@ if (!process.env.EMBARK_PATH) {
// as an ejected webpack.config.js), making embark's dependencies trasitive
// dependencies of a dapp without the dapp explicitly specifying embark as a
// dependency in the dapp's package.json
process.env.NODE_PATH = utils.joinPath(process.env.EMBARK_PATH, 'node_modules')
+ (process.env.NODE_PATH ? require('path').delimiter : '')
+ (process.env.NODE_PATH || '');
process.env.NODE_PATH = utils.joinPath(process.env.EMBARK_PATH, 'node_modules') +
(process.env.NODE_PATH ? require('path').delimiter : '') +
(process.env.NODE_PATH || '');
class Cmd {
constructor() {
@ -98,13 +98,12 @@ class Cmd {
}
}
});
} else {
}
if (options.simple) {
embark.generateTemplate('simple', './', name);
} else {
embark.generateTemplate('boilerplate', './', name, options.template);
}
}
});
}