Remove the direct rimraf dependency entirely - #2719
Conversation
Bumps [rimraf](https://github.com/isaacs/rimraf) from 3.0.2 to 6.1.3. - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](isaacs/rimraf@v3.0.2...v6.1.3) --- updated-dependencies: - dependency-name: rimraf dependency-version: 6.1.3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
Updates the project’s npm dependency on rimraf to a newer major version.
Changes:
- Bumped
rimraffrom^3.0.2to^6.1.3.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "multistream": "^2.1.1", | ||
| "mysql2": "^3.10.1", | ||
| "rimraf": "^3.0.2", | ||
| "rimraf": "^6.1.3", |
|
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
Addressed in commit b3... (latest push):
|
|
Re-verified against the current state of commit acc91c8:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (2)
tests/testutils.ts:137
- The catch block doesn’t use the caught error. Since this repo already uses optional catch bindings (
catch {}) elsewhere, omit the unused variable to avoid noise and keep the intent clear.
try {
await rimraf(path);
} catch (err) {
// TODO: Handle delete errors
}
tests/common/utils.test.ts:28
- This test hard-codes a path under the system temp directory. If a previous run left the directory behind (or tests run concurrently on the same machine), the precondition
existsSync(dir) === falsecan become flaky. Use a unique temp base directory and a non-existent child path, and clean up the base dir afterward.
it("resolves without error when the path does not exist", async () => {
const dir = join(tmpdir(), "azurite-rimraf-test-does-not-exist");
assert.equal(existsSync(dir), false);
await rimrafAsync(dir);
assert.equal(existsSync(dir), false);
});
|
Copilot, |
The PR link you referenced (#2719) is this same PR — both the current PR and the linked one are PR #2719 on the Regarding the visible/suppressed review comment on this PR (the In summary: this PR is the correct and only place to track these rimraf v6 changes, and all previous concerns have been addressed. Please let me know if you intended to reference a different PR number. |
|
Here's a comparison of the two approaches: PR #2631 (replace rimraf with native
This PR (#2719) (bump rimraf v3 → v6):
My opinion: PR #2631's approach (removing rimraf entirely) is the cleaner long-term solution since it eliminates an external dependency in favor of the equivalent Node.js built-in. However, since that PR is from an external contributor's fork, needs a rebase against main (which has diverged significantly), and still has unresolved CI failures, it would take additional work from the original author or from this team before it's mergeable. Recommendation:
The decision is yours — I can apply PR #2631's approach to this branch if you want to go that route. |
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
|
Implemented PR #2631’s approach in commit Changes applied:
Validation done: workflow run check (no failed jobs for latest PR #2719 run), |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (3)
tests/testutils.ts:135
- rmRecursive previously resolved even when deletion failed (it explicitly swallowed rimraf errors). With fsPromises.rm(), a failure (e.g., EBUSY/EPERM) will now reject, which can become an unhandled promise rejection at existing call sites that don’t await rmRecursive (e.g. tests/blob/blockblob.highlevel.test.ts:485). If rmRecursive is intended as best-effort cleanup, it should continue to swallow delete errors.
export async function rmRecursive(path: string): Promise<void> {
await fsPromises.rm(path, {
recursive: true,
force: true,
maxRetries: process.platform === "win32" ? 10 : 0
tests/common/utils.test.ts:22
- This test assumes the chosen tmp path does not exist. Because it’s a fixed name in the shared OS temp directory, it can collide with leftovers from prior runs (or parallel runs), making the assertion flaky. Use a unique suffix (pid/timestamp/random) for the non-existent path.
const dir = join(tmpdir(), "azurite-rimraf-test-does-not-exist");
assert.equal(existsSync(dir), false);
package.json:332
- The PR title/description say this is a bump of rimraf from 3.0.2 to 6.1.3, but the code changes remove the direct rimraf dependency entirely (and package-lock still contains rimraf@3.0.2 transitively). Either update the PR metadata to reflect a removal/replacement, or actually upgrade rimraf and adjust call sites to the v6 API.
"clean": "node scripts/clean.js",
"clean:deep": "node scripts/clean.js --deep",
Copilot, please check these suppressed review comments. |
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
... Addressed in commit
Validation run:
Also checked Actions for this branch and reviewed logs: latest relevant run had no failed jobs ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
scripts/clean.js:8
rm()usesfs.rmSync(..., { recursive: true, force: true })without retries. On Windows, deletes can intermittently fail due to file locking (similar to why other call sites in this PR setmaxRetriesfor win32). AddingmaxRetrieshere reduces flakynpm run clean/CI cleanup failures.
function rm(target) {
try {
fs.rmSync(target, { recursive: true, force: true });
} catch (err) {
Copilot, |
Co-authored-by: jainakanksha-msft <181211853+jainakanksha-msft@users.noreply.github.com>
... Added |
This pull request removes the
rimrafdependency and replaces its usage with Node.js built-infs.rm()for file and directory cleanup, streamlining development dependencies and scripts. The cleanup logic is now handled by a newscripts/clean.jsscript, and related utility/test code has been updated accordingly. A unit test for the newrimrafAsyncutility is also included.Dependency and Script Cleanup:
rimrafand@types/rimrafdependencies frompackage.json. Cleanup scripts now use a custom Node.js script instead of therimrafCLI. [1] [2] [3]scripts/clean.js, which implements recursive and glob-based file removal usingfs.rmSync, replacing all previous uses ofrimrafin npm scripts.cleanandclean:deepnpm scripts to invokescripts/clean.js.Code and Test Refactoring:
rimrafin utility and test files with the built-infs.rm()API (rimrafAsyncinsrc/common/utils/utils.tsandrmRecursiveintests/testutils.ts). [1] [2] [3]rimrafAsyncfunction intests/common/utils.test.tsto ensure correct removal behavior.These changes reduce external dependencies, improve maintainability, and ensure that cleanup operations use modern, built-in Node.js functionality.