File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 2121 },
2222 "devDependencies" : {
2323 "@biomejs/biome" : " ^2.3.7" ,
24- "@types/node" : " ^24.10.1"
24+ "@types/node" : " ^24.10.1" ,
25+ "open" : " ^11.0.0"
2526 },
2627 "peerDependencies" : {
2728 "typescript" : " ^5.9.3"
Original file line number Diff line number Diff line change 1+ import { readFileSync } from "node:fs" ;
2+ import { resolve } from "node:path" ;
3+ import { URLSearchParams } from "node:url" ;
4+ import open from "open" ;
5+
6+ function getPackageInfo ( cwd : string ) {
7+ const pkgPath = resolve ( cwd , "package.json" ) ;
8+ const pkgRaw = readFileSync ( pkgPath , "utf-8" ) ;
9+ return JSON . parse ( pkgRaw ) ;
10+ }
11+
12+ async function main ( ) {
13+ const cwd = process . cwd ( ) ;
14+ const pkg = getPackageInfo ( cwd ) ;
15+
16+ const version = pkg . version ;
17+ const repoUrl = pkg . repository ?. url ;
18+
19+ if ( ! repoUrl || ! repoUrl . startsWith ( "https://github.com/" ) ) {
20+ console . error ( "❌ Missing or invalid repository.url in package.json" ) ;
21+ process . exit ( 1 ) ;
22+ }
23+
24+ const params = new URLSearchParams ( {
25+ tag : `v${ version } ` ,
26+ title : `v${ version } ` ,
27+ } ) ;
28+
29+ const newReleaseUrl = `${ repoUrl . replace ( / \. g i t $ / , "" ) } /releases/new?${ params . toString ( ) } ` ;
30+
31+ console . log ( `🔗 Opening: ${ newReleaseUrl } ` ) ;
32+ await open ( newReleaseUrl ) ;
33+ }
34+
35+ main ( ) . catch ( ( err ) => {
36+ console . error ( err ) ;
37+ process . exit ( 1 ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments