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

Yarn2: Use workspace:* versions #15413

Closed
wants to merge 10 commits into from
Closed

Yarn2: Use workspace:* versions #15413

wants to merge 10 commits into from

Conversation

shilman
Copy link
Member

@shilman shilman commented Jun 29, 2021

What I did

--

Commands for the release:

# Record the requested upgrade in `.yarn/versions/xxx`
yarn workspaces foreach --all version prerelease --deferred

# Apply the version upgrades to all packages (also update version of peer deps on local packages)
yarn version apply --all

# Release the Kraken
yarn workspaces foreach --parallel --no-private npm publish 

## Pack
# yarn workspaces foreach --parallel --no-private pack 

@shilman shilman changed the title Yarn: Use workspace:* versions Yarn2: Use workspace:* versions Jun 29, 2021
@nx-cloud
Copy link

nx-cloud bot commented Jun 29, 2021

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3fc8bdd. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx run-many --target=prepare --all --parallel=2 --max-parallel=15 -- --optimized

Sent with 💌 from NxCloud.

addons/docs/package.json Show resolved Hide resolved
addons/docs/package.json Outdated Show resolved Hide resolved
addons/toolbars/package.json Show resolved Hide resolved
.yarnrc.yml Outdated Show resolved Hide resolved
@gaetanmaisse gaetanmaisse added the maintenance User-facing maintenance tasks label Jul 8, 2021
lib/core/package.json Outdated Show resolved Hide resolved
scripts/run-registry.ts Outdated Show resolved Hide resolved
@hydrosquall
Copy link
Contributor

One thing to keep an eye out after this change is that several lerna commands don't work if workspace:* versions are used. I noticed this while setting up auto in a monorepo. This may be a non issue if you're using nx / other tools to manage the repo.

lerna/lerna#2564

However, there is an in-progress PR adding this: lerna/lerna#2450

@gaetanmaisse
Copy link
Member

gaetanmaisse commented Jul 16, 2021

@hydrosquall You're 💯 true and some of the changes in this PR are replacements of Lerna commands by Yarn 2 ones or simplification in the scripts. I still need to figure out how to make our build script working again and I guess Lerna won't be used anywhere.

Also, we have a strange behavior running yarn workspaces foreach -all version prerelease --deferred, everything is ok on my machine but on @shilman's one it just stops after updating the version for the root package 🤔 I think I will need to discuss with @merceyz to see what I'm doing wrong

@merceyz
Copy link
Contributor

merceyz commented Jul 16, 2021

it just stops after updating the version for the root package 🤔 I think I will need to discuss with @merceyz to see what I'm doing wrong

Fixed in yarnpkg/berry#2255 / 3.0.0-rc.1

yarn set version 3.0.0-rc.9 && yarn plugin import constraints && yarn plugin import version && yarn plugin import workspace-tools && yarn plugin import typescript

@gaetanmaisse
Copy link
Member

Thanks @merceyz! I was staying on Yarn 2.4.2 because of some issues with portal: protocol (like the react@null issue we discussed on Discord), I'm on holiday for a few more days, I'll try again the 3.0.0-rc.9 when I get back 😉

@gaetanmaisse gaetanmaisse force-pushed the refine-yarn-usage branch 3 times, most recently from 6ee1036 to 235adae Compare August 3, 2021 20:34
package.json Outdated
"dev:tsc": "lerna exec --scope \"@storybook/*\" --parallel -- cross-env-shell node \\$LERNA_ROOT_PATH/scripts/utils/watch-tsc.js",
"dev": "echo \"This command is deprecated and will be removed soon, please use `yarn build` instead\"",
"dev:babel": "echo \"This command is deprecated and will be removed soon, please use `yarn build` instead\"",
"dev:tsc": "echo \"This command is deprecated and will be removed soon, please use `yarn build` instead\"",
"github-release": "github-release-from-changelog",
"lint": "yarn lint:js . && yarn lint:md .",
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives",
"lint:js": "NODE_ENV=production eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives",

You can remove cross-env since Yarn has its own portable shell

Copy link
Member

Choose a reason for hiding this comment

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

Neat! I will take a look at all cross-env usages across the monorepo

@gaetanmaisse
Copy link
Member

@shilman I think we will be able to give one more try to the updated release process 😄

@shilman
Copy link
Member Author

shilman commented Aug 4, 2021

@gaetanmaisse my forehead's almost healed from the last time we tried to do anything together 🤕 so just let me know whenever is good for you 😂

