Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on rimraf #517

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"np": "^7.4.0",
"prettier": "^2.2.1",
"randomstring": "^1.1.5",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.0",
"ts-node": "8.0.3",
"tslint": "^5.14.0",
Expand All @@ -75,12 +76,11 @@
"ci-info": "^3.7.0",
"cross-spawn": "^7.0.3",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^9.0.0",
"fs-extra": "^10.0.0",
"json-stable-stringify": "^1.0.2",
"klaw-sync": "^6.0.0",
"minimist": "^1.2.6",
"open": "^7.4.2",
"rimraf": "^2.6.3",
"semver": "^7.5.3",
"slash": "^2.0.0",
"tmp": "^0.0.33",
Expand Down
16 changes: 8 additions & 8 deletions src/makePatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
mkdirpSync,
mkdirSync,
realpathSync,
removeSync,
writeFileSync,
} from "fs-extra"
import { sync as rimraf } from "rimraf"
import { dirSync } from "tmp"
import { gzipSync } from "zlib"
import { applyPatch } from "./applyPatches"
Expand Down Expand Up @@ -254,11 +254,11 @@ export function makePatch({
})

// remove nested node_modules just to be safe
rimraf(join(tmpRepoPackagePath, "node_modules"))
removeSync(join(tmpRepoPackagePath, "node_modules"))
// remove .git just to be safe
rimraf(join(tmpRepoPackagePath, ".git"))
removeSync(join(tmpRepoPackagePath, ".git"))
// remove patch-package state file
rimraf(join(tmpRepoPackagePath, STATE_FILE_NAME))
removeSync(join(tmpRepoPackagePath, STATE_FILE_NAME))

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

// replace package with user's version
rimraf(tmpRepoPackagePath)
removeSync(tmpRepoPackagePath)

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

// remove nested node_modules just to be safe
rimraf(join(tmpRepoPackagePath, "node_modules"))
removeSync(join(tmpRepoPackagePath, "node_modules"))
// remove .git just to be safe
rimraf(join(tmpRepoPackagePath, ".git"))
removeSync(join(tmpRepoPackagePath, ".git"))
// remove patch-package state file
rimraf(join(tmpRepoPackagePath, STATE_FILE_NAME))
removeSync(join(tmpRepoPackagePath, STATE_FILE_NAME))

// also remove ignored files like before
removeIgnoredFiles(tmpRepoPackagePath, includePaths, excludePaths)
Expand Down
14 changes: 4 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,6 @@ asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"

at-least-node@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==

atob@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
Expand Down Expand Up @@ -1912,12 +1907,11 @@ fragment-cache@^0.2.1:
dependencies:
map-cache "^0.2.2"

fs-extra@^9.0.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
fs-extra@^10.0.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"
Expand Down
Loading