File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1- import { existsSync , rmSync } from 'node:fs' ;
1+ import { existsSync , readFileSync , rmSync } from 'node:fs' ;
2+ import path from 'node:path' ;
23import { Command } from 'commander' ;
34import { getProfilePath , setup } from './browser' ;
45import { getConfigPath } from './configFile' ;
56import { log , setVerbose } from './logger' ;
67import { sync } from './sync' ;
78
9+ // Read version from package.json
10+ const packageJsonPath = path . join ( import . meta. dirname , '..' , 'package.json' ) ;
11+ const packageJson : unknown = JSON . parse ( readFileSync ( packageJsonPath , 'utf8' ) ) ;
12+ const version =
13+ packageJson && typeof packageJson === 'object' && 'version' in packageJson
14+ ? String ( packageJson . version )
15+ : '0.0.0' ;
16+
817const program = new Command ( ) ;
918
1019program
1120 . name ( 'heroshot' )
1221 . description ( 'Define your screenshots once, update them forever with one command' )
13- . version ( '0.0.2-alpha.2' )
22+ . version ( version )
1423 . option ( '-v, --verbose' , 'Show detailed output' )
1524 . hook ( 'preAction' , ( ) => {
1625 const options = program . opts < { verbose ?: boolean } > ( ) ;
You can’t perform that action at this time.
0 commit comments