11const PortFinder = require ( 'portfinder' ) ;
22const Command = require ( '../ember-cli/lib/models/command' ) ;
3+ import { CliConfig } from '../models/config' ;
34
4- PortFinder . basePort = 49152 ;
5+ const config = CliConfig . fromProject ( ) ;
56
6- const defaultPort = process . env . PORT || 4200 ;
7+ const defaultLiveReloadPort = config . get ( 'defaults.serve.liveReloadPort' ) ;
8+ const defaultPort = process . env . PORT || config . get ( 'defaults.serve.port' ) ;
9+ const defaultHost = config . get ( 'defaults.serve.host' ) ;
10+
11+ PortFinder . basePort = defaultLiveReloadPort ;
712
813export interface ServeTaskOptions {
914 port ?: number ;
@@ -42,9 +47,9 @@ const ServeCommand = Command.extend({
4247 {
4348 name : 'host' ,
4449 type : String ,
45- default : 'localhost' ,
50+ default : defaultHost ,
4651 aliases : [ 'H' ] ,
47- description : ' Listens only on localhost by default'
52+ description : ` Listens only on ${ defaultHost } by default`
4853 } ,
4954 { name : 'proxy-config' , type : 'Path' , aliases : [ 'pc' ] } ,
5055 { name : 'watcher' , type : String , default : 'events' , aliases : [ 'w' ] } ,
@@ -65,7 +70,7 @@ const ServeCommand = Command.extend({
6570 name : 'live-reload-port' ,
6671 type : Number ,
6772 aliases : [ 'lrp' ] ,
68- description : '(Defaults to port number within [49152 ...65535])'
73+ description : `Finds the first open port number within [${ defaultLiveReloadPort } ...65535]`
6974 } ,
7075 {
7176 name : 'live-reload-live-css' ,
@@ -103,7 +108,7 @@ const ServeCommand = Command.extend({
103108 } ,
104109 { name : 'i18n-file' , type : String , default : null } ,
105110 { name : 'i18n-format' , type : String , default : null } ,
106- { name : 'locale' , type : String , default : null }
111+ { name : 'locale' , type : String , default : null }
107112 ] ,
108113
109114 run : function ( commandOptions : ServeTaskOptions ) {
0 commit comments