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

Placeholder that unfolds into multiple tasks #134

Merged
merged 6 commits into from
May 17, 2024

Conversation

voxpelli
Copy link
Collaborator

@voxpelli voxpelli commented Mar 13, 2024

What is it?

This adds a new placeholder, {%}, which unfolds into multiple tasks – one for each input argument. The unfolded tasks gets assigned {1}, {2} etc instead of {%}.

Purpose

Be able to in parallell process a single npm task X times with a different argument each time.

Example

{
  "minimize-image": "some-cli-command",
  "build:image": "run-p 'minimize-image -- {%}' -- ./foo.png ./bar.png"
}

Same as:

run-p 'minimize-image -- ./foo.png' 'minimize-image -- ./bar.png'

Example using shell globbing

{
  "minimize-image": "some-cli-command",
  "build:image": "run-p 'minimize-image -- {%}' -- ./images/*.png"
}

Remains to move out of draft status:

  • Tests
  • Documentation
  • Passing CI

Originally submitted at: mysticatea/npm-run-all#180

@voxpelli voxpelli self-assigned this Mar 13, 2024
This adds a new placeholder, {%}, which unfolds into multiple tasks – one for each input argument. The unfolded tasks gets assigned {1}, {2} etc instead of {%}.

Purpose:

Be able to in parallell process a single npm task X times with a different argument each time.

Originally submitted at: mysticatea/npm-run-all#180
@bcomnes
Copy link
Owner

bcomnes commented Mar 13, 2024

Neat!

@voxpelli voxpelli marked this pull request as ready for review May 14, 2024 11:16
Copy link
Owner

@bcomnes bcomnes left a comment

Choose a reason for hiding this comment

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

lgtm. Any chance this will clobber existing commands people have set up?

@voxpelli
Copy link
Collaborator Author

Any chance this will clobber existing commands people have set up?

Shouldn't be. If people are using custom placeholders and expecting them to pass through, then that would be an extreme edge case :)

@voxpelli voxpelli merged commit 1816408 into master May 17, 2024
18 checks passed
@voxpelli voxpelli deleted the feature/unfold-task-to-multiple-tasks branch May 17, 2024 08:21
voxpelli added a commit to mochajs/mocha that referenced this pull request Jun 17, 2024
Thanks to the unfolding placeholder in npm-run-all2 6.2.0:  bcomnes/npm-run-all2#134
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.

2 participants