@@ -5,11 +5,13 @@ const program = new Command();
55const { storybook } = require ( './commands/storybook' ) ;
66const { validateProjectToken, validateLatestBuild } = require ( './commands/utils/validate' ) ;
77const { createConfig } = require ( './commands/config' ) ;
8+ const { version } = require ( './package.json' ) ;
9+ const { checkUpdate } = require ( './commands/utils/package' ) ;
810
911program
1012 . name ( 'smartui' )
1113 . description ( 'CLI to help you run your SmartUI tests on LambdaTest platform' )
12- . version ( '1.1.2' )
14+ . version ( 'v' + version )
1315 . addOption ( new Option ( '--env <prod|stage>' , 'Runtime environment option' ) . choices ( [ 'prod' , 'stage' ] ) ) ;
1416
1517const configCommand = program . command ( 'config' )
@@ -18,7 +20,12 @@ const configCommand = program.command('config')
1820configCommand . command ( 'create' )
1921 . description ( 'Create LambdaTest SmartUI config file' )
2022 . argument ( '[filepath]' , 'Optional config filepath' )
21- . action ( function ( filepath ) {
23+ . action ( async function ( filepath , options ) {
24+ options . env = program . opts ( ) . env || 'prod' ;
25+ console . log ( 'SmartUI Storybook CLI v' + version ) ;
26+ await checkUpdate ( version , options ) ;
27+ console . log ( '\n' ) ;
28+
2229 createConfig ( filepath ) ;
2330 } ) ;
2431
@@ -29,6 +36,10 @@ program.command('storybook')
2936 // .option('--force-rebuild', 'Force a rebuild of an already existing build.', false)
3037 . action ( async function ( serve , options ) {
3138 options . env = program . opts ( ) . env || 'prod' ;
39+ console . log ( 'SmartUI Storybook CLI v' + version ) ;
40+ await checkUpdate ( version , options ) ;
41+ console . log ( '\n' ) ;
42+
3243 await validateProjectToken ( options ) ;
3344 // if (!options.forceRebuild) await validateLatestBuild(options);
3445 storybook ( serve , options ) ;
0 commit comments