Skip to content

Commit

Permalink
feat(local-cli): implement "hops start" command
Browse files Browse the repository at this point in the history
  • Loading branch information
ZauberNerd authored and dmbch committed Oct 13, 2017
1 parent 1982028 commit e5d9906
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/local-cli/commands/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var hopsBuild = require('hops-build');
var hopsExpress = require('hops-express');

module.exports = function startCommand (callback) {
return {
command: 'start',
describe: 'Starts a development or production server, based on NODE_ENV',
builder: {},
handler: function startHandler (argv) {
if (process.env.NODE_ENV === 'production') {
hopsExpress.startServer(callback);
} else {
hopsBuild.runServer(argv, callback);
}
}
};
};
7 changes: 7 additions & 0 deletions packages/local-cli/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ module.exports = function run (argv, callback) {
args.command(require('./commands/serve')(callback));
}

if (
pm.isPackageInstalled('hops-build') &&
pm.isPackageInstalled('hops-express')
) {
args.command(require('./commands/start')(callback));
}

args.parse(argv);
};

Expand Down

0 comments on commit e5d9906

Please sign in to comment.