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

fix: Run dedupe during upgrade on yarn 3 #5458

Merged
merged 3 commits into from
May 9, 2022

Conversation

callingmedic911
Copy link
Member

@callingmedic911 callingmedic911 commented May 6, 2022

This PR changes yarn rw upgrade to run yarn dedupe for projects on Yarn 3. Right now, the dedupe step is skipped if yarn version is higher than 1.

@thedavidprice also pointed this out earlier but for some reason, I thought we already have the required changes. #4940 (comment)

@callingmedic911 callingmedic911 self-assigned this May 6, 2022
@netlify
Copy link

netlify bot commented May 6, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit d1f9801
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/62794a6a26d2ba000914e3b6

@dac09
Copy link
Collaborator

dac09 commented May 8, 2022

I think yarn 3 automatically does deduping though, doesn't it?

@jtoar jtoar enabled auto-merge (squash) May 9, 2022 17:12
[...npxArgs, 'yarn-deduplicate'],
baseExecaArgsForDedupe
)
}
} catch (e) {
console.log(c.error(e.message))
throw new Error(
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can print the correct command based on the yarn version?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can but if for some reason regex fails for semver, that's why I kept it one simple catch.

Copy link
Collaborator

@dac09 dac09 May 9, 2022

Choose a reason for hiding this comment

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

The one catch is fine, but just suggesting printing different messages

if (yarnVersion > 1) {
 console.log('Failed dedupe step. Run yarn dedupe')
} else {
  console.log('Failed dedupe. run npx yarn-deduplcate')
}

@jtoar jtoar merged commit 905b999 into redwoodjs:main May 9, 2022
@jtoar jtoar added this to the next-release milestone May 9, 2022
@callingmedic911 callingmedic911 deleted the fix/run-dedupe-on-yarn-3 branch May 9, 2022 17:37
Comment on lines +291 to +293
if (yarnVersion > 1) {
await execa('yarn', ['dedupe'], baseExecaArgsForDedupe)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

yarn dedupe was added in v2.2.0 so there is a chance it isn't a valid command.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah gotcha. Great catch—we don't expect users to be on yarn 2, but to be fair we don't have any documentation / checks around that fact, so there's some work to do here. A while back Danny had asked me to make a simple utility for running yarn commands given that we have to support two versions; it's probably time for me to revisit that.

jtoar added a commit that referenced this pull request May 10, 2022
dac09 added a commit to dac09/redwood that referenced this pull request May 10, 2022
…ctmode-gen

* 'main' of github.com:redwoodjs/redwood:
  Update yarn.lock
  fix(deps): update graphql-tools monorepo (redwoodjs#5487)
  v1.3.2
  Update yarn.lock
  fix: Run dedupe during upgrade on yarn 3 (redwoodjs#5458)
  Fix/ts resolvers type (redwoodjs#5437)
  fix(deps): update dependency graphql to v16.5.0 (redwoodjs#5488)
  fixed typo of roll to role (redwoodjs#5484)
  fix(deps): update typescript-eslint monorepo to v5.23.0 (redwoodjs#5489)
  chore(deps): update dependency cypress to v9.6.1 (redwoodjs#5482)
  chore(deps): update dependency firebase to v9.8.1 (redwoodjs#5485)
  fix(deps): update dependency @types/aws-lambda to v8.10.97 (redwoodjs#5486)
  chore(deps): update dependency @nhost/nhost-js to v1.1.10 (redwoodjs#5479)
  chore(deps): update dependency @nhost/hasura-auth-js to v1.1.5 (redwoodjs#5478)
  Fixing type for BrowserOnly children (redwoodjs#5475)
  fix: Run dedupe during upgrade on yarn 3 (redwoodjs#5458)
  Fix/ts resolvers type (redwoodjs#5437)
jtoar added a commit that referenced this pull request May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix topic/cli
Projects
Status: Archived
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants