11'use strict' ;
22
3- const RSVP = require ( 'rsvp' ) ;
4- const getPort = RSVP . denodeify ( require ( 'portfinder' ) . getPort ) ;
5- const ServerTask = require ( '../tasks/fastboot-server' ) ;
63const SilentError = require ( 'silent-error' ) ;
7- const VersionChecker = require ( 'ember-cli-version-checker' ) ;
8-
9- const blockForever = ( ) => ( new RSVP . Promise ( ( ) => { } ) ) ;
104
115module . exports = function ( addon ) {
126 return {
@@ -24,69 +18,8 @@ module.exports = function(addon) {
2418 { name : 'assets-path' , type : String , default : 'dist' }
2519 ] ,
2620
27- blockForever,
28- getPort,
29- ServerTask,
30-
3121 run ( options ) {
32- const printDeprecations = ( ) => this . printDeprecations ( options ) ;
33- const runBuild = ( ) => this . runBuild ( options ) ;
34- const runServer = ( ) => this . runServer ( options ) ;
35- const startServer = ( serverTask ) => this . startServer ( serverTask , options ) ;
36- const blockForever = this . blockForever ;
37-
38- return this . checkPort ( options )
39- . then ( printDeprecations )
40- . then ( runServer ) // starts on postBuild SIGHUP
41- . then ( options . build ? runBuild : startServer )
42- . then ( blockForever ) ;
43- } ,
44-
45- runServer ( options ) {
46- const ServerTask = this . ServerTask ;
47- const serverTask = new ServerTask ( {
48- ui : this . ui ,
49- addon : addon
50- } ) ;
51- serverTask . run ( options ) ;
52- return serverTask ;
53- } ,
54-
55- startServer ( serverTask , options ) {
56- serverTask . start ( options ) ;
22+ throw new SilentError ( 'the command: `ember fastboot` has been removed, ember serve now supports fastboot.' ) ;
5723 } ,
58-
59- runBuild ( options ) {
60- const BuildTask = options . watch ? this . tasks . BuildWatch : this . tasks . Build ;
61- const buildTask = new BuildTask ( {
62- ui : this . ui ,
63- analytics : this . analytics ,
64- project : this . project ,
65- } ) ;
66- buildTask . run ( options ) ; // no return, BuildWatch.run blocks forever
67- } ,
68-
69- checkPort ( options ) {
70- return this . getPort ( { port : options . port , host : options . host } )
71- . then ( ( foundPort ) => {
72- if ( options . port !== foundPort && options . port !== 0 ) {
73- const message = `Port ${ options . port } is already in use.` ;
74- return Promise . reject ( new SilentError ( message ) ) ;
75- }
76- options . port = foundPort ;
77- } ) ;
78- } ,
79-
80- printDeprecations ( options ) {
81- var checker = new VersionChecker ( this ) ;
82- var dep = checker . for ( 'ember-cli' , 'npm' ) ;
83-
84- if ( dep . gte ( '2.12.0-beta.1' ) ) {
85- this . ui . writeDeprecateLine ( '`ember fastboot --serve-assets` is deprecated. Please use `ember serve` to serve your fastboot assets.' ) ;
86- } else {
87- this . ui . writeWarnLine ( '`ember fastboot` will no longer work after FastBoot 1.0 is released.' ) ;
88- }
89- } ,
90-
9124 }
9225} ;
0 commit comments