GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: derive the workspace layout from pnpm-workspace.yaml only by sangwook-dev · Pull Request #3752 · meta/astryx

Conversation

@sangwook-dev

@sangwook-dev sangwook-dev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

pnpm-workspace.yaml becomes the single source of truth for the workspace layout, and the root package.json drops its workspaces array.

Four scripts already walked the packages: globs in pnpm-workspace.yaml, each carrying its own copy of the same loop. scripts/npm/setup-trusted-publishing.mjs even apologizes for it in a comment:

Ported from scripts/check-changesets.mjs discoverPackages() (which is NOT exported, so it is copied here).

apps/docsite/scripts/generate-data.mjs was the lone holdout, reading the root package.json workspaces array instead — and it was the only remaining reason that array existed. (packages/cli/src/utils/paths.mjs also reads pkg.workspaces, but findProjectRoot() has no callers anywhere in the repo and its tests build their own fixtures.)

This extracts the shared walk into scripts/lib/workspace-globs.mjs, points all five files at it, and deletes the array.

Two bugs fixed on the way

The copied regex was over-matching. /^\s*-\s*["']?([^"'\n]+)["']?/gm swept the entire YAML file rather than the packages: block, so it also picked up minimumReleaseAgeExclude's entry:

["apps/*", "packages/*", "packages/themes/*", "internal/*", "@astryxdesign/*"]
                                                             ^^^^^^^^^^^^^^^^

Five globs where the file declares four. Harmless only because @astryxdesign/ is not a real directory, so a downstream existsSync skipped it. Any future list item under overrides: or allowBuilds: that happened to name a real directory would have been walked as a workspace root. The replacement parse is line-based and scoped to the packages: block.

generate-data.mjs had a silent-empty failure mode. rootPkg.workspaces || [] meant a missing array yielded an empty package list, no exception, and a docsite build that shipped zero components. readWorkspaceGlobs() throws instead.

Verification

  • discoverPackageDirs() returns the same 13 directories before and after.
  • node apps/docsite/scripts/generate-data.mjs prints a byte-identical summary on this branch and on main: 8 packages, 219 components, 582 blocks (167 showcases, 448 examples), 40 templates, 18 doc topics, 3 blog posts, 6 themes.
  • check-changesets, format-changelogs --check, check-package-boundaries, and format-changelogs.test.mjs (8 tests) all pass.
  • pnpm install --frozen-lockfile still resolves all 26 workspace projects.
  • @manypkg/get-packages — what changesets uses to enumerate the workspace — still reports tool: pnpm with 25 packages, so removing the array does not affect release tooling.
  • The guard fires: a pnpm-workspace.yaml with no packages: block throws instead of returning [].

Note

scripts/ is outside the eslint ignore boundary, so these files get no lint coverage — the unused-import check after the refactor was done by hand.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sangwook-dev
sangwook-dev requested review from cixzhang, ejhammond, imdreamrunner, josephfarina, marie-lucas, nynexman4464, thedjpetersen and vjeux as code owners July 10, 2026 10:46
@vercel

vercel Bot commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 12, 2026 6:30am

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 10, 2026
@vercel
vercel Bot deployed to Preview July 10, 2026 10:49
View deployment
@sangwook-dev
sangwook-dev force-pushed the chore/workspace-globs-from-yaml branch from 7f4c7eb to 2583388 Compare July 11, 2026 12:30
@vercel
vercel Bot deployed to Preview July 11, 2026 12:33
View deployment
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 11, 2026
cixzhang
cixzhang reviewed Jul 12, 2026
View reviewed changes

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

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.

🟡 Maintainer judgment recommended — the change itself looks clean, but the branch has a merge conflict with main and can't be merged as-is.

Initial review pass (community contributor).

Blocking (mechanical): rebase needed. main has moved under this branch — both package.json and apps/docsite/scripts/generate-data.mjs were changed upstream after the branch point, and the PR reports CONFLICTING. Please rebase on latest origin/main and re-push; the review can't clear a branch that won't merge.

On the change itself (looks good): consolidating the four copied workspace-walking loops into scripts/lib/workspace-globs.mjs and dropping the redundant root package.json workspaces array is a solid cleanup. Two things I verified:

  • The line-based packages: parser correctly scopes to that block, fixing the prior regex that over-matched entries from minimumReleaseAgeExclude/overrides/allowBuilds.
  • The throw-on-empty guard in readWorkspaceGlobs closes the silent-empty failure mode in generate-data.mjs.
  • Remaining pkg.workspaces readers (packages/cli/src/utils/paths.mjs, scripts/verify-exports.mjs) are unaffected — findProjectRoot has no callers and verify-exports walks packages/ directly.

Please confirm the post-rebase verification still holds (discoverPackageDirs() → same 13 dirs; docsite generate-data byte-identical summary) since the conflict is in exactly those two files.


Recap — #3752 · chore: derive the workspace layout from pnpm-workspace.yaml only · @Han5991
What it does: makes pnpm-workspace.yaml the single source of truth for the workspace layout, extracting the shared glob-walk into one helper and removing the duplicated workspaces array.
Recommendation: Rebase on main to resolve the conflict, then re-review. No objections to the change on its merits.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sangwook-dev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@sangwook-dev
chore: derive the workspace layout from pnpm-workspace.yaml only
666efaf
Four scripts already walked the `packages:` globs in pnpm-workspace.yaml,
each with its own copy of the same loop — setup-trusted-publishing.mjs even
apologizes for it ("Ported from check-changesets.mjs, which is NOT exported,
so it is copied here"). apps/docsite/scripts/generate-data.mjs was the lone
holdout, reading the root package.json `workspaces` array instead.

Extract the shared walk into scripts/lib/workspace-globs.mjs, point all five
at it, and drop the now-unused `workspaces` array from the root package.json.

Fixes a latent bug in the copied regex. `/^\s*-\s*["']?([^"'\n]+)["']?/gm`
swept the whole file, not just the `packages:` block, so it also picked up
`minimumReleaseAgeExclude`'s `@astryxdesign/*` — five globs where the file
declares four. It was harmless only because `@astryxdesign/` is not a real
directory and got skipped by a downstream existsSync. Any future list item
that happens to name one would have been walked as a workspace root. The
replacement is line-based and scoped to the `packages:` block.

generate-data.mjs also lost its silent-empty failure mode. `rootPkg.workspaces
|| []` meant a missing array produced an empty registry, no exception, and a
docsite build that shipped zero components. readWorkspaceGlobs() throws.

Verified:
- discoverPackageDirs() returns the same 13 directories before and after.
- `node apps/docsite/scripts/generate-data.mjs` prints a byte-identical
  summary on this branch and on main (8 packages, 219 components, 582
  blocks, 40 templates, 18 doc topics, 3 blog posts, 6 themes).
- check-changesets, format-changelogs --check, check-package-boundaries,
  and format-changelogs.test.mjs (8 tests) all pass.
- `pnpm install --frozen-lockfile` still resolves all 26 workspace projects,
  and @manypkg (what changesets uses) still reports tool=pnpm with 25
  packages, so removing the array does not affect the release tooling.
@sangwook-dev
sangwook-dev force-pushed the chore/workspace-globs-from-yaml branch from 2583388 to 666efaf Compare July 12, 2026 06:28
@github-actions
github-actions Bot requested a review from cixzhang July 12, 2026 06:28
@sangwook-dev

sangwook-dev commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on latest main and re-pushed — the branch is MERGEABLE again.

The conflict was semantic, not just textual: #3858 landed resolveContentRoot() in the meantime, so discoverPackageDirs() must now expand against CONTENT_ROOT (live workspace on canary, materialized npm snapshot on latest), not REPO_ROOT. Resolution:

  • generate-data.mjs: discovery is now expandWorkspaceDirs(CONTENT_ROOT) — same helper, correct root for both targets.
  • resolve-content-root.mjs: the materialized snapshot now writes a synthetic pnpm-workspace.yaml (instead of a workspaces array in the synthetic package.json), so the snapshot keeps mirroring what a real monorepo declares post-this-PR. The cache stamp is bumped to v2: so pre-existing snapshots from the old layout get rebuilt rather than failing discovery.

Post-rebase verification (as requested):

  • discoverPackageDirs() parity on canary: old (workspaces-array walk against upstream/main's package.json) vs new (pnpm-workspace.yaml) → identical 13 dirs.
  • Full generate-data.mjs run, old scripts vs new scripts in the same tree, same content: src/generated/ output is byte-identical.
  • latest target end-to-end: DOCSITE_TARGET=latest materialized 0.1.4 from npm; the snapshot carries the synthetic pnpm-workspace.yaml and discovery surfaces the expected 8 published dirs (cli, core, 6 stable themes).
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview July 12, 2026 06:30
View deployment
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cixzhang
cixzhang approved these changes Jul 12, 2026
View reviewed changes
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 12, 2026
@cixzhang
cixzhang merged commit 79d73f3 into meta:main Jul 12, 2026
21 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@sangwook-dev
sangwook-dev deleted the chore/workspace-globs-from-yaml branch July 12, 2026 07:03

This branch was successfully deployed

1 active deployment
Preview — 666efaff Deployed Jul 12, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cixzhang cixzhang cixzhang approved these changes
@josephfarina josephfarina Awaiting requested review from josephfarina josephfarina is a code owner
@imdreamrunner imdreamrunner Awaiting requested review from imdreamrunner imdreamrunner is a code owner
@ejhammond ejhammond Awaiting requested review from ejhammond
@nynexman4464 nynexman4464 Awaiting requested review from nynexman4464
@marie-lucas marie-lucas Awaiting requested review from marie-lucas
@thedjpetersen thedjpetersen Awaiting requested review from thedjpetersen
@vjeux vjeux Awaiting requested review from vjeux

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@sangwook-dev @cixzhang
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.