Skip to content

Commit 948585d

Browse files
committedMar 4, 2024
Remove dependency on rimraf
fs-extra was basically created to avoid having to install both mkdirp, rimraf etc, and is also already installed here, so we can avoid using both at the same time. This moves rimraf to devDependencies, since it's still conveniant for the local 'clean' and 'prepack' commands. At the same time, update to fs-extra 10.x, since it's lowest supported node version there is now still lower than the lowest supported version for patch-package, but has still introduced the option of using node's native fs.rm when available: https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md (fs-extra 11.x only works on node 14.14+, while patch-package currently supports all 14.x versions)
1 parent c7c63bf commit 948585d

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed
 

Diff for: ‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"np": "^7.4.0",
6565
"prettier": "^2.2.1",
6666
"randomstring": "^1.1.5",
67+
"rimraf": "^2.6.3",
6768
"ts-jest": "^24.0.0",
6869
"ts-node": "8.0.3",
6970
"tslint": "^5.14.0",
@@ -75,12 +76,11 @@
7576
"ci-info": "^3.7.0",
7677
"cross-spawn": "^7.0.3",
7778
"find-yarn-workspace-root": "^2.0.0",
78-
"fs-extra": "^9.0.0",
79+
"fs-extra": "^10.0.0",
7980
"json-stable-stringify": "^1.0.2",
8081
"klaw-sync": "^6.0.0",
8182
"minimist": "^1.2.6",
8283
"open": "^7.4.2",
83-
"rimraf": "^2.6.3",
8484
"semver": "^7.5.3",
8585
"slash": "^2.0.0",
8686
"tmp": "^0.0.33",

Diff for: ‎src/makePatch.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
mkdirpSync,
88
mkdirSync,
99
realpathSync,
10+
removeSync,
1011
writeFileSync,
1112
} from "fs-extra"
12-
import { sync as rimraf } from "rimraf"
1313
import { dirSync } from "tmp"
1414
import { gzipSync } from "zlib"
1515
import { applyPatch } from "./applyPatches"
@@ -254,11 +254,11 @@ export function makePatch({
254254
})
255255

256256
// remove nested node_modules just to be safe
257-
rimraf(join(tmpRepoPackagePath, "node_modules"))
257+
removeSync(join(tmpRepoPackagePath, "node_modules"))
258258
// remove .git just to be safe
259-
rimraf(join(tmpRepoPackagePath, ".git"))
259+
removeSync(join(tmpRepoPackagePath, ".git"))
260260
// remove patch-package state file
261-
rimraf(join(tmpRepoPackagePath, STATE_FILE_NAME))
261+
removeSync(join(tmpRepoPackagePath, STATE_FILE_NAME))
262262

263263
// commit the package
264264
console.info(chalk.grey("•"), "Diffing your files with clean files")
@@ -292,17 +292,17 @@ export function makePatch({
292292
git("commit", "--allow-empty", "-m", "init")
293293

294294
// replace package with user's version
295-
rimraf(tmpRepoPackagePath)
295+
removeSync(tmpRepoPackagePath)
296296

297297
// pnpm installs packages as symlinks, copySync would copy only the symlink
298298
copySync(realpathSync(packagePath), tmpRepoPackagePath)
299299

300300
// remove nested node_modules just to be safe
301-
rimraf(join(tmpRepoPackagePath, "node_modules"))
301+
removeSync(join(tmpRepoPackagePath, "node_modules"))
302302
// remove .git just to be safe
303-
rimraf(join(tmpRepoPackagePath, ".git"))
303+
removeSync(join(tmpRepoPackagePath, ".git"))
304304
// remove patch-package state file
305-
rimraf(join(tmpRepoPackagePath, STATE_FILE_NAME))
305+
removeSync(join(tmpRepoPackagePath, STATE_FILE_NAME))
306306

307307
// also remove ignored files like before
308308
removeIgnoredFiles(tmpRepoPackagePath, includePaths, excludePaths)

Diff for: ‎yarn.lock

+4-10
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,6 @@ asynckit@^0.4.0:
765765
version "0.4.0"
766766
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
767767

768-
at-least-node@^1.0.0:
769-
version "1.0.0"
770-
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
771-
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
772-
773768
atob@^2.1.1:
774769
version "2.1.2"
775770
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
@@ -1912,12 +1907,11 @@ fragment-cache@^0.2.1:
19121907
dependencies:
19131908
map-cache "^0.2.2"
19141909

1915-
fs-extra@^9.0.0:
1916-
version "9.1.0"
1917-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
1918-
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
1910+
fs-extra@^10.0.0:
1911+
version "10.1.0"
1912+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
1913+
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
19191914
dependencies:
1920-
at-least-node "^1.0.0"
19211915
graceful-fs "^4.2.0"
19221916
jsonfile "^6.0.1"
19231917
universalify "^2.0.0"

0 commit comments

Comments
 (0)
Please sign in to comment.