@@ -3,7 +3,7 @@ import input from "@inquirer/input";
33import rawlist from "@inquirer/rawlist" ;
44import { Octokit } from "@octokit/core" ;
55import dotenv from "dotenv" ;
6- import { execSync } from "node:child_process" ;
6+ import { ExecSyncOptions , execSync } from "node:child_process" ;
77import { readFile , readdir } from "node:fs/promises" ;
88import { join } from "node:path" ;
99
@@ -13,20 +13,33 @@ const isSkipBuild = isContinue1 || process.argv.includes("--skip-build");
1313const isSkipCoreGenerate =
1414 isContinue1 || process . argv . includes ( "--skip-generate" ) ;
1515
16- const exec = ( command : string ) : void => {
16+ const exec = ( command : string , opts ?: ExecSyncOptions ) : void => {
1717 console . log ( command ) ;
18- execSync ( command ) ;
18+ execSync ( command , opts ) ;
1919} ;
2020
2121interface CreateReleaseOptions {
2222 body : string ;
2323 version : string ;
2424 override ?: boolean ;
25+ tagPrefix : string ;
2526 prerelease : boolean ;
2627}
2728
29+ async function getTagPrefix ( ) : Promise < string > {
30+ if (
31+ ! ( await confirm ( { message : "Use @react-md/core as the next tag name?" } ) )
32+ ) {
33+ return await input ( {
34+ message : "Enter the next tag name prefix" ,
35+ } ) ;
36+ }
37+
38+ return "@reactg-md/core" ;
39+ }
40+
2841async function createRelease ( options : CreateReleaseOptions ) : Promise < void > {
29- const { version, body, override, prerelease } = options ;
42+ const { version, body, tagPrefix , override, prerelease } = options ;
3043
3144 dotenv . config ( { path : ".env.local" , override } ) ;
3245 const octokit = new Octokit ( { auth : process . env . GITHUB_TOKEN } ) ;
@@ -36,7 +49,7 @@ async function createRelease(options: CreateReleaseOptions): Promise<void> {
3649 {
3750 owner : "mlaursen" ,
3851 repo : "react-md" ,
39- tag_name : `@react-md/core @${ version } ` ,
52+ tag_name : `${ tagPrefix } @${ version } ` ,
4053 body,
4154 prerelease,
4255 }
@@ -114,26 +127,19 @@ if (!isSkipBuild) {
114127 exec ( "pnpm clean-dist" ) ;
115128
116129 if ( ! isSkipCoreGenerate ) {
117- exec ( "pnpm core-export-map" ) ;
118- exec ( "pnpm core-index-file" ) ;
130+ // exec("pnpm core-export-map");
131+ // exec("pnpm core-index-file");
119132 exec ( "git add -u" ) ;
120133 }
121134
122- exec ( " pnpm build- packages" ) ;
135+ exec ( ' pnpm build --filter="./ packages/*"' ) ;
123136}
124137
125138if ( isPreRelease ) {
126139 exec ( "pnpm changeset pre enter next" ) ;
127140}
128141
129- if ( ! isContinue1 ) {
130- console . log ( `Run the following commands in another terminal since I don't know how to get it to work in this script.
131-
132- pnpm changeset
133- pnpm changeset version
134- ` ) ;
135- }
136-
142+ exec ( "pnpm changeset" , { stdio : "inherit" } ) ;
137143if ( ! ( await confirm ( { message : "Continue the release?" } ) ) ) {
138144 process . exit ( 1 ) ;
139145}
@@ -143,17 +149,20 @@ exec("git add .changeset");
143149
144150const changeset = await getCurrentChangeset ( ) ;
145151const version = await getReleaseVersion ( ) ;
152+ exec ( "pnpm changeset version" , { stdio : "inherit" } ) ;
153+ exec ( "git add -u" ) ;
154+ if ( ! ( await confirm ( { message : "Continue the release?" } ) ) ) {
155+ process . exit ( 1 ) ;
156+ }
146157
147158exec ( 'git commit -m "build(version): version packages"' ) ;
148- console . log ( `Run the following command in another terminal since I don't know how to get it to work in this script.
149-
150- pnpm changeset publish
151- ` ) ;
159+ exec ( "pnpm changeset publish" , { stdio : "inherit" } ) ;
152160await confirm ( { message : "Have the packages been published?" } ) ;
153161exec ( "git push --follow-tags" ) ;
154162
155163await createRelease ( {
156164 body : changeset ,
165+ tagPrefix : await getTagPrefix ( ) ,
157166 version,
158167 prerelease : isPreRelease || version . includes ( "-next" ) ,
159168} ) ;
0 commit comments