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

Support node --run #1169

Merged
merged 7 commits into from
Aug 22, 2024
Merged

Support node --run #1169

merged 7 commits into from
Aug 22, 2024

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Aug 22, 2024

Adds support for the new node --run feature which is available starting in Node 22 (basically npm run but faster, see https://nodejs.org/en/blog/announcements/v22-release-announce#running-packagejson-scripts and https://www.yagiz.co/developing-fast-builtin-task-runner/).

Note that node --run is stricter than the other runners when it comes to distinguishing between arguments for the runner vs the script, so an additional -- is needed to set wireit flags and script flags (explained in the README).

Thank you very much to @anonrig for adding the environment variables this required (nodejs/node#53032, nodejs/node#53058) and @justinfagnani for filing the issue (nodejs/node#52673)!

There is a problem with recursive invocations on Windows that I believe is a Node bug but need to double-check, tracking at #1168.

Fixes #1094

Reviewer: the "Refactor tests a bit" commit is pretty noisy, but you can take my word it's a no-op :)

Copy link

@anonrig anonrig left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@justinfagnani justinfagnani left a comment

Choose a reason for hiding this comment

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

🎉

README.md Outdated
between arguments intended for `node`, `wireit`, and the script itself:

```sh
node --run build -- -- --verbose
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be more clear to add a small template of who's args go where. Maybe something like:

node {node args} --run <script> -- {script args} -- {wireit args}

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, added general forms for npm and node --run.

@aomarks aomarks merged commit 66338d2 into main Aug 22, 2024
20 checks passed
@aomarks aomarks deleted the node-run branch August 22, 2024 21:48
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.

Wireit fails when invoked via node --run
3 participants