-
Notifications
You must be signed in to change notification settings - Fork 586
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
[rush] Manage multiple autoinstallers more easily #3789
base: main
Are you sure you want to change the base?
[rush] Manage multiple autoinstallers more easily #3789
Conversation
Hey, the PR looks good. I would go 1 step further tho, I would:
With this, the only options will be:
|
@isc30 I want to be careful about I also think
|
okay then it sounds good, I like having the option to do |
@isc30 I was looking at your example rush hook again and it feels like there is something missing there -- you want your repo to install all autoinstallers whenever people run install, and had to write custom hooks to do that. I think there's two possible approaches to fix that: (1) We could also add the missing command "install-autoinstaller" (just like update-autoinstaller, but just runs prepare). If this existed, you'd be able to get rid of your custom javascript script and just have an event hook:
(2) Another option would be if we think this is a reasonable boolean choice, maybe a configuration entry somewhere could be added -- Any thoughts @octogonz ? |
Yeah, my case was for I think |
@isc30 The new option |
Yeah I can change our onboarding docs to run In the past we couldn't do that as there wasn't a way to install autoinstallers from CLI |
@@ -153,6 +159,14 @@ export abstract class BaseInstallAction extends BaseRushAction { | |||
try { | |||
await installManager.doInstallAsync(); | |||
|
|||
if (this._autoinstallersParameter.value) { | |||
if (installManagerOptions.allowShrinkwrapUpdates) { | |||
Autoinstaller.updateAutoinstallers(this.rushConfiguration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorta odd that this one is sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I'll see what happens if I make it async, might be worth it it to safeguard against future need for async methods.
return; | ||
} | ||
|
||
console.log(colors.green(`\n${autoinstallerNames.length} autoinstaller(s) prepared.`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "prepare" mean in this context? I'm not sure a user is going to understand that.
const autoinstaller: Autoinstaller = new Autoinstaller({ | ||
autoinstallerName, | ||
rushConfiguration | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this error if the named autoinstaller doesn't exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- it treats it essentially like a series of steps, for example:
rush update-autoinstaller --name good1 --name good2 --name oops
Assuming oops
is a misspelled autoinstaller name, the command would update good1, good2, and then dump out with the typical error. The user could then re-run the command (fixing the mistake), and it would end up printing: 2 autoinstallers skipped, 1 autoinstaller updated (since good1 and good2 had just been updated by the last run).
It would probably be a smidge nicer of an experience if we completely wrapped up (skips, successes, failures) in a bow and presented them, but failing install on an autoinstaller is unusual enough that it seemed unnecessary for this PR.
May I suggest |
@Faithfinder Ah so, I'm beginning to wonder if "--autoinstallers" is too brief/vague and it should be "--include-autoinstallers", to make it clear that the command in each situation does what it normally does, just also does it for autoinstallers. |
Yep! |
Summary
A small pile of quality-of-life improvements for dealing with autoinstallers:
rush update-autoinstaller --name folder1 --name folder2
rush update-autoinstaller --all
rush update --autoinstallers
rush install --autoinstallers
Fixes #3743.
Details
Updating multiple autoinstallers
Following in the vein of
rush add
, you can now provide the--name
parameter multiple times when updating an autoinstaller. Useful for specifically targeting 2 or more autoinstaller folders.The output of the
update-autoinstaller
command has been updated to provide a summary of the autoinstallers that were updated and what new lockfiles should be committed to source control.rush update-autoinstaller --name rush-plugins --name rush-prettier
Updating all autoinstallers
When your monorepo reaches 4-5 autoinstallers, it becomes easier to simply "mass update" them and evaluate the result of the command (ensuring it matches your expectations) rather than typing out specific folder names.
rush update-autoinstaller --all
Convenience method: update + autoinstaller update
After a maintenance update frenzy, with multiple package.json changes spread across project and autoinstaller folders alike, a single command to make sure everything is updated is a nice time saver.
New functionality: prepare all autoinstallers
A sibling command for
rush update --autoinstallers
,rush install --autoinstallers
is unique in that it provides a feature that doesn't exist in Rush today: a way to prepare all of your autoinstallers for use (without waiting until someone actually calls a related rush global command defined incommand-line.json
).This is very useful for situations where processes outside of Rush's control expect autoinstallers to be up-to-date. A great example is the common
common/autoinstallers/rush-prettier
autoinstaller, which might also be used by VSCode, WebStorm, etc. If you've upgraded prettier or added new prettier plugins to your autoinstaller,rush install --autoinstallers
can immediately fix "Missing plugin" errors for your VSCode developers.How it was tested
Example screenshots
"rush update --autoinstallers":