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 11const { writeFileSync } = require ( 'fs' ) ;
22const { promisify } = require ( 'util' ) ;
33const child = require ( 'child_process' ) ;
4+ const { version } = require ( 'os' ) ;
45const exec = promisify ( child . exec ) ;
56
67async function createVersionsFile ( filename ) {
78 const revision = process . argv [ 2 ]
89 ?? ( await exec ( 'git rev-parse --short HEAD' ) ) . stdout . toString ( ) . trim ( ) ;
910 const branch = process . argv [ 3 ]
1011 ?? ( await exec ( 'git rev-parse --abbrev-ref HEAD' ) ) . stdout . toString ( ) . trim ( ) ;
11- let version = ( await exec ( 'git tag --points-at HEAD' ) ) . stdout . toString ( ) . trim ( )
12- ?? process . env . npm_package_version ;
12+
13+ let version = ''
14+ try {
15+ const { stdout} = ( await exec ( 'git describe --tags --abbrev=0' ) )
16+ version = stdout . trim ( )
17+ }
18+ catch {
19+ version = process . env . npm_package_version
20+ }
21+
1322 if ( version == '' ) {
1423 version = 'Latest' ;
1524 }
You can’t perform that action at this time.
0 commit comments