forked from prettier/prettier
/
update-version.js
31 lines (25 loc) · 937 Bytes
/
update-version.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use strict";
const execa = require("execa");
const { 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}`)
);
// Update unpkg link in docs
processFile("docs/browser.md", content =>
content.replace(/(\/\/unpkg\.com\/prettier@)(?:.*?)\//g, `$1${version}/`)
);
await execa("yarn", ["update-stable-docs"], {
cwd: "./website"
});
}
module.exports = async function(params) {
await logPromise("Bumping version", bump(params));
};