File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
packages/@angular/cli/tasks Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,13 @@ export default Task.extend({
6060
6161 let clientAddress = serverAddress ;
6262 if ( serveTaskOptions . publicHost ) {
63- const clientUrl = url . parse ( serveTaskOptions . publicHost ) ;
64- // very basic sanity check
65- if ( ! clientUrl . host ) {
66- return Promise . reject ( new SilentError ( `'live-reload-client' must be a full URL.` ) ) ;
63+ let publicHost = serveTaskOptions . publicHost ;
64+ if ( ! / ^ \w + : \/ \/ / . test ( publicHost ) ) {
65+ publicHost = `${ serveTaskOptions . ssl ? 'https' : 'http' } ://${ publicHost } ` ;
6766 }
68- clientAddress = clientUrl . href ;
67+ const clientUrl = url . parse ( publicHost ) ;
68+ serveTaskOptions . publicHost = clientUrl . host ;
69+ clientAddress = url . format ( clientUrl ) ;
6970 }
7071
7172 if ( serveTaskOptions . liveReload ) {
Original file line number Diff line number Diff line change @@ -39,5 +39,21 @@ export default function () {
3939 throw new Error ( 'Response does not match expected value.' ) ;
4040 }
4141 } )
42+ . then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } )
43+ . then ( ( ) => ngServe ( '--host=0.0.0.0' , `--public-host=${ localAddress } ` ) )
44+ . then ( ( ) => request ( localAddress ) )
45+ . then ( body => {
46+ if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
47+ throw new Error ( 'Response does not match expected value.' ) ;
48+ }
49+ } )
50+ . then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } )
51+ . then ( ( ) => ngServe ( '--host=0.0.0.0' , `--public-host=${ firstLocalIp } ` ) )
52+ . then ( ( ) => request ( localAddress ) )
53+ . then ( body => {
54+ if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
55+ throw new Error ( 'Response does not match expected value.' ) ;
56+ }
57+ } )
4258 . then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } ) ;
4359}
You can’t perform that action at this time.
0 commit comments