diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index e61cea10..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,46 +0,0 @@ - - -**Prettier 1.13.5** -[Playground link](https://prettier.io/playground/#.....) -```sh -# Options (if any): ---single-quote -``` - -**Input:** -```jsx -// code snippet -``` - -**Output:** -```jsx -// code snippet -``` - -**Expected behavior:** diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md new file mode 100644 index 00000000..b9b787f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -0,0 +1,46 @@ +--- +name: ✨ Formatting +about: Issues for ugly or incorrect code +--- + + + +**Prettier 1.13.5** +[Playground link](https://prettier.io/playground/#.....) +```sh +# Options (if any): +--single-quote +``` + +**Input:** +```jsx +// code snippet +``` + +**Output:** +```jsx +// code snippet +``` + +**Expected behavior:** diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md new file mode 100644 index 00000000..50686944 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -0,0 +1,32 @@ +--- +name: ⚙ Integration +about: Issues for API, CLI, etc. +--- + + + +**Environments:** +- Prettier Version: 1.13.5 +- Running Prettier via: +- Runtime: +- Operating System: + +**Steps to reproduce:** + + +**Expected behavior:** + +**Actual behavior:** diff --git a/scripts/release/steps/update-version.js b/scripts/release/steps/update-version.js index 4777908d..733ebb77 100644 --- a/scripts/release/steps/update-version.js +++ b/scripts/release/steps/update-version.js @@ -1,20 +1,19 @@ "use strict"; const execa = require("execa"); -const { readFileSync, writeFileSync } = require("fs"); -const { logPromise, readJson, writeJson } = require("../utils"); +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_TEMPLATE.MD - const issueFile = ".github/ISSUE_TEMPLATE.md"; - const issueTempl = readFileSync(issueFile, "utf-8"); - writeFileSync( - issueFile, - issueTempl.replace(/^\*\*Prettier .*?\*\*$/m, `**Prettier ${version}**`) + // 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}`) ); } diff --git a/scripts/release/utils.js b/scripts/release/utils.js index 5b09eea7..55a7d940 100644 --- a/scripts/release/utils.js +++ b/scripts/release/utils.js @@ -70,9 +70,15 @@ function writeJson(filename, content) { fs.writeFileSync(filename, JSON.stringify(content, null, 2) + "\n"); } +function processFile(filename, fn) { + const content = fs.readFileSync(filename, "utf-8"); + fs.writeFileSync(filename, fn(content)); +} + module.exports = { runYarn, logPromise, + processFile, readJson, writeJson, waitForEnter