Skip to content

Commit

Permalink
Replace rimraf to native (#8729)
Browse files Browse the repository at this point in the history
We remove the dependency on `rimraf` and replace it with native, keeping
the functionality in `packages/create-turbo` and
`packages/turbo-test-utils`

---------

Co-authored-by: Anthony Shew <[email protected]>
  • Loading branch information
torresgol10 and anthonyshew authored Jul 23, 2024
1 parent 65cb125 commit 7f3162f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 101 deletions.
2 changes: 0 additions & 2 deletions packages/create-turbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"inquirer": "^8.0.0",
"picocolors": "1.0.1",
"proxy-agent": "^6.2.2",
"rimraf": "^3.0.2",
"semver": "^7.3.8",
"update-check": "^1.5.4"
},
Expand All @@ -43,7 +42,6 @@
"@types/inquirer": "^7.3.1",
"@types/jest": "^27.4.0",
"@types/node": "^18.17.2",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.9",
"jest": "^27.4.3",
"ts-jest": "^27.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-turbo/src/utils/git.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execSync } from "node:child_process";
import path from "node:path";
import { sync as rmSync } from "rimraf";
import { rmSync } from "node:fs";

export const DEFAULT_IGNORE = `
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
Expand Down Expand Up @@ -71,7 +71,7 @@ export function tryGitInit(root: string, message: string): boolean {
} catch (err) {
if (didInit) {
try {
rmSync(path.join(root, ".git"));
rmSync(path.join(root, ".git"), { recursive: true, force: true });
} catch (_) {
// do nothing
}
Expand Down
3 changes: 1 addition & 2 deletions packages/turbo-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"dependencies": {
"fs-extra": "^11.1.0",
"js-yaml": "^4.1.0",
"json5": "^2.2.3",
"rimraf": "^5.0.1"
"json5": "^2.2.3"
}
}
10 changes: 7 additions & 3 deletions packages/turbo-test-utils/src/useFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import { randomUUID } from "node:crypto";
import { rimraf } from "rimraf";
import { rm } from "node:fs/promises";
import {
mkdirSync,
existsSync,
Expand Down Expand Up @@ -30,18 +30,22 @@ export function setupTestFixtures({
afterEach(async () => {
await Promise.all(
fixtures.map((fixture) =>
rimraf(fixture, {
rm(fixture, {
retryDelay: 50,
maxRetries: 5,
recursive: true,
force: true,
})
)
);
});

afterAll(async () => {
await rimraf(parentDirectory, {
await rm(parentDirectory, {
retryDelay: 50,
maxRetries: 5,
recursive: true,
force: true,
});
});

Expand Down
98 changes: 6 additions & 92 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7f3162f

Please sign in to comment.