Skip to content

Commit

Permalink
feat: add run command
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Jan 10, 2021
1 parent b705a8e commit 513107c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bin/lcui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const logger = require('../lib/logger');
const { create } = require('../lib/create');
const { generate } = require('../lib/generator');
const { compile } = require('../lib/compiler');
const { build } = require('../lib/builder');
const { build, run } = require('../lib/builder');
const { version } = require('../package.json');

function wrapAction(action) {
Expand Down Expand Up @@ -53,4 +53,9 @@ program
build({ tool: cmd.tool, mode: cmd.mode });
}));

program
.command('run')
.description('run project')
.action(wrapAction(run));

program.version(version).parse(process.argv);
11 changes: 10 additions & 1 deletion lib/builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ function build(options) {
builder.build();
}

function run() {
logger.log('run application...');
if (new Builder().run().status !== 0) {
throw new Error('the application is not working properly.');
}
logger.log('the application has exited.');
}

module.exports = {
build
build,
run
};

0 comments on commit 513107c

Please sign in to comment.