From f8773fcd6a8d69c23664ab8eb442297dc7deb8aa Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 23 Oct 2022 22:23:30 +0900 Subject: [PATCH] Remove `rimraf` package (#13721) * Remove `rimraf` from `draft-blog-post` * Remove `rimraf` from `sync-flow-tests` * Remove `rimraf` from cache tests * Uninstall `rimraf` --- package.json | 1 - scripts/draft-blog-post.mjs | 6 ++++-- scripts/sync-flow-tests.cjs | 3 +-- tests/integration/__tests__/cache.js | 8 +++++--- yarn.lock | 3 +-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 2c3e5463b..cac7d0de9 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,6 @@ "path-browserify": "1.0.1", "prettier": "2.7.1", "pretty-bytes": "6.0.0", - "rimraf": "3.0.2", "rollup-plugin-license": "2.8.2", "semver": "7.3.8", "snapshot-diff": "0.10.0", diff --git a/scripts/draft-blog-post.mjs b/scripts/draft-blog-post.mjs index 1b3d1bdf4..6da710844 100644 --- a/scripts/draft-blog-post.mjs +++ b/scripts/draft-blog-post.mjs @@ -2,8 +2,8 @@ import fs from "node:fs"; import path from "node:path"; -import rimraf from "rimraf"; import createEsmUtils from "esm-utils"; +import fg from "fast-glob"; import { getEntries, replaceVersions, @@ -67,7 +67,9 @@ for (const dir of changelogUnreleasedDirs) { category.entries = getEntries(dirPath); } -rimraf.sync(postGlob); +for (const filePath of fg.sync(postGlob)) { + fs.rmSync(filePath); +} const introFileData = fs.readFileSync(introFile, "utf8").trim(); diff --git a/scripts/sync-flow-tests.cjs b/scripts/sync-flow-tests.cjs index 5c32995dd..fadbe87d1 100644 --- a/scripts/sync-flow-tests.cjs +++ b/scripts/sync-flow-tests.cjs @@ -4,7 +4,6 @@ const fs = require("fs"); const path = require("path"); const flowParser = require("flow-parser"); const fastGlob = require("fast-glob"); -const rimraf = require("rimraf"); const DEFAULT_SPEC_CONTENT = "run_spec(__dirname);\n"; const SPEC_FILE_NAME = "jsfmt.spec.js"; @@ -50,7 +49,7 @@ function syncTests(syncDir) { const skipped = []; - rimraf.sync(FLOW_TESTS_DIR); + fs.rmSync(FLOW_TESTS_DIR); for (const file of filesToCopy) { const content = fs.readFileSync(file, "utf8"); diff --git a/tests/integration/__tests__/cache.js b/tests/integration/__tests__/cache.js index dd8776375..f97641bd0 100644 --- a/tests/integration/__tests__/cache.js +++ b/tests/integration/__tests__/cache.js @@ -1,7 +1,6 @@ import path from "node:path"; import { promises as fs } from "node:fs"; import { fileURLToPath } from "node:url"; -import rimraf from "rimraf"; function resolveDir(dir) { return fileURLToPath(new URL(`../${dir}/`, import.meta.url)); @@ -26,8 +25,11 @@ describe("--cache option", () => { }); afterEach(async () => { - rimraf.sync(path.join(dir, "node_modules")); - rimraf.sync(nonDefaultCacheFilePath); + await fs.rm(path.join(dir, "node_modules"), { + force: true, + recursive: true, + }); + await fs.rm(nonDefaultCacheFilePath, { force: true }); await fs.writeFile(path.join(dir, "a.js"), contentA); await fs.writeFile(path.join(dir, "b.js"), contentB); }); diff --git a/yarn.lock b/yarn.lock index fc42d2442..03eac06cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6712,7 +6712,6 @@ __metadata: remark-footnotes: 2.0.0 remark-math: 3.0.1 remark-parse: 8.0.3 - rimraf: 3.0.2 rollup-plugin-license: 2.8.2 sdbm: 2.0.0 semver: 7.3.8 @@ -7090,7 +7089,7 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:3.0.2, rimraf@npm:^3.0.2": +"rimraf@npm:^3.0.2": version: 3.0.2 resolution: "rimraf@npm:3.0.2" dependencies: