Replace chalk with node-style-text in release script (#16984)
This commit is contained in:
1 parent
78133d6d72
commit
59a64a3fb6
11 files changed
+55
-53
No files matched your search
@@ -5,15 +5,15 @@
|
|||||||
"test": "node --test"
|
"test": "node --test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "5.3.0",
|
|
||||||
"enquirer": "2.4.1",
|
"enquirer": "2.4.1",
|
||||||
"execa": "9.5.1",
|
"execa": "9.5.1",
|
||||||
"fast-glob": "3.3.3",
|
"fast-glob": "3.3.3",
|
||||||
|
"node-style-text": "0.0.6",
|
||||||
"outdent": "0.8.0",
|
"outdent": "0.8.0",
|
||||||
"semver": "7.6.3"
|
"semver": "7.6.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.6.0"
|
"packageManager": "yarn@4.6.0"
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import { logPromise, readJson, runYarn } from "../utils.js";
|
import { logPromise, readJson, runYarn } from "../utils.js";
|
||||||
|
|
||||||
export default async function generateBundles({ dry, version, manual }) {
|
export default async function generateBundles({ dry, version, manual }) {
|
||||||
@@ -24,5 +24,5 @@ export default async function generateBundles({ dry, version, manual }) {
|
|||||||
/* shouldSkip */ dry,
|
/* shouldSkip */ dry,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(chalk.green.bold("Build successful!\n"));
|
console.log(styleText.green.bold("Build successful!\n"));
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import outdent from "outdent";
|
import outdent from "outdent";
|
||||||
import { fetchText, logPromise, writeFile } from "../utils.js";
|
import { fetchText, logPromise, writeFile } from "../utils.js";
|
||||||
|
|
||||||
@@ -27,11 +27,11 @@ async function checkSchema() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return outdent`
|
return outdent`
|
||||||
${chalk.bold.underline(
|
${styleText.bold.underline(
|
||||||
"The schema in {yellow SchemaStore",
|
"The schema in {yellow SchemaStore",
|
||||||
)} needs an update.}
|
)} needs an update.}
|
||||||
- Open ${chalk.cyan.underline(EDIT_URL)}
|
- Open ${styleText.cyan.underline(EDIT_URL)}
|
||||||
- Open ${chalk.cyan.underline("/.tmp/schema/prettierrc.json")} file and copy the content
|
- Open ${styleText.cyan.underline("/.tmp/schema/prettierrc.json")} file and copy the content
|
||||||
- Paste it on GitHub interface
|
- Paste it on GitHub interface
|
||||||
- Open a PR
|
- Open a PR
|
||||||
`;
|
`;
|
||||||
@@ -39,15 +39,15 @@ async function checkSchema() {
|
|||||||
|
|
||||||
function twitterAnnouncement() {
|
function twitterAnnouncement() {
|
||||||
return outdent`
|
return outdent`
|
||||||
${chalk.bold.underline("Announce on Twitter")}
|
${styleText.bold.underline("Announce on Twitter")}
|
||||||
- Open ${chalk.cyan.underline("https://tweetdeck.twitter.com")}
|
- Open ${styleText.cyan.underline("https://tweetdeck.twitter.com")}
|
||||||
- Make sure you are tweeting from the {yellow @PrettierCode} account.
|
- Make sure you are tweeting from the {yellow @PrettierCode} account.
|
||||||
- Tweet about the release, including the blog post URL.
|
- Tweet about the release, including the blog post URL.
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function postPublishSteps({ dry, next }) {
|
export default async function postPublishSteps({ dry, next }) {
|
||||||
console.log(chalk.bold.green("The script has finished!\n"));
|
console.log(styleText.bold.green("The script has finished!\n"));
|
||||||
|
|
||||||
if (dry || next) {
|
if (dry || next) {
|
||||||
return;
|
return;
|
||||||
@@ -57,7 +57,7 @@ export default async function postPublishSteps({ dry, next }) {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
outdent`
|
outdent`
|
||||||
${chalk.yellow.bold(
|
${styleText.yellow.bold(
|
||||||
`The following ${
|
`The following ${
|
||||||
steps.length === 1 ? "step is" : "steps are"
|
steps.length === 1 ? "step is" : "steps are"
|
||||||
} optional.`,
|
} optional.`,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import outdent from "outdent";
|
import outdent from "outdent";
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
import {
|
import {
|
||||||
@@ -39,7 +39,7 @@ export default async function showInstructionsAfterNpmPublish({
|
|||||||
next,
|
next,
|
||||||
}) {
|
}) {
|
||||||
if (next) {
|
if (next) {
|
||||||
console.log(`${chalk.green.bold(`Prettier ${version} published!`)}`);
|
console.log(`${styleText.green.bold(`Prettier ${version} published!`)}`);
|
||||||
await waitForEnter();
|
await waitForEnter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,13 +47,13 @@ export default async function showInstructionsAfterNpmPublish({
|
|||||||
const releaseUrl = getReleaseUrl(version, previousVersion);
|
const releaseUrl = getReleaseUrl(version, previousVersion);
|
||||||
console.log(
|
console.log(
|
||||||
outdent`
|
outdent`
|
||||||
${chalk.green.bold(`Prettier ${version} published!`)}
|
${styleText.green.bold(`Prettier ${version} published!`)}
|
||||||
|
|
||||||
${chalk.yellow.bold("Some manual steps are necessary.")}
|
${styleText.yellow.bold("Some manual steps are necessary.")}
|
||||||
|
|
||||||
${chalk.bold.underline("Create a GitHub Release")}
|
${styleText.bold.underline("Create a GitHub Release")}
|
||||||
- Go to ${chalk.cyan.underline(releaseUrl)}
|
- Go to ${styleText.cyan.underline(releaseUrl)}
|
||||||
- Press ${chalk.bgGreen.black("Publish release ")}
|
- Press ${styleText.bgGreen.black("Publish release")}
|
||||||
|
|
||||||
After that, we can proceed to bump this repo's Prettier dependency.
|
After that, we can proceed to bump this repo's Prettier dependency.
|
||||||
`,
|
`,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import chalk from "chalk";
|
|
||||||
import { execa } from "execa";
|
import { execa } from "execa";
|
||||||
|
import styleText from "node-style-text";
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
import {
|
import {
|
||||||
getBlogPostInfo,
|
getBlogPostInfo,
|
||||||
@@ -51,9 +51,9 @@ export default async function updateChangelog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.warn(
|
console.warn(
|
||||||
`${chalk.yellow("warning")} The file ${chalk.bold(
|
`${styleText.yellow("warning")} The file ${styleText.bold(
|
||||||
blogPost.file,
|
blogPost.file,
|
||||||
)} doesn't exist, but it will be referenced in ${chalk.bold(
|
)} doesn't exist, but it will be referenced in ${styleText.bold(
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
)}. Make sure to create it later.`,
|
)}. Make sure to create it later.`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import { fetchText, logPromise, processFile, runGit } from "../utils.js";
|
import { fetchText, logPromise, processFile, runGit } from "../utils.js";
|
||||||
|
|
||||||
async function update() {
|
async function update() {
|
||||||
@@ -79,6 +79,6 @@ export default async function updateDependentsCount({ dry, next }) {
|
|||||||
try {
|
try {
|
||||||
await update();
|
await update();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(chalk.red.bold(error.message));
|
console.log(styleText.red.bold(error.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
|
|
||||||
export default function validateNewVersion({ version, previousVersion, next }) {
|
export default function validateNewVersion({ version, previousVersion, next }) {
|
||||||
@@ -8,19 +8,19 @@ export default function validateNewVersion({ version, previousVersion, next }) {
|
|||||||
|
|
||||||
if (!semver.valid(version)) {
|
if (!semver.valid(version)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid version '${chalk.red.underline(version)}' specified`,
|
`Invalid version '${styleText.red.underline(version)}' specified`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!semver.gt(version, previousVersion)) {
|
if (!semver.gt(version, previousVersion)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Version '${chalk.yellow.underline(version)}' has already been published`,
|
`Version '${styleText.yellow.underline(version)}' has already been published`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next && semver.prerelease(version) === null) {
|
if (next && semver.prerelease(version) === null) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Version '${chalk.yellow.underline(
|
`Version '${styleText.yellow.underline(
|
||||||
version,
|
version,
|
||||||
)}' is not a prerelease version`,
|
)}' is not a prerelease version`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import outdent from "outdent";
|
import outdent from "outdent";
|
||||||
import { logPromise, waitForEnter } from "../utils.js";
|
import { logPromise, waitForEnter } from "../utils.js";
|
||||||
|
|
||||||
@@ -34,10 +34,10 @@ export default async function waitForBotRelease({ dry, version, next }) {
|
|||||||
if (!(await checkBotPermission())) {
|
if (!(await checkBotPermission())) {
|
||||||
console.log(
|
console.log(
|
||||||
outdent`
|
outdent`
|
||||||
1. Go to ${chalk.green.underline(
|
1. Go to ${styleText.green.underline(
|
||||||
"https://www.npmjs.com/package/prettier/access",
|
"https://www.npmjs.com/package/prettier/access",
|
||||||
)}
|
)}
|
||||||
2. Add "${chalk.yellow("prettier-bot")}" as prettier package maintainer.
|
2. Add "${styleText.yellow("prettier-bot")}" as prettier package maintainer.
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ export default async function waitForBotRelease({ dry, version, next }) {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
outdent`
|
outdent`
|
||||||
1. Go to ${chalk.green.underline(
|
1. Go to ${styleText.green.underline(
|
||||||
"https://www.npmjs.com/package/prettier/access",
|
"https://www.npmjs.com/package/prettier/access",
|
||||||
)}
|
)}
|
||||||
2. Make sure "${chalk.yellow(
|
2. Make sure "${styleText.yellow(
|
||||||
"Publishing access",
|
"Publishing access",
|
||||||
)}" section is set to "${chalk.yellow(
|
)}" section is set to "${styleText.yellow(
|
||||||
"Require two-factor authentication or an automation or granular access token",
|
"Require two-factor authentication or an automation or granular access token",
|
||||||
)}".
|
)}".
|
||||||
`,
|
`,
|
||||||
@@ -61,16 +61,16 @@ export default async function waitForBotRelease({ dry, version, next }) {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
outdent`
|
outdent`
|
||||||
1. Go to ${chalk.green.underline(
|
1. Go to ${styleText.green.underline(
|
||||||
"https://github.com/prettier/release-workflow/actions/workflows/release.yml",
|
"https://github.com/prettier/release-workflow/actions/workflows/release.yml",
|
||||||
)}
|
)}
|
||||||
2. Click "${chalk.green(
|
2. Click "${styleText.green(
|
||||||
"Run workflow",
|
"Run workflow",
|
||||||
)}" button, type "${chalk.yellow.underline(
|
)}" button, type "${styleText.yellow.underline(
|
||||||
version,
|
version,
|
||||||
)}" in "Version to release", ${
|
)}" in "Version to release", ${
|
||||||
next ? 'check only "Unstable version"' : "uncheck all checkboxes"
|
next ? 'check only "Unstable version"' : "uncheck all checkboxes"
|
||||||
}, hit the "${chalk.bgGreen("Run workflow")}" button.
|
}, hit the "${styleText.bgGreen("Run workflow")}" button.
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { describe, it } from "node:test";
|
import { describe, it } from "node:test";
|
||||||
import chalk from "chalk";
|
import styleText from "node-style-text";
|
||||||
import validateNewVersion from "../steps/validate-new-version.js";
|
import validateNewVersion from "../steps/validate-new-version.js";
|
||||||
|
|
||||||
describe("validate-new-version", () => {
|
describe("validate-new-version", () => {
|
||||||
@@ -17,7 +17,9 @@ describe("validate-new-version", () => {
|
|||||||
() => {
|
() => {
|
||||||
validateNewVersion({ version: "foo" });
|
validateNewVersion({ version: "foo" });
|
||||||
},
|
},
|
||||||
{ message: `Invalid version '${chalk.red.underline("foo")}' specified` },
|
{
|
||||||
|
message: `Invalid version '${styleText.red.underline("foo")}' specified`,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it("throws error when version isn't greater than prev version", () => {
|
it("throws error when version isn't greater than prev version", () => {
|
||||||
@@ -26,7 +28,7 @@ describe("validate-new-version", () => {
|
|||||||
validateNewVersion({ version: "0.0.1", previousVersion: "0.0.2" });
|
validateNewVersion({ version: "0.0.1", previousVersion: "0.0.2" });
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: `Version '${chalk.yellow(
|
message: `Version '${styleText.yellow.underline(
|
||||||
"0.0.1",
|
"0.0.1",
|
||||||
)}' has already been published`,
|
)}' has already been published`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import fs from "node:fs";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import readline from "node:readline";
|
import readline from "node:readline";
|
||||||
import url from "node:url";
|
import url from "node:url";
|
||||||
import chalk from "chalk";
|
|
||||||
import { execa } from "execa";
|
import { execa } from "execa";
|
||||||
|
import styleText from "node-style-text";
|
||||||
import outdent from "outdent";
|
import outdent from "outdent";
|
||||||
import getFormattedDate from "./get-formatted-date.js";
|
import getFormattedDate from "./get-formatted-date.js";
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ const padStatusText = (text) => {
|
|||||||
};
|
};
|
||||||
const status = {};
|
const status = {};
|
||||||
for (const { color, text } of statusConfig) {
|
for (const { color, text } of statusConfig) {
|
||||||
status[text] = chalk[color].black(padStatusText(text));
|
status[text] = styleText[color].black(padStatusText(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fitTerminal(input, suffix = "") {
|
function fitTerminal(input, suffix = "") {
|
||||||
@@ -31,7 +31,7 @@ function fitTerminal(input, suffix = "") {
|
|||||||
const WIDTH = columns - maxLength + 1;
|
const WIDTH = columns - maxLength + 1;
|
||||||
if (input.length < WIDTH) {
|
if (input.length < WIDTH) {
|
||||||
const repeatCount = Math.max(WIDTH - input.length - 1 - suffix.length, 0);
|
const repeatCount = Math.max(WIDTH - input.length - 1 - suffix.length, 0);
|
||||||
input += chalk.dim(".").repeat(repeatCount) + suffix;
|
input += styleText.dim(".").repeat(repeatCount) + suffix;
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ function runGit(args, options) {
|
|||||||
|
|
||||||
function waitForEnter() {
|
function waitForEnter() {
|
||||||
console.log();
|
console.log();
|
||||||
console.log(chalk.gray("Press ENTER to continue."));
|
console.log(styleText.gray("Press ENTER to continue."));
|
||||||
|
|
||||||
process.stdin.setRawMode(true);
|
process.stdin.setRawMode(true);
|
||||||
|
|
||||||
|
|||||||
@@ -69,13 +69,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"chalk@npm:5.3.0":
|
|
||||||
version: 5.3.0
|
|
||||||
resolution: "chalk@npm:5.3.0"
|
|
||||||
checksum: 10/6373caaab21bd64c405bfc4bd9672b145647fc9482657b5ea1d549b3b2765054e9d3d928870cdf764fb4aad67555f5061538ff247b8310f110c5c888d92397ea
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"cross-spawn@npm:^7.0.3":
|
"cross-spawn@npm:^7.0.3":
|
||||||
version: 7.0.6
|
version: 7.0.6
|
||||||
resolution: "cross-spawn@npm:7.0.6"
|
resolution: "cross-spawn@npm:7.0.6"
|
||||||
@@ -251,6 +244,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"node-style-text@npm:0.0.6":
|
||||||
|
version: 0.0.6
|
||||||
|
resolution: "node-style-text@npm:0.0.6"
|
||||||
|
checksum: 10/9eeb6a054597ed122f16ec1fc404a687f75c857655cc1478b0f8b6ccd14f8badfbaeacc0b9cd5dcf84b8286986e52c5feffbf070ed4568acb7f4eb2f1cb6a5a3
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"npm-run-path@npm:^6.0.0":
|
"npm-run-path@npm:^6.0.0":
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
resolution: "npm-run-path@npm:6.0.0"
|
resolution: "npm-run-path@npm:6.0.0"
|
||||||
@@ -323,10 +323,10 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "root-workspace-0b6124@workspace:."
|
resolution: "root-workspace-0b6124@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk: "npm:5.3.0"
|
|
||||||
enquirer: "npm:2.4.1"
|
enquirer: "npm:2.4.1"
|
||||||
execa: "npm:9.5.1"
|
execa: "npm:9.5.1"
|
||||||
fast-glob: "npm:3.3.3"
|
fast-glob: "npm:3.3.3"
|
||||||
|
node-style-text: "npm:0.0.6"
|
||||||
outdent: "npm:0.8.0"
|
outdent: "npm:0.8.0"
|
||||||
semver: "npm:7.6.3"
|
semver: "npm:7.6.3"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
|
|||||||
Reference in new issue
Block a user