Skip to content
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

feat: add yarn v2+ support #39

Merged
merged 19 commits into from
Mar 4, 2024
Merged

feat: add yarn v2+ support #39

merged 19 commits into from
Mar 4, 2024

Conversation

redabacha
Copy link
Contributor

resolves #32

@CLAassistant
Copy link

CLAassistant commented Mar 3, 2024

CLA assistant check
All committers have signed the CLA.

@redabacha redabacha marked this pull request as draft March 3, 2024 14:22
package.json Outdated
@@ -47,6 +47,7 @@
},
"dependencies": {
"kolorist": "^1.8.0",
"latest-version": "^5.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pulls in a total of 19 dependencies to do a simple fetch call, see https://npm.anvaka.com/#/view/2d/latest-version . That's a bit much to fetch some json from the npm api.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep i agree, added this just to get it to work but will look into replacing this with something better

Copy link
Contributor Author

@redabacha redabacha Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've changed it now so it pulls the latest version from the meta.json given by the jsr using fetch. let me know if you think it's a good idea or not.

@redabacha redabacha marked this pull request as ready for review March 3, 2024 21:00
Copy link
Collaborator

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start, thanks for tackling this 👍 Left some minor comments. Let me know what you think.

Comment on lines 20 to 26
function modeToFlagYarn(mode: InstallOptions["mode"]): string {
return mode === "dev"
? "--dev"
: mode === "optional"
? "--optional"
: "";
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn berry does not respect the --save-dev and --save-optional flags unlike npm + pnpm. bun also has the same problem, it only understands the yarn style --dev and --optional flags but it's arguably worse than yarn as it doesn't throw errors when an unrecognized flag is passed in. additionally, if bun supported the shorthand for --optional (-O) then we wouldn't need this at all as all the package managers currently understand the shorthand form for installing a dev dependency (-D).

@marvinhagemeister
Copy link
Collaborator

marvinhagemeister commented Mar 4, 2024

CI failure is unrelated to the changes in this PR. Not sure why it's different on windows yet.

@redabacha
Copy link
Contributor Author

CI failure is unrelated to the changes in this PR. Not sure why it's different on windows yet.

maybe not actually, it's resolving @std/encoding@npm:@jsr/std__encoding@^0.218.2 to @std/encoding@npm:@jsr/[email protected] on windows for the yarn berry test. i think it might be a powershell problem?

@redabacha
Copy link
Contributor Author

i added a potential fix to wrap the command arguments in double quotes on windows (works for both powershell and cmd) and single quotes elsewhere.

Copy link
Collaborator

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thank you so much for adding this! 🙌

@marvinhagemeister marvinhagemeister merged commit 7fb628d into jsr-io:main Mar 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

yarn dlx jsr add does not work when following Yarn 2 & jsr basic setup docs
3 participants