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
1011 B
JavaScript
Raw Normal View History

2021-07-26 09:24:44 +08:00
import {
2021-04-21 22:15:12 +08:00
runYarn,
logPromise,
readJson,
writeJson,
processFile,
2021-07-26 09:24:44 +08:00
} from "../utils.js";
2018-06-05 16:37:52 -03:00
async function bump({ version }) {
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
// 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) =>
2020-04-10 21:20:40 +08:00
content.replace(/(\/\/unpkg\.com\/prettier@).*?\//g, `$1${version}/`)
2019-11-09 00:33:28 +08:00
);
2021-04-21 22:15:12 +08:00
await runYarn(["update-stable-docs"], {
cwd: "./website",
});
2018-06-05 16:37:52 -03:00
}
export default async function updateVersion(params) {
2018-06-05 16:37:52 -03:00
await logPromise("Bumping version", bump(params));
2021-07-26 09:24:44 +08:00
}