1
1
import * as denodeify from 'denodeify' ;
2
2
import { BuildOptions } from '../models/build-options' ;
3
- import { BaseBuildCommandOptions } from './build' ;
3
+ import { baseBuildCommandOptions } from './build' ;
4
4
import { CliConfig } from '../models/config' ;
5
5
import { Version } from '../upgrade/version' ;
6
6
import { ServeTaskOptions } from './serve' ;
@@ -32,21 +32,35 @@ export interface ServeTaskOptions extends BuildOptions {
32
32
hmr ?: boolean ;
33
33
}
34
34
35
+ // Expose options unrelated to live-reload to other commands that need to run serve
36
+ export const baseServeCommandOptions : any = baseBuildCommandOptions . concat ( [
37
+ { name : 'port' , type : Number , default : defaultPort , aliases : [ 'p' ] } ,
38
+ {
39
+ name : 'host' ,
40
+ type : String ,
41
+ default : defaultHost ,
42
+ aliases : [ 'H' ] ,
43
+ description : `Listens only on ${ defaultHost } by default`
44
+ } ,
45
+ { name : 'proxy-config' , type : 'Path' , aliases : [ 'pc' ] } ,
46
+ { name : 'ssl' , type : Boolean , default : false } ,
47
+ { name : 'ssl-key' , type : String , default : 'ssl/server.key' } ,
48
+ { name : 'ssl-cert' , type : String , default : 'ssl/server.crt' } ,
49
+ {
50
+ name : 'open' ,
51
+ type : Boolean ,
52
+ default : false ,
53
+ aliases : [ 'o' ] ,
54
+ description : 'Opens the url in default browser' ,
55
+ }
56
+ ] ) ;
57
+
35
58
const ServeCommand = Command . extend ( {
36
59
name : 'serve' ,
37
60
description : 'Builds and serves your app, rebuilding on file changes.' ,
38
61
aliases : [ 'server' , 's' ] ,
39
62
40
- availableOptions : BaseBuildCommandOptions . concat ( [
41
- { name : 'port' , type : Number , default : defaultPort , aliases : [ 'p' ] } ,
42
- {
43
- name : 'host' ,
44
- type : String ,
45
- default : defaultHost ,
46
- aliases : [ 'H' ] ,
47
- description : `Listens only on ${ defaultHost } by default`
48
- } ,
49
- { name : 'proxy-config' , type : 'Path' , aliases : [ 'pc' ] } ,
63
+ availableOptions : baseServeCommandOptions . concat ( [
50
64
{ name : 'live-reload' , type : Boolean , default : true , aliases : [ 'lr' ] } ,
51
65
{
52
66
name : 'live-reload-host' ,
@@ -72,16 +86,6 @@ const ServeCommand = Command.extend({
72
86
default : true ,
73
87
description : 'Whether to live reload CSS (default true)'
74
88
} ,
75
- { name : 'ssl' , type : Boolean , default : false } ,
76
- { name : 'ssl-key' , type : String , default : 'ssl/server.key' } ,
77
- { name : 'ssl-cert' , type : String , default : 'ssl/server.crt' } ,
78
- {
79
- name : 'open' ,
80
- type : Boolean ,
81
- default : false ,
82
- aliases : [ 'o' ] ,
83
- description : 'Opens the url in default browser' ,
84
- } ,
85
89
{
86
90
name : 'hmr' ,
87
91
type : Boolean ,
0 commit comments