1
1
/*! European Union Public License version 1.2 !*/
2
2
/*! Copyright © 2018 Rick Beerendonk !*/
3
3
4
- /* global process, require */
5
4
/* eslint-disable no-console */
6
5
7
6
const childProcess = require ( 'child_process' ) ;
8
7
9
- const portHttp = process . argv [ 2 ] || 8080 ;
10
- //const portRest = +portHttp + 1;
11
- let filePath = process . argv [ 3 ] ;
8
+ const [ , , portHttp = 8080 , filePath ] = process . argv ;
12
9
const basePath = process . cwd ( ) ;
13
10
14
- //console.log('portHttp: ' + portHttp);
15
- //console.log('portRest: ' + portRest);
16
- //console.log('filePath: ' + filePath);
17
- //console.log('basePath: ' + basePath);
18
-
19
11
// If filePath is given, we'll open that path in the browser
20
12
let extraUri = '' ;
21
13
if ( filePath && filePath . toLowerCase ( ) . startsWith ( basePath . toLowerCase ( ) ) ) {
@@ -26,11 +18,6 @@ if (filePath && filePath.toLowerCase().startsWith(basePath.toLowerCase())) {
26
18
const serverUri = `http://localhost:${ portHttp } ` ;
27
19
const totalUri = `${ serverUri } ${ extraUri } ` ;
28
20
29
- //console.log('serverUri: ' + serverUri);
30
- //console.log('extraPath: ' + extraPath);
31
- //console.log('extraUri: ' + extraUri);
32
- //console.log('totalUri: ' + totalUri);
33
-
34
21
// Start server
35
22
// See: https://github.com/indexzero/http-server/
36
23
/*const httpChild =*/ childProcess . spawn (
0 commit comments