Skip to content

Commit 2419e13

Browse files
committed
fix scripts
1 parent 555899f commit 2419e13

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
"Compatibility",
9999
"Frontend development",
100100
"UI components",
101-
"Web development",
102101
"Progressive",
102+
"Web development",
103103
"Modern",
104104
"Seamless integration",
105105
"mayank1513"

scripts/manual-publish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import fs from "fs";
1212
import path from "path";
1313
import { fileURLToPath } from "url";
1414
import updateSecurityMd from "./update-security-md";
15+
import { version as OLD_VERSION, name } from "../lib/package.json";
1516

1617
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1718

@@ -21,7 +22,6 @@ const DEFAULT_BRANCH = process.env.DEFAULT_BRANCH!;
2122
const isLatestRelease = BRANCH === DEFAULT_BRANCH || BRANCH.includes("release-");
2223
let tag = "";
2324

24-
const { version: OLD_VERSION, name } = require("../lib/package.json");
2525
if (!isLatestRelease) {
2626
/** pre-release branch name should be the tag name (e.g., beta, canery, etc.) or tag name followed by a '-' and version or other specifiers. e.g. beta-2.0 */
2727
tag = BRANCH.split("-")[0];

scripts/publish.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** It is assumed that this is called only from the default branch. */
22
import { execSync } from "child_process";
33
import updateSecurityMd from "./update-security-md";
4+
import { version, name } from "../lib/package.json";
45

56
const BRANCH = process.env.BRANCH!;
67

@@ -19,7 +20,6 @@ try {
1920
// no changesets to be applied
2021
}
2122

22-
const { version: VERSION, name } = require("../lib/package.json");
2323
let LATEST_VERSION = "0.0.-1";
2424

2525
try {
@@ -28,9 +28,9 @@ try {
2828
// empty
2929
}
3030

31-
console.log({ VERSION, LATEST_VERSION });
31+
console.log({ version, LATEST_VERSION });
3232

33-
const [newMajor, newMinor] = VERSION.split(".");
33+
const [newMajor, newMinor] = version.split(".");
3434
const [oldMajor, oldMinor] = LATEST_VERSION.split(".");
3535

3636
const isPatch = newMajor === oldMajor && newMinor === oldMinor;
@@ -62,12 +62,12 @@ execSync(`cd lib && pnpm build && npm publish ${provenance} --access public`);
6262
/** Create GitHub release */
6363
try {
6464
execSync(
65-
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' lib/CHANGELOG.md)" --title "Release v${VERSION}"`,
65+
`gh release create ${version} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' lib/CHANGELOG.md)" --title "Release v${version}"`,
6666
);
6767
} catch {
6868
try {
6969
execSync(
70-
`gh release create ${VERSION} --generate-notes --latest --title "Release v${VERSION}"`,
70+
`gh release create ${version} --generate-notes --latest --title "Release v${version}"`,
7171
);
7272
} catch {
7373
// ignore

scripts/rebrand.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from "path";
44
import { prompt } from "enquirer";
55
import { execSync } from "child_process";
66
import config from "./rebrand.config.json";
7+
import rootPackageJSON from "../package.json";
78

89
const isFirstRebrand = config.repo === "turborepo-template" && config.owner === "react18-tools";
910

@@ -177,10 +178,10 @@ const rebrandFn = async () => {
177178

178179
Object.assign(newConfig, { removedFeatures: feats });
179180

180-
const rootPackageJSON = require("../package.json");
181-
182181
if (feats.includes("Rebrander")) {
182+
// @ts-expect-error -- allow delete
183183
delete rootPackageJSON.scripts.rebrand;
184+
// @ts-expect-error -- allow delete
184185
delete rootPackageJSON.devDependencies.enquirer;
185186
["./scripts/rebrand.ts", "./scripts/rebrander.ts"].forEach(dirOrfile =>
186187
execSync("rm -rf " + dirOrfile),
@@ -200,7 +201,9 @@ const rebrandFn = async () => {
200201
}
201202

202203
if (feats.includes("Docs")) {
204+
// @ts-expect-error -- allow delete
203205
delete rootPackageJSON.scripts.doc;
206+
// @ts-expect-error -- allow delete
204207
delete rootPackageJSON.devDependencies["typedoc"];
205208
Object.keys(rootPackageJSON.devDependencies).forEach(dep => {
206209
if (dep.startsWith("typedoc-plugin-")) {
@@ -222,6 +225,7 @@ const rebrandFn = async () => {
222225
}
223226

224227
if (feats.includes("Generators")) {
228+
// @ts-expect-error -- allow delete
225229
delete rootPackageJSON.devDependencies.plop;
226230
["./scripts/templates", "./scripts/hook.ts", "./scripts/rc.ts", "./plopfile.js"].forEach(
227231
dirOrFile => execSync("rm -rf " + dirOrFile),

0 commit comments

Comments
 (0)