Skip to content

refactor: drop shelljs - #1206

Open
SukkaW wants to merge 1 commit into
peaceiris:mainfrom
SukkaW:drop-shelljs
Open

refactor: drop shelljs#1206
SukkaW wants to merge 1 commit into
peaceiris:mainfrom
SukkaW:drop-shelljs

Conversation

@SukkaW

@SukkaW SukkaW commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Replace shelljs rm & cp w/ Node.js built-in fs#cp and fs#rm API.

image

All tests passed on my machine locally.

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup of temporary files, excluded assets, and generated Git metadata to ensure directories are fully removed.
    • Enhanced reliability by completing filesystem operations before continuing.
  • Chores
    • Replaced reliance on a third-party shell utility with built-in Node filesystem promises.
    • Updated tests to use the new async filesystem behavior.

@SukkaW
SukkaW requested a review from peaceiris as a code owner July 23, 2026 06:48
@actions-gh-pages actions-gh-pages Bot added test Testing dependencies Pull requests that update a dependency file labels Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa26a4be-3456-46a6-a224-b5f56835a902

📥 Commits

Reviewing files that changed from the base of the PR and between e6cd59e and 3fdb7f5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • __tests__/git-utils.test.ts
  • package.json
  • src/git-utils.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/git-utils.ts
  • tests/git-utils.test.ts

📝 Walkthrough

Walkthrough

The change replaces shelljs filesystem operations with Node fs.promises APIs in production cleanup and copyAssets tests, and removes shelljs-related packages from package.json.

Changes

Filesystem operation migration

Layer / File(s) Summary
Production cleanup migration
src/git-utils.ts
Excluded assets and the generated .git directory are removed with forced, recursive fs.promises.rm calls.
Async test fixture operations
__tests__/git-utils.test.ts, package.json
Tests use awaited fs.promises.cp and fs.promises.rm helpers, and shelljs dependencies and types are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: peaceiris

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing shelljs from the project.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
package.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.96%. Comparing base (5049354) to head (3fdb7f5).
⚠️ Report is 71 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1206      +/-   ##
==========================================
- Coverage   58.78%   53.96%   -4.83%     
==========================================
  Files           4        4              
  Lines         296      265      -31     
  Branches       64       62       -2     
==========================================
- Hits          174      143      -31     
- Misses        119      122       +3     
+ Partials        3        0       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/git-utils.ts (1)

37-39: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Run excluded-asset removals concurrently.

The loop waits for each deletion before starting the next one, unnecessarily increasing cleanup time when a pattern matches many paths. The test helper already uses Promise.all for equivalent removals. (nodejs.org)

Suggested change
-    for (const file of files) {
-      await fs.promises.rm(file, {force: true, recursive: true});
-    }
+    await Promise.all(
+      files.map(file => fs.promises.rm(file, {force: true, recursive: true}))
+    );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/git-utils.ts` around lines 37 - 39, Update the excluded-asset removal
loop to start all fs.promises.rm operations concurrently and await their
completion with Promise.all, preserving force and recursive options for every
file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/git-utils.ts`:
- Around line 37-39: Update the excluded-asset removal loop to start all
fs.promises.rm operations concurrently and await their completion with
Promise.all, preserving force and recursive options for every file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c992474e-0f15-4bfb-9469-1eaea6357597

📥 Commits

Reviewing files that changed from the base of the PR and between 09d8f31 and e6cd59e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • __tests__/git-utils.test.ts
  • package.json
  • src/git-utils.ts

@peaceiris peaceiris left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@SukkaW

SukkaW commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

👀

@peaceiris

fs#cp became stable since Node.js v22.3.0

https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options

image

fs#cp was added since Node.js v14.14.0

https://nodejs.org/api/fs.html#fspromisesrmpath-options

image

We already target Node.js 24 runtime so shouldn't be a problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file test Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants