Skip to content

Commit 074c93a

Browse files
committed
build: try fixing release script
1 parent f877a5c commit 074c93a

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

.changeset/pre.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"react-md": "6.0.1",
1313
"sassdoc-generator": "0.0.3"
1414
},
15-
"changesets": []
15+
"changesets": ["quick-dancers-show"]
1616
}

packages/codemod/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @react-md/codemod
22

3+
## 6.0.1-next.0
4+
5+
### Patch Changes
6+
7+
- f877a5c: Add the bin field back to support npx
8+
39
## 6.0.0
410

511
### Major Changes

packages/codemod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-md/codemod",
3-
"version": "6.0.0",
3+
"version": "6.0.1-next.0",
44
"description": "ReactMD codemod scripts",
55
"type": "module",
66
"bin": {

scripts/release.ts

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import input from "@inquirer/input";
33
import rawlist from "@inquirer/rawlist";
44
import { Octokit } from "@octokit/core";
55
import dotenv from "dotenv";
6-
import { execSync } from "node:child_process";
6+
import { ExecSyncOptions, execSync } from "node:child_process";
77
import { readFile, readdir } from "node:fs/promises";
88
import { join } from "node:path";
99

@@ -13,20 +13,33 @@ const isSkipBuild = isContinue1 || process.argv.includes("--skip-build");
1313
const 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

2121
interface 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+
2841
async 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

125138
if (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" });
137143
if (!(await confirm({ message: "Continue the release?" }))) {
138144
process.exit(1);
139145
}
@@ -143,17 +149,20 @@ exec("git add .changeset");
143149

144150
const changeset = await getCurrentChangeset();
145151
const 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

147158
exec('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" });
152160
await confirm({ message: "Have the packages been published?" });
153161
exec("git push --follow-tags");
154162

155163
await createRelease({
156164
body: changeset,
165+
tagPrefix: await getTagPrefix(),
157166
version,
158167
prerelease: isPreRelease || version.includes("-next"),
159168
});

0 commit comments

Comments
 (0)