File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 "typecheck" : " tsc --noEmit" ,
3030 "test" : " vitest run" ,
3131 "bump" : " node scripts/bump-version.cjs" ,
32- "version" : " node scripts/bump-version.cjs"
32+ "version" : " node scripts/bump-version.cjs" ,
33+ "postversion" : " node scripts/postversion.cjs"
3334 },
3435 "dependencies" : {
3536 "@radix-ui/react-dropdown-menu" : " ^2.1.16" ,
Original file line number Diff line number Diff line change 1+ const { execSync } = require ( 'child_process' ) ;
2+ const path = require ( 'path' ) ;
3+ const pkg = require ( path . join ( __dirname , '../package.json' ) ) ;
4+ const version = pkg . version ;
5+
6+ const wrongTag = `v${ version } ` ;
7+ const correctTag = `app-v${ version } ` ;
8+
9+ try {
10+ // Check if wrong tag exists
11+ const tags = execSync ( `git tag -l ${ wrongTag } ` ) . toString ( ) . trim ( ) ;
12+ if ( tags === wrongTag ) {
13+ console . log ( `Found incorrect tag ${ wrongTag } , fixing it to ${ correctTag } ...` ) ;
14+ // Delete wrong tag
15+ execSync ( `git tag -d ${ wrongTag } ` ) ;
16+ // Create correct tag
17+ execSync ( `git tag -a ${ correctTag } -m "${ correctTag } "` ) ;
18+ console . log ( `Successfully replaced ${ wrongTag } with ${ correctTag } ` ) ;
19+ } else {
20+ // Check if correct tag exists
21+ const correctTags = execSync ( `git tag -l ${ correctTag } ` ) . toString ( ) . trim ( ) ;
22+ if ( correctTags !== correctTag ) {
23+ execSync ( `git tag -a ${ correctTag } -m "${ correctTag } "` ) ;
24+ console . log ( `Created missing tag ${ correctTag } ` ) ;
25+ } else {
26+ console . log ( `Tag ${ correctTag } already exists and is correct.` ) ;
27+ }
28+ }
29+ } catch ( e ) {
30+ console . error ( 'Error in postversion script:' , e . message ) ;
31+ }
You can’t perform that action at this time.
0 commit comments