Skip to content

Replace run-parallel-limit with p-limit and use native promises#901

Draft
ecraig12345 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-issue-823
Draft

Replace run-parallel-limit with p-limit and use native promises#901
ecraig12345 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-issue-823

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Overview

Fixes #823

Replaces the run-parallel-limit dependency with p-limit in just-scripts, and converts the affected tasks to use native promises inline rather than wrapping the old callback pattern.

  • cleanTask: now an async task that awaits Promise.all of limited fse.remove(path) promises (no callback wrapper).
  • copyTask: collects src/dest pairs, then awaits limited copies using pipeline from stream/promises instead of the callback form of pipeline.
  • sassTask: async task awaiting limited per-file work; compile() and postcss(...).process() are awaited inline. Only the legacy node-sass render() callback API is promisified, since it has no promise-based equivalent.
  • Dependencies: added p-limit (^7.3.1), removed run-parallel-limit and @types/run-parallel-limit.

p-limit v7 is ESM-only, so it is dynamically imported from CJS the same way nano-spawn already is elsewhere in the package.

A Beachball change file is included.

Test Notes

  • Existing tests for all three tasks pass. Two test-side adjustments were needed for the promise conversion:
    • cleanTask.spec.ts: the fs-extra.remove mock is now promise-based instead of callback-based.
    • copyTask.spec.ts: preloads the ESM-only p-limit in beforeAll, since it cannot be loaded from disk while mock-fs is active.
  • Validated from the repo root: yarn build, yarn test, yarn lint, yarn format:check, yarn api:update (no API report changes).

Copilot AI 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.

Pull request overview

This PR updates just-scripts to remove the run-parallel-limit callback-based concurrency helper, replacing it with p-limit and converting the affected tasks to promise-first async implementations (including using stream/promises for copy streaming). This aligns the task implementations with modern Node.js behavior while preserving concurrency limits and existing task semantics.

Changes:

  • Replaced run-parallel-limit / @types/run-parallel-limit with p-limit (ESM-only, loaded via dynamic import) in just-scripts.
  • Converted cleanTask, copyTask, and sassTask to async tasks using native promises and Promise.all + concurrency limiting.
  • Updated tests to accommodate promise-based behavior and ESM-only import constraints under mock-fs.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
yarn.lock Removes run-parallel-limit and adds p-limit (+ transitive yocto-queue) to the lockfile.
packages/just-scripts/package.json Swaps the runtime dependency to p-limit and drops @types/run-parallel-limit.
packages/just-scripts/src/tasks/cleanTask.ts Converts to async + p-limit-throttled fse.remove promises.
packages/just-scripts/src/tasks/copyTask.ts Converts to async + p-limit, and switches to pipeline from stream/promises.
packages/just-scripts/src/tasks/sassTask.ts Converts to async + p-limit; awaits compile/postcss steps inline and promisifies legacy render().
packages/just-scripts/src/tasks/tests/cleanTask.spec.ts Updates the fs-extra.remove mock to be promise-based.
packages/just-scripts/src/tasks/tests/copyTask.spec.ts Preloads p-limit in beforeAll to avoid ESM load issues under mock-fs.
change/change-21b37dad-e52f-40ef-937e-eb775c98f1e9.json Adds a Beachball change file documenting the dependency/task updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace run-parallel-limit with p-limit

3 participants