move requires to methods that actually need them

This commit is contained in:
Iuri Matias 2018-06-01 11:57:01 -04:00
parent a3de13e011
commit 0dbefad48b
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,4 @@
const program = require('commander');
const promptly = require('promptly');
const utils = require('./utils/utils.js');
const Embark = require('../lib/index');
const i18n = require('./i18n/i18n.js');
let embark = new Embark;
@ -50,6 +48,7 @@ class Cmd {
.action(function (name, options) {
i18n.setOrDetectLocale(options.locale);
if (name === undefined) {
const promptly = require('promptly');
return promptly.prompt(__("Name your app (default is %s):", 'embarkDapp'), {
default: "embarkDApp",
validator: validateName
@ -259,6 +258,7 @@ class Cmd {
program
.action(function (cmd) {
console.log((__('unknown command') + ' "%s"').red, cmd);
let utils = require('./utils/utils.js');
let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version'];
let suggestion = utils.proposeAlternative(cmd, dictionary);
if (suggestion) {