@gaetanmaisse gaetanmaisse marked this pull request as ready for review August 9, 2021 09:59
@arcanis
Copy link
Contributor

arcanis commented Oct 26, 2021

Quick note: we now support workspace:^ which does the same as workspace:*, except that on publish Yarn will turn it into ^x.y.z rather than x.y.z (with x.y.z being the true version).

@stale
Copy link

stale bot commented Jan 9, 2022

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 9, 2022
# Conflicts:
#	.yarn/releases/yarn-sources.cjs
#	.yarnrc.yml
#	addons/a11y/package.json
#	addons/actions/package.json
#	addons/backgrounds/package.json
#	addons/controls/package.json
#	addons/docs/package.json
#	addons/essentials/package.json
#	addons/jest/package.json
#	addons/links/package.json
#	addons/measure/package.json
#	addons/outline/package.json
#	addons/storyshots/storyshots-core/package.json
#	addons/storyshots/storyshots-puppeteer/package.json
#	addons/storysource/package.json
#	addons/toolbars/package.json
#	addons/viewport/package.json
#	app/angular/package.json
#	app/ember/package.json
#	app/html/package.json
#	app/preact/package.json
#	app/react/package.json
#	app/server/package.json
#	app/svelte/package.json
#	app/vue/package.json
#	app/vue3/package.json
#	app/web-components/package.json
#	docs/versions/next.json
#	examples/angular-cli/package.json
#	examples/cra-kitchen-sink/package.json
#	examples/cra-react15/package.json
#	examples/cra-ts-essentials/package.json
#	examples/cra-ts-kitchen-sink/package.json
#	examples/ember-cli/package.json
#	examples/html-kitchen-sink/package.json
#	examples/official-storybook/package.json
#	examples/preact-kitchen-sink/package.json
#	examples/react-ts-webpack4/package.json
#	examples/react-ts/package.json
#	examples/server-kitchen-sink/package.json
#	examples/standalone-preview/package.json
#	examples/svelte-kitchen-sink/package.json
#	examples/vue-3-cli/package.json
#	examples/vue-cli/package.json
#	examples/vue-kitchen-sink/package.json
#	examples/web-components-kitchen-sink/yarn.lock
#	lerna.json
#	lib/addons/package.json
#	lib/api/package.json
#	lib/builder-webpack4/package.json
#	lib/builder-webpack5/package.json
#	lib/channel-postmessage/package.json
#	lib/channel-websocket/package.json
#	lib/cli-sb/package.json
#	lib/cli-storybook/package.json
#	lib/cli/package.json
#	lib/client-api/package.json
#	lib/codemod/package.json
#	lib/components/package.json
#	lib/core-client/package.json
#	lib/core-common/package.json
#	lib/core-server/package.json
#	lib/core/package.json
#	lib/manager-webpack4/package.json
#	lib/manager-webpack5/package.json
#	lib/router/package.json
#	lib/source-loader/package.json
#	lib/theming/package.json
#	lib/ui/package.json
#	package.json
#	scripts/build-package.js
#	scripts/run-registry.ts
#	yarn.lock
@stale stale bot removed the inactive label Jun 30, 2022
@ndelangen
Copy link
Member

@shilman @gaetanmaisse @merceyz I did my best to get this updated with next but... it wasn't easy, and I'm 100000% sure stuff is broken now.

What the course of action here? Are we proceeding? Are we taking this and redo-ing it on future/base? Are we abandoning this approach?

Let's make this PR a draft, and discuss if it's salvageable?

@ndelangen ndelangen marked this pull request as draft June 30, 2022 22:21
@ndelangen
Copy link
Member

Also ping-ing @arcanis And @hydrosquall ☝️

Can you tell me what the roadmap is for this PR?

@gaetanmaisse
Copy link
Member

I also tried to update it a few weeks ago, a nightmare and at the end it wasn't working anymore.

What the course of action here? Are we proceeding? Are we taking this and redo-ing it on future/base? Are we abandoning this approach?

I've in mind to try to redo it on future/base, but maybe it makes more sense to deal with the examples first? wdyt @ndelangen

@ghiscoding
Copy link

@shilman and everyone else, you could finish this PR by switching to Lerna-Lite which did add support to workspace: protocol. I created the Lerna-Lite fork, when Lerna was largely unsupported, and I also recently switched the project itself to pnpm with workspace: protocol and everything is working great. So if you want to complete this PR, just switch to Lerna-Lite 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants