Files
test-repo/scripts/release/steps/update-version.js
T
fisker CheungandSosuke Suzuki 916693c066 Update release script (#9418)
* Update release dependencies

* Remove `version` field

* Run install before any require

* Update scripts/release/utils.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

* Fix update schedule

* Update deps

* Fix

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-04-21 17:15:12 +03:00

40 lines
1.0 KiB
JavaScript

"use strict";
const {
runYarn,
logPromise,
readJson,
writeJson,
processFile,
} = require("../utils");
async function bump({ version }) {
const pkg = await readJson("package.json");
pkg.version = version;
await writeJson("package.json", pkg, { spaces: 2 });
// 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) =>
content.replace(/^(- Prettier Version: ).*?$/m, `$1${version}`)
);
processFile("docs/install.md", (content) =>
content.replace(/^(npx prettier@)\S+/m, `$1${version}`)
);
// Update unpkg link in docs
processFile("docs/browser.md", (content) =>
content.replace(/(\/\/unpkg\.com\/prettier@).*?\//g, `$1${version}/`)
);
await runYarn(["update-stable-docs"], {
cwd: "./website",
});
}
module.exports = async function (params) {
await logPromise("Bumping version", bump(params));
};