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

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-06-05 16:37:52 -03:00
"use strict";
const execa = require("execa");
const { logPromise, readJson, writeJson, processFile } = require("../utils");
2018-06-05 16:37:52 -03:00
async function bump({ version }) {
const pkg = await readJson("package.json");
pkg.version = version;
await writeJson("package.json", pkg, { spaces: 2 });
// Update github issue templates
2020-03-21 22:07:52 +02:00
processFile(".github/ISSUE_TEMPLATE/formatting.md", (content) =>
content.replace(/^(\*\*Prettier ).*?(\*\*)$/m, `$1${version}$2`)
);
2020-03-21 22:07:52 +02:00
processFile(".github/ISSUE_TEMPLATE/integration.md", (content) =>
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
2020-03-21 22:07:52 +02:00
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
);
await execa("yarn", ["update-stable-docs"], {
2020-03-21 22:07:52 +02:00
cwd: "./website",
});
2018-06-05 16:37:52 -03:00
}
2020-03-21 22:07:52 +02:00
module.exports = async function (params) {
2018-06-05 16:37:52 -03:00
await logPromise("Bumping version", bump(params));
};