lerna exec, lerna run and scoping#152
Conversation
As opposed to 'lerna run', which runs scripts defined in package.json, exec will let you execute an inbuilt npm command directly in each package, e.g. - `lerna exec rebuild` - `lerna exec publish` - `lerna exec upgrade`
It should run any command, not just an npm command.
…xec-lerna-run-and-restrict
…and' into lerna-exec-lerna-run-and-restrict
| import Command from "./Command"; | ||
| import minimatch from "minimatch"; | ||
|
|
||
| export default class ScopedCommand extends Command { |
There was a problem hiding this comment.
I don't know if inheritance is the best way to solve this. It should be just as easy to have a util that does this and it will get us away from using inheritance which complicates things
There was a problem hiding this comment.
I think it is the perfect problem to be solved by inheritance. Especially as then the concerns are also clearly separated for the tests as well, but I am happy to change it to whatever form you like it in order to get it integrated. Would you like me to change it to a helper?
|
I do like the |
|
@thejameskyle is there anything I can do to help this getting integrated into lerna? Would you like to me to change the inheritance-based code into a helper? |
|
Sorry, I've fallen behind on reviewing PRs because of other stuff going on right now. I would personally prefer using a helper for created a scoped set of packages using mini-match. The only reason I'm using inheritance today is to create a shared interface for every command. |
|
@thejameskyle I changed the implementation to use a helper. Just on a side note, I think it was a bit cleaner with inheritance. Anyway, the changes are in 5dd9e9f - I hope that brings it in a mergeable state. |
|
I'd love to be able to use this functionality. Is there anything I can do to help here? |
|
@paulyoung I don't think so - last time I talked to @thejameskyle he was just preoccupied with other things - maybe that little github email nudge will bring him back 😉 |
lol, I don't think you understand how many notifications I get 😜 I'm happy with this |
|
Awesome! @joscha can you do a doc pr (or i'll do it later) |
|
@hzoo will do one - give me a few minutes! |
|
Reopen please --scope is not working on "lerna": "^3.4.0" npm run this "build:dep": "lerna run --scope common build" I get lerna ERR! EFILTER No packages remain after filtering [ 'common' ] my Lerna file |
|
@acostaf please open a new issue with complete reproduction details, thanks |
|
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This introduces an abstract command named
ScopedCommandwhich adheres to a given CLI flag namedscopethat allows to scope thelerna runandlerna execcommand (I pulled both #145 and #151) into this PR to a subset of packages by giving a glob that matches the package name.After merging this, the following can be used:
lerna run --scope my-component-* prepublishlerna exec --scope my-component-* -- ls -la node_modulesfixes #143
closes #145
fixes #150
closes #151
@thejameskyle PTAL
@eirslett @jpnelson FYI