@@ -50,20 +50,26 @@ function logTrace(stats, showCompiling) {
5050 lastTrace = '' ;
5151}
5252
53- function start ( { input, port } ) {
53+ function start ( { input, port, env } ) {
5454 const environment = 'development' ;
5555 const compiler = getCompiler ( { environment, input } ) ;
5656 if ( port ) {
5757 process . env [ 'NULLSTACK_SERVER_PORT' ] = port ;
5858 }
59+ if ( env ) {
60+ process . env [ 'NULLSTACK_ENVIRONMENT_NAME' ] = env ;
61+ }
5962 console . log ( ` 🚀️ Starting your application in ${ environment } mode...` ) ;
6063 console . log ( ) ;
6164 compiler . watch ( { } , ( error , stats ) => logTrace ( stats , true ) ) ;
6265}
6366
64- function build ( { input, output, cache, mode = 'ssr' } ) {
67+ function build ( { input, output, cache, env , mode = 'ssr' } ) {
6568 const environment = 'production' ;
6669 const compiler = getCompiler ( { environment, input, cache } ) ;
70+ if ( env ) {
71+ process . env [ 'NULLSTACK_ENVIRONMENT_NAME' ] = env ;
72+ }
6773 console . log ( ` 🚀️ Building your application in ${ mode } mode...` ) ;
6874 compiler . run ( ( error , stats ) => {
6975 logTrace ( stats , false ) ;
@@ -78,6 +84,7 @@ program
7884 . description ( 'Start application in development environment' )
7985 . option ( '-p, --port <port>' , 'Port number to run the server' )
8086 . option ( '-i, --input <input>' , 'Path to project that will be started' )
87+ . option ( '-e, --env <name>' , 'Name of the environment file that should be loaded' )
8188 . helpOption ( '-h, --help' , 'Learn more about this command' )
8289 . action ( start )
8390
@@ -89,6 +96,7 @@ program
8996 . option ( '-i, --input <input>' , 'Path to project that will be built' )
9097 . option ( '-o, --output <output>' , 'Path to build output folder' )
9198 . option ( '-c, --cache' , 'Cache build results in .production folder' )
99+ . option ( '-e, --env <name>' , 'Name of the environment file that should be loaded' )
92100 . helpOption ( '-h, --help' , 'Learn more about this command' )
93101 . action ( build )
94102
0 commit comments