Skip to content

[rush] Add 'myrush' binary that invokes globally installed Rush version #1771

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

darsi-an
Copy link
Contributor

@darsi-an darsi-an commented Mar 8, 2020

I bypass version selector just checking if command name is 'myrush'. If not it continues with its expected behavior. Let me know if i'm going about it correctly.

WIP (Please comment if I need to add any more)

  • Print errors for 'rush' init if not latest rush

Questions

  • Running rush init --overwrite-existing will still use an older version from rush.json. Is this necessary?
  • Init action with --overwrite-existing, overwrites everything. What if you just want to update versions in the rush.json to the globally installed Rush version, without overwriting other properties?

Also am I debugging correctly? Below are my launch configs for rush and myrush binaries

{
	"type": "node",
	"request": "launch",
	"name": "myrush install",
	"program": "${workspaceRoot}/apps/rush/bin/myrush",
	"cwd": "C:\\dev\\rush-example",			
	"args": ["install"]
},
{
	"type": "node",
	"request": "launch",
	"name": "rush install",
	"program": "${workspaceRoot}/apps/rush/bin/rush",
	"cwd": "C:\\dev\\rush-example",
	"args": [ "install"]
}

This PR will close #1475

@iclanton
Copy link
Member

Running rush init --overwrite-existing will still use an older version from rush.json. Is this necessary?

You mean if you have an older version installed globally? We should probably print a warning in that case. Maybe we just shouldn't let that happen? However, I could see someone wanting to be able to easily downgrade a repo. @octogonz - what do you think?

Init action with --overwrite-existing, overwrites everything. What if you just want to update versions in the rush.json to the globally installed Rush version, without overwriting other properties?

I think for this, we'd want to consider putting together a formal upgrader. Unfortunately, there are tons of cases to consider. It currently overwrites everything because an upgrader would be difficult to write and we weren't sure how much use it would get.

Also am I debugging correctly?

Yeah that looks right to me, assuming your VSCode window is open to the repo root.

I usually run node --inspect-brk <path-to-start.js> <args> and then attach the debugger, but that's probably more complex than is actually necessary.

@darsi-an
Copy link
Contributor Author

darsi-an commented Mar 15, 2020

You mean if you have an older version installed globally?

Currently if rush.json version is higher than the globally installed version, Rush will install it for you.

In the case where your rush.json version is lower than that installed globally, rush init --overwrite-existing would use the older version when it overwrites the rush.json b/c of the variable expansion.

Are there any other cases for the rush init --overwrite-existing other than just for upgrading a repo to a newer release of Rush (based off the CLI help)? If we do want to support downgrading It would be best to print a warning. We should also probably update the CLI help, so users don't get confused.

@halfnibble halfnibble self-assigned this May 27, 2020
@octogonz
Copy link
Collaborator

octogonz commented Jun 9, 2020

FYI we recently reformatted the master branch using Prettier, which creates merge conflicts for existing PRs. We'll try to fix up the existing PRs for people, but if you want to do it yourself, here's the steps:

  1. Run "npm install -g prettier@2.0.5" to install Prettier.
  2. Merge the "release/master-before-prettier" branch into your PR branch. This is the state of the world before Prettier was applied.
  3. Merge the "release/master-after-prettier" branch into your PR branch. This will create a merge conflict with the Prettier changes, and nothing else.
  4. Resolve all the merge conflicts by discarding "origin", and overwriting with your branch's changes.
  5. BEFORE committing the merge, run "prettier . --write" from the repo root to reapply the formatting (that you discarded in step 4).
  6. Make sure to restage everything.
  7. Commit the merge
  8. Now you should be able to merge from the real "master" without any (Prettier-related) merge conflicts

@darsi-an
Copy link
Contributor Author

Rush init was updated with #1956

@darsi-an darsi-an changed the title [rush] Update rush init and add 'myrush' binary that invokes globally installed Rush version [rush] Add 'myrush' binary that invokes globally installed Rush version Jun 27, 2020
@darsi-an darsi-an changed the title [rush] Add 'myrush' binary that invokes globally installed Rush version [rush] ~~Update rush init and~~ Add 'myrush' binary that invokes globally installed Rush version Jun 27, 2020
@darsi-an darsi-an changed the title [rush] ~~Update rush init and~~ Add 'myrush' binary that invokes globally installed Rush version [rush] Add 'myrush' binary that invokes globally installed Rush version Jun 27, 2020
@darsi-an
Copy link
Contributor Author

darsi-an commented Aug 4, 2020

  1. When the repos rush.json version is greater than the globally installed rush version
  • The "rush" binary will install it (if it is not already) and use the version specified in the repos rush.json
  • The "myrush" binary will throw errors and suggest upgrading the library.
  1. When the repos rush.json version is lower than the globally installed rush version
  • The "rush" binary will use the repos rush.json version
  • The "myrush" binary will use the globally installed version

As suggested in #1475 I have updated the error messages a bit.

@octogonz is there any thing else I should consider?

@octogonz octogonz requested a review from dmichon-msft as a code owner April 22, 2023 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[rush] Rush init should use newer versions?
4 participants