Skip to content

chore: Move to yarn 4 and workspaces#10321

Open
ibgreen-openai wants to merge 10 commits into
masterfrom
ib/yarn-4-workspace
Open

chore: Move to yarn 4 and workspaces#10321
ibgreen-openai wants to merge 10 commits into
masterfrom
ib/yarn-4-workspace

Conversation

@ibgreen-openai
Copy link
Copy Markdown
Collaborator

@ibgreen-openai ibgreen-openai commented May 20, 2026

Summary

Migrates deck.gl to Yarn 4.15 workspaces with nodeLinker: node-modules, and installs all package-managed examples from the repo root.

image

Motivations

  • yarn 1 is ancient, time to move on, install and CI times will be meaningfully improved.
  • the fact that the examples do not have lock files is what causes problems in corporate environments that prevent recent high risk packages from being installed.
  • Having a common lock file through the workspace solves this elegantly
  • the development experience is much improved, a quick install and any example is ready to go. We can add website and test apps next.
  • We have moved to yarn 4 and workspaces in most of the other repos (luma, loaders, deck-community, ...) so this is aligned with that.

Changes

  • Set root packageManager to yarn@4.15.0.
  • Added .yarnrc.yml with:
    • enableScripts: true
    • nodeLinker: node-modules
    • targeted Yarn peer-warning filters for known legacy/third-party peer noise.
  • Expanded root workspaces from modules/* to:
    • modules/*
    • examples/**
  • Converted internal deck.gl / @deck.gl/* example deps to workspace:*.
  • Added/fixed example workspace metadata and duplicate names.
  • Kept Lerna publish/build scope limited to modules/*.
  • Updated docs and example READMEs to use one root yarn install.
  • Regenerated yarn.lock with Yarn 4.15.
  • Updated stale internal @deck.gl/* peer ranges from ~9.3.0-alpha.1 to ~9.3.0-beta.2.

Verification

  • corepack yarn --version -> 4.15.0
  • corepack yarn install --mode=skip-build
  • corepack yarn install --immutable --mode=skip-build
  • corepack yarn workspaces list --json
    • 81 total workspaces
    • 64 examples
    • 16 modules
    • 0 duplicate names
  • corepack yarn test-fast
  • Representative example builds:
    • deckgl-example-react-basic
    • deckgl-example-pure-js-basic
    • deckgl-examples-scatterplot
    • deckgl-examples-gallery

Notes

Plain yarn install runs the existing root postinstall script (npx playwright install chromium). Lockfile verification used --mode=skip-build to avoid browser-install side effects during validation.


Note

Medium Risk
Touches all install/CI/release paths and dependency resolution across modules and many examples; incorrect workspace or resolution pins could break builds or publishing, though runtime library changes are minimal (one S2 helper return type).

Overview
Upgrades the monorepo from Yarn 1 to Yarn 4.15 with node-modules linking and a root packageManager pin, adding .yarnrc.yml (scripts enabled, peer-warning filters) and ignoring .yarn/ in git.

Workspaces now include examples/** alongside modules/*, so examples install from one root lockfile; bootstrap no longer runs yarn itself, and CI/release/website flows use corepack enable, yarn install --immutable, then yarn bootstrap (dropping setup-node’s yarn cache). The website keeps its own Yarn 4 config and uses immutable installs in test-website / deploy steps; gallery build scripts rely on the root install instead of per-folder yarn.

Root resolutions pin all @deck.gl/* / deck.gl to 9.3.0-beta.2; example package.json files get small metadata/order fixes. getIdFromToken in s2-utils returns a string id (via Long.toString()) instead of a Long object. Minor tooling tweaks: Docusaurus source-map rule excludes node_modules, jupyter-widget build script split, and a mapbox default-import eslint comment in a get-started example.

Reviewed by Cursor Bugbot for commit 258145b. Bugbot is set up for automated code reviews on this repo. Configure here.

@ibgreen-openai ibgreen-openai changed the title chore Move to yarn 4 and workspaces chore: Move to yarn 4 and workspaces May 20, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented May 20, 2026

Coverage Status

coverage: 83.374% (+0.008%) from 83.366% — ib/yarn-4-workspace into master

@ibgreen-openai ibgreen-openai marked this pull request as ready for review May 21, 2026 12:57
Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

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

I'm not a fan of how fragile yarn tends to be - workspaces and compatibility issues with PnP can be frustrating to users. Also, it's currently easy to copy/paste an example into your own project to adopt deck, or codesandbox to reproduce a bug. I don't want to loss those adoption channels with the added complexity

What if we used npm 7? It has many of the same benefits as yarn, it's actively maintained (yarn v1 is quite old), and is very easy for users adopting deck to work with

// pad token with zeros to make the length 16
const paddedToken = token.padEnd(16, '0');
return Long.fromString(paddedToken, 16);
return Long.fromString(paddedToken, 16).toString();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's split this out

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I understand that having seemingly unrelated changes in a PR is annoying but this is related to typescript version being bumped as part of satisfying all the package.json.
To split this out I would need to make a separate PR to bump typescript and fix issue or downgrade typescript in other places.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just want to make sure we're thinking through the implications and covering bug fixes with tests. I'm only focusing on testing the build system in this PR

Comment thread modules/extensions/package.json

### Usage

Copy the content of this folder to your project.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The intent @Pessimistress shared with me years ago was that example folders are meant to be standalone so that they're easy to bring into you own projects.

Workspaces adds a layer of complexity for adopters, and I'm not convinced its the right direction to go

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We definitely don't have to use workspace version specifiers in the examples I get that might be a separate discussion point.

That said, the version specifiers in the examples are often out of date which doesn't exactly help user, and during alpha/beta release cycles it gets worse.

@ibgreen-openai
Copy link
Copy Markdown
Collaborator Author

I'm not a fan of how fragile yarn tends to be - workspaces and compatibility issues with PnP can be frustrating to users.

FWIW, this branch is not using PnP. Both root and website are configured with nodeLinker: node-modules, so Yarn writes a normal node_modules install. I’m removing the .pnp.* ignore entry.

I personally consider workspace installs a real "luxury", have personally not had issues with it in our other repos. Just fast reliable installs across the repo and CI.

Also, it's currently easy to copy/paste an example into your own project to adopt deck, or codesandbox to reproduce a bug. I don't want to loss those adoption channels with the added complexity

Agreed, I am removing the "workspace" version specifiers, that was a step too far.

What if we used npm 7? It has many of the same benefits as yarn, it's actively maintained (yarn v1 is quite old), and is very easy for users adopting deck to work with

I have no experience with recent npm but understand that it has improved a lot. Most projects I am familiar with seem to be going pnpm these days though.

I am not aware of anything we would gain by switching that is meaningully better than yarn 4 + workspaces, but if someone thinks it is worth it and wants to put in the work, I am not against it.

We do use yarn 4 + workspace in our other repos so that does make the experience a little more consistent for a multi-repo developer like myself.

@ibgreen-openai
Copy link
Copy Markdown
Collaborator Author

@chrisgervang Appreciate the comments! Addressed the bigger issues, and cleaned up the PR. File churn now down from 158 to 36 files!

Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback. I think it's important to keep the adoption simple, so I appreciate not using the workspace version specifiers.

Approving to unblock but I would prefer to split out the bug fix found by a typescript upgrade so its documented well and covered, and split out module beta upgrades

Comment on lines 25 to +28
"scripts": {
"watch": "npm run build -- --watch",
"build": "ocular-bundle ./src/index.js --output=./dist/index.js --globalName= --sourcemap --format=umd --externals=@jupyter-widgets/base",
"watch": "npm run build-bundle -- --watch",
"build": "npm run build-bundle",
"build-bundle": "ocular-bundle ./src/index.js --output=./dist/index.js --globalName= --sourcemap --format=umd --externals=@jupyter-widgets/base",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What does this change?

Comment thread modules/extensions/package.json
// pad token with zeros to make the length 16
const paddedToken = token.padEnd(16, '0');
return Long.fromString(paddedToken, 16);
return Long.fromString(paddedToken, 16).toString();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just want to make sure we're thinking through the implications and covering bug fixes with tests. I'm only focusing on testing the build system in this PR

uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm looking into if this increases build times

@chrisgervang
Copy link
Copy Markdown
Collaborator

Could you take a pass on the PR description before merging for anything that is out of date?

@chrisgervang
Copy link
Copy Markdown
Collaborator

I've asked the LLM to review installation times and this is what it found:

Job Install step This PR Other PRs Regression
test-node Install deps ~92s ~36s ~2.5x slower
test-website Install deps ~91s ~36s ~2.5x slower
test-python Install deps ~162s ~101s ~1.6x slower

Root cause: The cache: 'yarn' option was removed from actions/setup-node. Other PRs benefit from cached dependencies; without it, every run does a full network fetch.

Options to fix:

  1. Re-add cache: 'yarn' to actions/setup-node — it should auto-detect Yarn 4's cache path via yarn config get cacheFolder
  2. Add an explicit actions/cache step targeting .yarn/cache

The regression adds ~2-3 minutes of extra wall-clock time per CI run.

Resolved yarn.lock conflicts by regenerating lock files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 258145b. Configure here.

uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CI cache removed without replacement, causing slower builds

Medium Severity

The cache: 'yarn' option was removed from actions/setup-node across all CI workflows (test-node, test-website, test-python, release, website deploy) without adding any replacement caching mechanism such as actions/cache. PR discussion confirms this causes ~2.5x slower dependency install times on every CI run. While Yarn 4 may need different cache path configuration, the caching capability can be restored using actions/cache with the correct Yarn 4 global cache directory.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 258145b. Configure here.

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.

4 participants