Files
test-repo/scripts/release/steps/update-version.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-10-14 17:17:47 +08:00
import { runYarn, readJson, writeJson, processFile } from "../utils.js";
2018-06-05 16:37:52 -03:00
2023-12-17 22:51:37 +09:00
export default async function updateVersion({ version, next }) {
2018-06-05 16:37:52 -03:00
const pkg = await readJson("package.json");
pkg.version = version;
2022-01-17 09:19:50 +08:00
await writeJson("package.json", pkg);
2018-06-05 16:37:52 -03:00
2023-12-17 22:51:37 +09:00
// For pre-release, just update package.json
if (next) {
return;
}
// Update github issue templates
processFile(".github/ISSUE_TEMPLATE/formatting.md", (content) =>
content.replace(/^(\*\*Prettier ).*?(\*\*)$/m, `$1${version}$2`),
);
processFile(".github/ISSUE_TEMPLATE/integration.md", (content) =>
2021-12-07 14:15:03 +08:00
content.replace(/^(- Prettier Version: ).*$/m, `$1${version}`),
2018-06-05 16:37:52 -03:00
);
2020-03-23 14:39:06 +02:00
processFile("docs/install.md", (content) =>
content.replace(/^(npx prettier@)\S+/m, `$1${version}`),
);
2019-11-09 00:33:28 +08:00
// Update unpkg link in docs
processFile("docs/browser.md", (content) =>
content.replaceAll(
2022-09-17 20:32:03 +08:00
/(\/\/unpkg\.com\/(?:browse\/)?prettier@).*?\//g,
`$1${version}/`,
),
2019-11-09 00:33:28 +08:00
);
2023-07-07 15:44:39 +09:00
await runYarn(["install"], { cwd: "./website" });
2021-04-21 22:15:12 +08:00
await runYarn(["update-stable-docs"], {
cwd: "./website",
});
2018-06-05 16:37:52 -03:00
}