mirror of https://github.com/embarklabs/embark.git
bin/embark handles checkDeps
This commit is contained in:
parent
87b2d034cf
commit
965c22d108
27
cmd/cmd.js
27
cmd/cmd.js
|
@ -37,25 +37,6 @@ process.env.NODE_PATH = utils.joinPath(process.env.EMBARK_PATH, 'node_modules')
|
||||||
|
|
||||||
process.env.DEFAULT_DIAGRAM_PATH = utils.joinPath(process.env.DAPP_PATH, 'diagram.svg');
|
process.env.DEFAULT_DIAGRAM_PATH = utils.joinPath(process.env.DAPP_PATH, 'diagram.svg');
|
||||||
|
|
||||||
function checkDeps() {
|
|
||||||
const path = require('path');
|
|
||||||
try {
|
|
||||||
const dappPackage = require(path.join(process.cwd(), 'package.json'));
|
|
||||||
require(path.join(process.cwd(), 'embark.json')); // Make sure we are in a Dapp
|
|
||||||
require('check-dependencies')(dappPackage, (state) => {
|
|
||||||
if (state.status) {
|
|
||||||
require('colors');
|
|
||||||
console.error('\nMissing dependencies. Please run npm install'.red);
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
} catch (_e) {
|
|
||||||
// We are not in a Dapp
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Cmd {
|
class Cmd {
|
||||||
constructor() {
|
constructor() {
|
||||||
program.version(embark.version);
|
program.version(embark.version);
|
||||||
|
@ -155,7 +136,6 @@ class Cmd {
|
||||||
.option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
|
.option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
|
||||||
.description(__('deploy and build dapp at ') + 'dist/ (default: development)')
|
.description(__('deploy and build dapp at ') + 'dist/ (default: development)')
|
||||||
.action(function(env, _options) {
|
.action(function(env, _options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(_options.locale);
|
i18n.setOrDetectLocale(_options.locale);
|
||||||
_options.env = env || 'development';
|
_options.env = env || 'development';
|
||||||
_options.logFile = _options.logfile; // fix casing
|
_options.logFile = _options.logfile; // fix casing
|
||||||
|
@ -183,7 +163,6 @@ class Cmd {
|
||||||
.option('--pipeline [pipeline]', __('webpack config to use (default: development)'))
|
.option('--pipeline [pipeline]', __('webpack config to use (default: development)'))
|
||||||
.description(__('run dapp (default: %s)', 'development'))
|
.description(__('run dapp (default: %s)', 'development'))
|
||||||
.action(function(env, options) {
|
.action(function(env, options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
const nullify = (v) => (!v || typeof v !== 'string') ? null : v;
|
const nullify = (v) => (!v || typeof v !== 'string') ? null : v;
|
||||||
embark.run({
|
embark.run({
|
||||||
|
@ -212,7 +191,6 @@ class Cmd {
|
||||||
.option('--pipeline [pipeline]', __('webpack config to use (default: development)'))
|
.option('--pipeline [pipeline]', __('webpack config to use (default: development)'))
|
||||||
.description(__('Start the Embark console'))
|
.description(__('Start the Embark console'))
|
||||||
.action(function(env, options) {
|
.action(function(env, options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
embark.console({
|
embark.console({
|
||||||
env: env || 'development',
|
env: env || 'development',
|
||||||
|
@ -232,7 +210,6 @@ class Cmd {
|
||||||
.option('--locale [locale]', __('language to use (default: en)'))
|
.option('--locale [locale]', __('language to use (default: en)'))
|
||||||
.description(__('run blockchain server (default: %s)', 'development'))
|
.description(__('run blockchain server (default: %s)', 'development'))
|
||||||
.action(function(env, options) {
|
.action(function(env, options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
embark.initConfig(env || 'development', {
|
embark.initConfig(env || 'development', {
|
||||||
embarkConfig: 'embark.json',
|
embarkConfig: 'embark.json',
|
||||||
|
@ -255,7 +232,6 @@ class Cmd {
|
||||||
.option('--locale [locale]', __('language to use (default: en)'))
|
.option('--locale [locale]', __('language to use (default: en)'))
|
||||||
|
|
||||||
.action(function(env, options) {
|
.action(function(env, options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
embark.initConfig(env || 'development', {
|
embark.initConfig(env || 'development', {
|
||||||
embarkConfig: 'embark.json',
|
embarkConfig: 'embark.json',
|
||||||
|
@ -299,7 +275,6 @@ class Cmd {
|
||||||
options.outputHelp();
|
options.outputHelp();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
embark.runTests({file, solc:options.solc, loglevel: options.loglevel, gasDetails: options.gasDetails,
|
embark.runTests({file, solc:options.solc, loglevel: options.loglevel, gasDetails: options.gasDetails,
|
||||||
node: options.node, coverage: options.coverage, noBrowser: options.nobrowser});
|
node: options.node, coverage: options.coverage, noBrowser: options.nobrowser});
|
||||||
|
@ -317,7 +292,6 @@ class Cmd {
|
||||||
.option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
|
.option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
|
||||||
.description(__('Upload your dapp to a decentralized storage') + '.')
|
.description(__('Upload your dapp to a decentralized storage') + '.')
|
||||||
.action(function(env, _options) {
|
.action(function(env, _options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(_options.locale);
|
i18n.setOrDetectLocale(_options.locale);
|
||||||
if (env === "ipfs" || env === "swarm") {
|
if (env === "ipfs" || env === "swarm") {
|
||||||
console.warn(("did you mean " + "embark upload".bold + " ?").underline);
|
console.warn(("did you mean " + "embark upload".bold + " ?").underline);
|
||||||
|
@ -343,7 +317,6 @@ class Cmd {
|
||||||
.option('--output [svgfile]', __('filepath to output SVG graph to (default: %s)', process.env['DEFAULT_DIAGRAM_PATH']))
|
.option('--output [svgfile]', __('filepath to output SVG graph to (default: %s)', process.env['DEFAULT_DIAGRAM_PATH']))
|
||||||
.description(__('generates documentation based on the smart contracts configured'))
|
.description(__('generates documentation based on the smart contracts configured'))
|
||||||
.action(function(env, options) {
|
.action(function(env, options) {
|
||||||
checkDeps();
|
|
||||||
i18n.setOrDetectLocale(options.locale);
|
i18n.setOrDetectLocale(options.locale);
|
||||||
embark.graph({
|
embark.graph({
|
||||||
env: env || 'development',
|
env: env || 'development',
|
||||||
|
|
Loading…
Reference in New Issue