File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { NPM } from 'aurelia-cli';
2
+ import { CLIOptions } from 'aurelia-cli';
3
+ import * as project from '../aurelia.json';
2
4
3
- export default function() {
5
+ var find = require('find-process');
6
+ var kill = require('tree-kill');
7
+
8
+ const port = CLIOptions.getFlagValue('port') || project.platform.port;
9
+ const host = CLIOptions.getFlagValue('host') || project.platform.host || "localhost";
10
+
11
+ const run = () => {
4
12
console.log('`au run` is an alias of the `npm start`, you may use either of those; see README for more details.');
5
13
6
14
const args = process.argv.slice(3);
7
- return (new NPM()).run('start',['--', ...args]);
15
+
16
+ if (!CLIOptions.hasFlag('port')) {
17
+ args.push('--port');
18
+ args.push(port);
19
+ }
20
+ if (!CLIOptions.hasFlag('host')) {
21
+ args.push('--host');
22
+ args.push(host);
23
+ }
24
+
25
+ return (new NPM()).run('start', ['--', ...args]);
8
26
}
27
+
28
+ const shutdownAppServer = () => {
29
+ return new Promise(resolve => {
30
+ find('port', port)
31
+ .then(function (list) {
32
+ if (list.length) {
33
+ kill(list[0].pid, 'SIGKILL', function (err) {
34
+ resolve();
35
+ });
36
+ }
37
+ });
38
+ });
39
+ };
40
+
41
+ export { run as default, shutdownAppServer };
Original file line number Diff line number Diff line change 68
68
"html-loader" : " " ,
69
69
"istanbul-instrumenter-loader" : " " ,
70
70
"webpack-bundle-analyzer" : " " ,
71
+ "find-process" : " ^1.4.2" ,
72
+ "tree-kill" : " ^1.2.1" ,
71
73
},
72
74
"scripts" : {
73
75
"build" : " webpack --env.production --env.extractCss" ,
You can’t perform that action at this time.
0 commit comments