-
Notifications
You must be signed in to change notification settings - Fork 681
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
Add install command support for package version #2161
Conversation
Uh oh! @realies, do you need any help with this? |
Alright so after chatting on IRC, documenting here steps to clean this PR in case it helps. You'll notice that your PR says: "This branch has conflicts that must be resolved - Conflicting files: To fix this, you need to change your commits so it only contains your stuff. Note that all that follows has to happen in your terminal, not on the GitHub UI, so make sure you are in a terminal, you ran
Let me know how this goes! |
@astorije, the |
packageJson(packageName, { | ||
fullMetadata: true, | ||
version: packageVersion, |
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.
Kinda sad we have to split this ourselves since most commands in the yarn/npm CLIs support passing version after @
.
@realies, maybe open an issue on https://github.com/sindresorhus/package-json to see if they'd be open to also supporting packageJson("my-package@something")
?
That way, all potential edge cases of version parsing would be handled there.
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.
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.
Thanks @realies!
@@ -71,7 +76,7 @@ program | |||
"--non-interactive", | |||
"--cwd", | |||
packagesPath, | |||
`${packageName}@${json.version}`, | |||
`${json.name}@${json.version}`, |
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.
I know this is not your doing but I'm just trying to clarify something with one of @thelounge/maintainers: is this way of passing the name (instead of just packageName
) because we explicitly want to pass @latest
? It doesn't work correctly without specifying dist-tag or version?
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.
We used to support it. Then it was removed. Pretty sure I mentioned this at the time. Will check when letter.
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.
Yeah, so looking at this thread, it looks like I was confused by this change, but I think I understand it now 😅
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.
It's used to specify the exact version that exists in the NPM registry. Before this PR it looked up latest
via the API, and put that version in the command. This PR adds support for installing other versions or tags, as they are all looked up via the api.
Perhaps also replace
packageName
tojson.name
(if available) after line 33.