antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

Support `node --run` #210

Open BoscoDomingo opened 4 months ago

BoscoDomingo commented 4 months ago

Clear and concise description of the problem

Node 22 introduced the --run flag, which allows it to run scripts in the same way npm, pnpm, yarn and bun do. It'd be nice to support this, since it seems to be significantly faster

Suggested solution

Add node --run to the list of options that the nr command can use

Alternative

No response

Additional context

No response

Validations

antfu commented 4 months ago

PR welcome - tho I don't know if there is way we could detect that

BoscoDomingo commented 3 months ago

PR welcome - tho I don't know if there is way we could detect that

@antfu I would assume that first checking if Node >= 22. After that, maybe ask users if they prefer to use whatever package manager they use, or node --run. If they use npm, I would turn it on by default