Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
Jimmy Wärting 2023-08-24 01:42:37 +02:00 коммит произвёл GitHub
Родитель 5fe88ea044
Коммит 3a22d3aded
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 21 добавлений и 152 удалений

Просмотреть файл

@ -4,7 +4,6 @@ import {
} from "@esfx/canceltoken";
import chalk from "chalk";
import chokidar from "chokidar";
import del from "del";
import esbuild from "esbuild";
import {
EventEmitter,
@ -39,6 +38,7 @@ import {
memoize,
needsUpdate,
readJson,
rimraf,
} from "./scripts/build/utils.mjs";
const glob = util.promisify(_glob);
@ -105,7 +105,10 @@ const cleanDiagnostics = task({
name: "clean-diagnostics",
description: "Generates a diagnostic file in TypeScript based on an input JSON file",
hiddenFromTaskList: true,
run: () => del([diagnosticInformationMapTs, diagnosticMessagesGeneratedJson]),
run: async () => {
await rimraf(diagnosticInformationMapTs);
await rimraf(diagnosticMessagesGeneratedJson);
},
});
// Localize diagnostics
@ -809,7 +812,7 @@ function baselineAcceptTask(localBaseline, refBaseline) {
const toDelete = await glob(`${localBaseline}/**/*.delete`, { nodir: true });
for (const p of toDelete) {
const out = localPathToRefPath(p).replace(/\.delete$/, "");
await fs.promises.rm(out);
await rimraf(out);
}
};
}
@ -873,7 +876,7 @@ export const lkg = task({
export const cleanBuilt = task({
name: "clean-built",
hiddenFromTaskList: true,
run: () => del("built"),
run: () => fs.promises.rm("built", { recursive: true, force: true }),
});
export const clean = task({

131
package-lock.json сгенерированный
Просмотреть файл

@ -33,7 +33,6 @@
"chai": "^4.3.7",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"del": "^6.1.1",
"diff": "^5.1.0",
"dprint": "^0.40.2",
"esbuild": "^0.19.0",
@ -1185,19 +1184,6 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/aggregate-error": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
"integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
"dev": true,
"dependencies": {
"clean-stack": "^2.0.0",
"indent-string": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@ -1497,15 +1483,6 @@
"fsevents": "~2.3.2"
}
},
"node_modules/clean-stack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
"integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -1718,28 +1695,6 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
"node_modules/del": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-6.1.1.tgz",
"integrity": "sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==",
"dev": true,
"dependencies": {
"globby": "^11.0.1",
"graceful-fs": "^4.2.4",
"is-glob": "^4.0.1",
"is-path-cwd": "^2.2.0",
"is-path-inside": "^3.0.2",
"p-map": "^4.0.0",
"rimraf": "^3.0.2",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
@ -2544,15 +2499,6 @@
"node": ">=0.8.19"
}
},
"node_modules/indent-string": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -2629,15 +2575,6 @@
"node": ">=0.12.0"
}
},
"node_modules/is-path-cwd": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
"integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
@ -3157,21 +3094,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-map": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
"integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",
"dev": true,
"dependencies": {
"aggregate-error": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@ -4695,16 +4617,6 @@
"dev": true,
"requires": {}
},
"aggregate-error": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
"integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==",
"dev": true,
"requires": {
"clean-stack": "^2.0.0",
"indent-string": "^4.0.0"
}
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@ -4926,12 +4838,6 @@
"readdirp": "~3.6.0"
}
},
"clean-stack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
"integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==",
"dev": true
},
"cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -5101,22 +5007,6 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
"del": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-6.1.1.tgz",
"integrity": "sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==",
"dev": true,
"requires": {
"globby": "^11.0.1",
"graceful-fs": "^4.2.4",
"is-glob": "^4.0.1",
"is-path-cwd": "^2.2.0",
"is-path-inside": "^3.0.2",
"p-map": "^4.0.0",
"rimraf": "^3.0.2",
"slash": "^3.0.0"
}
},
"deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
@ -5699,12 +5589,6 @@
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
"dev": true
},
"indent-string": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -5763,12 +5647,6 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"is-path-cwd": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
"integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
"dev": true
},
"is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
@ -6147,15 +6025,6 @@
"p-limit": "^3.0.2"
}
},
"p-map": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
"integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",
"dev": true,
"requires": {
"aggregate-error": "^3.0.0"
}
},
"parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",

Просмотреть файл

@ -59,7 +59,6 @@
"chai": "^4.3.7",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"del": "^6.1.1",
"diff": "^5.1.0",
"dprint": "^0.40.2",
"esbuild": "^0.19.0",

Просмотреть файл

@ -2,7 +2,6 @@ import {
CancelError,
} from "@esfx/canceltoken";
import chalk from "chalk";
import del from "del";
import fs from "fs";
import os from "os";
import path from "path";
@ -15,6 +14,7 @@ import cmdLineOptions from "./options.mjs";
import {
exec,
ExecError,
rimraf,
} from "./utils.mjs";
const mochaJs = path.resolve(findUpRoot(), "node_modules", "mocha", "bin", "_mocha");
@ -48,16 +48,14 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
console.log(chalk.yellowBright(`[watch] cleaning test directories...`));
}
await cleanTestDirs();
await cleanCoverageDir();
await rimraf(coverageDir);
if (options.token?.signaled) {
return;
}
}
if (fs.existsSync(testConfigFile)) {
fs.unlinkSync(testConfigFile);
}
await rimraf(testConfigFile);
let workerCount, taskConfigsFolder;
if (runInParallel) {
@ -158,8 +156,8 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
process.env.NODE_ENV = savedNodeEnv;
}
await del("test.config");
await deleteTemporaryProjectOutput();
await rimraf("test.config");
await rimraf(path.join(localBaseline, "projectOutput"));
if (error !== undefined) {
if (error instanceof CancelError) {
@ -177,14 +175,10 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
}
export async function cleanTestDirs() {
await del([localBaseline]);
await rimraf(localBaseline);
await fs.promises.mkdir(localBaseline, { recursive: true });
}
async function cleanCoverageDir() {
await del([coverageDir]);
}
/**
* used to pass data from command line directly to run.js
* @param {string} tests
@ -216,10 +210,6 @@ export function writeTestConfigFile(tests, runners, light, taskConfigsFolder, wo
fs.writeFileSync("test.config", testConfigContents);
}
function deleteTemporaryProjectOutput() {
return del(path.join(localBaseline, "projectOutput/"));
}
/**
* @param {string} text
*/

Просмотреть файл

@ -232,3 +232,11 @@ export function memoize(fn) {
return value;
};
}
/**
* @param {fs.PathLike} p
*/
export function rimraf(p) {
// The rimraf package uses maxRetries=10 on Windows, but Node's fs.rm does not have that special case.
return fs.promises.rm(p, { recursive: true, force: true, maxRetries: process.platform === "win32" ? 10 : 0 });
}