Drop Node.js 12 support for development "build" (#12557)
This commit is contained in:
1 parent
caba818940
commit
687ca4b95d
13 files changed
+108
-134
No files matched your search
+11
-13
@@ -86,19 +86,17 @@ async function buildPlaygroundFiles() {
|
||||
);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (IS_PULL_REQUEST) {
|
||||
console.log("Building prettier...");
|
||||
await buildPrettier();
|
||||
}
|
||||
if (IS_PULL_REQUEST) {
|
||||
console.log("Building prettier...");
|
||||
await buildPrettier();
|
||||
}
|
||||
|
||||
console.log("Preparing files for playground...");
|
||||
await buildPlaygroundFiles();
|
||||
console.log("Preparing files for playground...");
|
||||
await buildPlaygroundFiles();
|
||||
|
||||
// --- Site ---
|
||||
console.log("Installing website dependencies...");
|
||||
await runYarn("install", [], { cwd: WEBSITE_DIR });
|
||||
// --- Site ---
|
||||
console.log("Installing website dependencies...");
|
||||
await runYarn("install", [], { cwd: WEBSITE_DIR });
|
||||
|
||||
console.log("Building website...");
|
||||
await runYarn("build", [], { cwd: WEBSITE_DIR });
|
||||
})();
|
||||
console.log("Building website...");
|
||||
await runYarn("build", [], { cwd: WEBSITE_DIR });
|
||||
+3
-18
@@ -20,16 +20,6 @@ import saveLicenses from "./save-licenses.mjs";
|
||||
|
||||
const { require } = createEsmUtils(import.meta);
|
||||
|
||||
// Errors in promises should be fatal.
|
||||
const loggedErrors = new Set();
|
||||
process.on("unhandledRejection", (err) => {
|
||||
// No need to print it twice.
|
||||
if (!loggedErrors.has(err)) {
|
||||
console.error(err);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const statusConfig = [
|
||||
{ color: "bgGreen", text: "DONE" },
|
||||
{ color: "bgRed", text: "FAIL" },
|
||||
@@ -135,16 +125,11 @@ async function createBundle(bundleConfig, options) {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(status.FAIL + "\n");
|
||||
handleError(error);
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function handleError(error) {
|
||||
loggedErrors.add(error);
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
async function preparePackage() {
|
||||
const packageJson = await readJson(path.join(PROJECT_ROOT, "package.json"));
|
||||
packageJson.bin = "./bin-prettier.js";
|
||||
@@ -258,7 +243,7 @@ async function run(params) {
|
||||
}
|
||||
}
|
||||
|
||||
run(
|
||||
await run(
|
||||
minimist(process.argv.slice(2), {
|
||||
boolean: [
|
||||
"playground",
|
||||
|
||||
+5
-10
@@ -1,17 +1,12 @@
|
||||
import fs from "node:fs/promises";
|
||||
import chalk from "chalk";
|
||||
|
||||
(async () => {
|
||||
const packageJson = JSON.parse(
|
||||
await fs.readFile(new URL("../package.json", import.meta.url))
|
||||
);
|
||||
const packageJson = JSON.parse(
|
||||
await fs.readFile(new URL("../package.json", import.meta.url))
|
||||
);
|
||||
|
||||
validateDependencyObject(packageJson.dependencies);
|
||||
validateDependencyObject(packageJson.devDependencies);
|
||||
})().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
validateDependencyObject(packageJson.dependencies);
|
||||
validateDependencyObject(packageJson.devDependencies);
|
||||
|
||||
function validateDependencyObject(object) {
|
||||
for (const key of Object.keys(object)) {
|
||||
|
||||
+45
-50
@@ -15,55 +15,50 @@ const runSpellcheck = (options) => {
|
||||
return execa("yarn", [...yarnArgs, "lint:spellcheck", ...args], execaOptions);
|
||||
};
|
||||
|
||||
(async () => {
|
||||
console.log("Empty words ...");
|
||||
const config = JSON.parse(await fs.readFile(CSPELL_CONFIG_FILE));
|
||||
const original = config.words;
|
||||
await updateConfig({ ...config, words: [] });
|
||||
console.log("Empty words ...");
|
||||
const config = JSON.parse(await fs.readFile(CSPELL_CONFIG_FILE));
|
||||
const original = config.words;
|
||||
await updateConfig({ ...config, words: [] });
|
||||
|
||||
console.log("Running spellcheck with empty words ...");
|
||||
const { stdout } = await runSpellcheck({
|
||||
yarnArgs: ["--silent"],
|
||||
args: ["--words-only", "--unique"],
|
||||
execaOptions: { reject: false },
|
||||
});
|
||||
|
||||
const words = stdout
|
||||
.split("\n")
|
||||
// Remove upper case word, if lower case one already exists
|
||||
.filter((word, _, words) => {
|
||||
const lowerCased = word.toLowerCase();
|
||||
return lowerCased === word || !words.includes(lowerCased);
|
||||
})
|
||||
// Compare function from https://github.com/streetsidesoftware/vscode-spell-checker/blob/2fde3bc5c658ee51da5a56580aa1370bf8174070/packages/client/src/settings/CSpellSettings.ts#L78
|
||||
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
||||
config.words = words;
|
||||
|
||||
const removed = original.filter((word) => !words.includes(word));
|
||||
if (removed.length > 0) {
|
||||
console.log(
|
||||
`${removed.length} words removed: \n${removed
|
||||
.map((word) => ` - ${word}`)
|
||||
.join("\n")}`
|
||||
);
|
||||
}
|
||||
const added = words.filter((word) => !original.includes(word));
|
||||
if (added.length > 0) {
|
||||
console.log(
|
||||
`${added.length} words added: \n${added
|
||||
.map((word) => ` - ${word}`)
|
||||
.join("\n")}`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("Updating words ...");
|
||||
await updateConfig(config);
|
||||
|
||||
console.log("Running spellcheck with new words ...");
|
||||
await runSpellcheck({ execaOptions: { stdout: "inherit" } });
|
||||
|
||||
console.log("CSpell config file updated.");
|
||||
})().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
console.log("Running spellcheck with empty words ...");
|
||||
const { stdout } = await runSpellcheck({
|
||||
yarnArgs: ["--silent"],
|
||||
args: ["--words-only", "--unique"],
|
||||
execaOptions: { reject: false },
|
||||
});
|
||||
|
||||
const words = stdout
|
||||
.split("\n")
|
||||
// Remove upper case word, if lower case one already exists
|
||||
.filter((word, _, words) => {
|
||||
const lowerCased = word.toLowerCase();
|
||||
return lowerCased === word || !words.includes(lowerCased);
|
||||
})
|
||||
// Compare function from https://github.com/streetsidesoftware/vscode-spell-checker/blob/2fde3bc5c658ee51da5a56580aa1370bf8174070/packages/client/src/settings/CSpellSettings.ts#L78
|
||||
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
||||
config.words = words;
|
||||
|
||||
const removed = original.filter((word) => !words.includes(word));
|
||||
if (removed.length > 0) {
|
||||
console.log(
|
||||
`${removed.length} words removed: \n${removed
|
||||
.map((word) => ` - ${word}`)
|
||||
.join("\n")}`
|
||||
);
|
||||
}
|
||||
const added = words.filter((word) => !original.includes(word));
|
||||
if (added.length > 0) {
|
||||
console.log(
|
||||
`${added.length} words added: \n${added
|
||||
.map((word) => ` - ${word}`)
|
||||
.join("\n")}`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("Updating words ...");
|
||||
await updateConfig(config);
|
||||
|
||||
console.log("Running spellcheck with new words ...");
|
||||
await runSpellcheck({ execaOptions: { stdout: "inherit" } });
|
||||
|
||||
console.log("CSpell config file updated.");
|
||||
@@ -18,34 +18,32 @@ import { CHANGELOG_CATEGORIES } from "./utils/changelog-categories.mjs";
|
||||
|
||||
const { __dirname } = createEsmUtils(import.meta);
|
||||
|
||||
(async () => {
|
||||
const prNumberPrompt = new enquirer.NumberPrompt({
|
||||
message: "Input your Pull Request number:",
|
||||
});
|
||||
const prNumber = await prNumberPrompt.run();
|
||||
const prNumberPrompt = new enquirer.NumberPrompt({
|
||||
message: "Input your Pull Request number:",
|
||||
});
|
||||
const prNumber = await prNumberPrompt.run();
|
||||
|
||||
const categoryPrompt = new enquirer.AutoComplete({
|
||||
message: "Input category of your Pull Request:",
|
||||
limit: CHANGELOG_CATEGORIES.length,
|
||||
// The array passed to `choices` will be broken, so copy it.
|
||||
choices: [...CHANGELOG_CATEGORIES],
|
||||
});
|
||||
const category = (await categoryPrompt.run()).trim();
|
||||
const categoryPrompt = new enquirer.AutoComplete({
|
||||
message: "Input category of your Pull Request:",
|
||||
limit: CHANGELOG_CATEGORIES.length,
|
||||
// The array passed to `choices` will be broken, so copy it.
|
||||
choices: [...CHANGELOG_CATEGORIES],
|
||||
});
|
||||
const category = (await categoryPrompt.run()).trim();
|
||||
|
||||
if (!prNumber || !category) {
|
||||
throw new Error("Two args are required.");
|
||||
}
|
||||
assertCategory(category);
|
||||
if (!prNumber || !category) {
|
||||
throw new Error("Two args are required.");
|
||||
}
|
||||
assertCategory(category);
|
||||
|
||||
const { title, user } = await getPr(prNumber);
|
||||
const { title, user } = await getPr(prNumber);
|
||||
|
||||
const newChangelog = await createChangelog(title, user, prNumber, category);
|
||||
const newChangelog = await createChangelog(title, user, prNumber, category);
|
||||
|
||||
const changelogPath = await addNewChangelog(prNumber, category, newChangelog);
|
||||
const changelogPath = await addNewChangelog(prNumber, category, newChangelog);
|
||||
|
||||
const relativePath = path.relative(path.join(__dirname, ".."), changelogPath);
|
||||
console.log("Generated changelog file: " + relativePath);
|
||||
})();
|
||||
const relativePath = path.relative(path.join(__dirname, ".."), changelogPath);
|
||||
console.log("Generated changelog file: " + relativePath);
|
||||
|
||||
/**
|
||||
* @param {number} prNumber
|
||||
|
||||
Vendored
+1
-1
@@ -124,4 +124,4 @@ async function main() {
|
||||
console.log("`README.md` file saved");
|
||||
}
|
||||
|
||||
main();
|
||||
await main();
|
||||
Reference in new issue
Block a user