File tree Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ const defaults = {
29
29
} ;
30
30
31
31
export default {
32
- // Development (watch files and auto inject/reload on change )
32
+ // Development (preview, local URLs, watch enabled )
33
33
dev : {
34
34
...defaults ,
35
35
files : [ 'CHANGELOG.md' , 'docs/**/*' , 'lib/**/*' ] ,
36
36
port : 3000 ,
37
37
open : true ,
38
38
snippet : true ,
39
39
} ,
40
- // Production (watch disabled)
40
+ // Production (index, CDN URLs, watch disabled)
41
41
prod : {
42
42
...defaults ,
43
43
port : 8080 ,
@@ -46,7 +46,7 @@ export default {
46
46
index : 'index.html' ,
47
47
} ,
48
48
} ,
49
- // Test: (watch disabled, blank page route, unique port )
49
+ // Test (preview, local URLs, watch disabled )
50
50
test : {
51
51
...defaults ,
52
52
middleware : [
Original file line number Diff line number Diff line change 1
1
import { create } from 'browser-sync' ;
2
- import config from './server.config.js' ;
2
+ import serverConfigs from './server.config.js' ;
3
3
4
4
const bsServer = create ( ) ;
5
- const isDev = process . argv . includes ( '--dev' ) ;
6
- const settings = config [ isDev ? 'dev' : 'prod' ] ;
5
+ const args = process . argv . slice ( 2 ) ;
6
+ const configName =
7
+ Object . keys ( serverConfigs ) . find ( name => args . includes ( `--${ name } ` ) ) || 'prod' ;
8
+ const settings = serverConfigs [ configName ] ;
7
9
8
- console . log (
9
- [
10
- '\n' ,
11
- 'Starting' ,
12
- isDev ? 'development' : 'standard' ,
13
- 'server' ,
14
- `(watch: ${ isDev } )` ,
15
- '\n' ,
16
- ] . join ( ' ' )
17
- ) ;
10
+ // prettier-ignore
11
+ console . log ( `\nStarting ${ configName } server (${ settings . server . index } , watch: ${ Boolean ( settings . files ) } )\n` ) ;
18
12
19
13
bsServer . init ( settings ) ;
You can’t perform that action at this time.
0 commit comments