lerna-lite / lerna-lite

Subset of Lerna in a smaller & more modular project. Helps manage and publish multiple packages in a monorepo/workspace structure
MIT License
472 stars 34 forks source link

Can we remove `@npmcli/run-script` dependency? #955

Closed longlho closed 3 weeks ago

longlho commented 3 weeks ago

Clear and concise description of the problem

I'm trying to remove all deps that have native dependency (node-gyp basically) and this uses @npmcli/run-script which uses node-gyp. Do we need that?

Suggested solution

invoke npm via bash?

Alternative

No response

Additional context

No response

Validations

ghiscoding commented 3 weeks ago

It was added by the original Lerna's author, but I don't think you can remove it since it run npm lifecycle scripts. If you use npm to run these scripts then you might fall into an infinite loop when the user has pre/post scripts and that is probably why it's not using npm directly. I would rather not touch that original code

https://github.com/lerna-lite/lerna-lite/blob/34c0f692c46b497b7066000747cdb3c750f5fbbf/packages/core/src/utils/run-lifecycle.ts#L36-L47

longlho commented 3 weeks ago

Is there a way to opt out?

ghiscoding commented 3 weeks ago

well no since it's a dependency of the project. Regardless Lerna-Lite should be installed as a dev dependencies so that shouldn't be a problem. Another side note of why @npmcli/run-script might be used instead of npm, the project has to remain cross-compatible so it can't just provide code that would just run on a single platform (like bash that you mentioned) because that would break on Windows.

I'm closing this since there's nothing to do here