Skip to content

Build Tools: Move build scripts to @wordpress/build-scripts workspace package#78509

Merged
manzoorwanijk merged 22 commits into
WordPress:trunkfrom
USERSATOSHI:try/migrate-build-tools-into-workspace
May 26, 2026
Merged

Build Tools: Move build scripts to @wordpress/build-scripts workspace package#78509
manzoorwanijk merged 22 commits into
WordPress:trunkfrom
USERSATOSHI:try/migrate-build-tools-into-workspace

Conversation

@USERSATOSHI
Copy link
Copy Markdown
Contributor

@USERSATOSHI USERSATOSHI commented May 21, 2026

What?

Related to #75041

Converts build into a dedicated npm workspace package, @wordpress/build-scripts, to support the ongoing cleanup of the root package.json and make dependencies explicit.

Why?

As part of #75041 (Phase 4.1), the build scripts were relying on dependencies implicitly available from the root node_modules. This “phantom dependency” setup can break under stricter workspace isolation (for example, with pnpm).

Creating a dedicated workspace package:

  • Makes dependencies explicit and easier to maintain.
  • Reduces coupling with the root package.json.
  • Prepares the monorepo for stricter workspace dependency handling.

How?

  • Added a package.json for the private @wordpress/build-tools workspace package.
  • Moved build-related scripts under the workspace and exposed them as npm scripts.
  • Updated root build and dev scripts to run through the workspace.
  • Used the existing root workspaces configuration, so no additional registration was needed.

Decisions

  • Renamed the build and dev scripts in the workspace to build:all and dev, since the previous build script was calling npm run build across all workspaces and causing an infinite loop.
  • Renamed the workspace from build-tools to build-scripts, as having only tools/build excluded via .gitignore felt inconsistent and not ideal for the package structure.

Testing Instructions

  1. Run npm install.

  2. Run npm run build.

  3. Run npm start.

  4. Verify:

    • npm run --workspace @wordpress/build-scripts build-vendors
    • npm run --workspace @wordpress/build-scripts generate-worker-placeholders

Use of AI Tools

PR description drafted with GitHub Copilot.

Comment thread tools/build/package.json Outdated
Comment thread bin/packages/build-vendors.mjs
Comment thread tools/build-scripts/build.mjs
Comment thread .gitignore Outdated
Comment thread tools/build/build.mjs Outdated
@github-actions github-actions Bot added the [Package] E2E Tests /packages/e2e-tests label May 22, 2026
Comment thread bin/resolve-trace-source-maps.js Outdated
Comment thread bin/tsconfig.json Outdated
Comment thread tools/build/build.mjs Outdated
Comment thread .github/workflows/bundle-size.yml Outdated
Comment thread tools/build-scripts/package.json Outdated
@manzoorwanijk manzoorwanijk changed the title Build Tools: Convert tools/build to @wordpress/build-tools workspace package Build Tools: Convert bin/build* to @wordpress/build-tools workspace package May 25, 2026
@manzoorwanijk manzoorwanijk changed the title Build Tools: Convert bin/build* to @wordpress/build-tools workspace package Build Tools: Move build scripts to @wordpress/build-tools workspace package May 25, 2026
@USERSATOSHI
Copy link
Copy Markdown
Contributor Author

USERSATOSHI commented May 25, 2026

I also changed the workspace name to @wordpress/build-scripts should we keep this or I roll it back to build-tools

@manzoorwanijk
Copy link
Copy Markdown
Member

I also changed the workspace name to @wordpress/build-scripts should we keep this or I roll it back to build-tools

Let us use the same name as that of the directory

@manzoorwanijk manzoorwanijk changed the title Build Tools: Move build scripts to @wordpress/build-tools workspace package Build Tools: Move build scripts to @wordpress/build-scripts workspace package May 25, 2026
@manzoorwanijk manzoorwanijk requested a review from Copilot May 25, 2026 08:40
@manzoorwanijk manzoorwanijk added the [Type] Build Tooling Issues or PRs related to build tooling label May 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the repository’s build orchestration scripts out of bin/ into a dedicated npm workspace package (tools/build-scripts, published internally as @wordpress/build-scripts) so build-time dependencies are explicit and the root package.json can be slimmed down for stricter workspace isolation.

Changes:

  • Added the new @wordpress/build-scripts workspace package and moved/updated build helper scripts under tools/build-scripts/.
  • Updated root build/dev entrypoints to run via the new workspace and adjusted internal script paths accordingly.
  • Updated references/docs/workflows to point at the new script locations and removed the bin TypeScript project config.

Reviewed changes

Copilot reviewed 11 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsconfig.json Removes the bin TS project reference after build scripts move out of bin/.
tools/release/commands/performance.js Updates documentation reference for the trace source-map resolver script path.
tools/build-scripts/packages/resolve-trace-source-maps.cjs Updates usage/help text to reflect the new script location (but currently has a stale path).
tools/build-scripts/packages/generate-worker-placeholders.mjs Adjusts repo-root resolution after relocation under tools/build-scripts/.
tools/build-scripts/packages/check-build-type-declaration-files.cjs Adds a new script for verifying published type declarations.
tools/build-scripts/packages/build-vendors.mjs Adjusts repo-root resolution after relocation under tools/build-scripts/.
tools/build-scripts/package.json Introduces the new workspace package and exposes build/dev helper scripts.
tools/build-scripts/dev.mjs Updates orchestrator script to call relocated helper scripts.
tools/build-scripts/build.mjs Updates orchestrator script to call relocated helper scripts.
packages/e2e-test-utils-playwright/src/metrics/index.ts Updates comment to point to the new trace source-map resolver location.
package.json Routes build/dev through the new workspace and removes build-script deps from root.
package-lock.json Adds workspace linkage for @wordpress/build-scripts (but currently includes a stale/extraneous tools/build entry).
docs/contributors/folder-structure.md Updates folder-structure docs to mention tools/build-scripts (but still references removed bin/api-docs).
bin/tsconfig.json Deletes the old TS config for the removed bin project scripts.
.github/workflows/bundle-size.yml Updates path filters from bin/packages to tools/build-scripts/packages.
Comments suppressed due to low confidence (1)

tools/build-scripts/packages/resolve-trace-source-maps.cjs:12

  • USAGE still references tools/build/..., but this script now lives under tools/build-scripts/... (and tools/build doesn’t exist). This makes the help text misleading; update the path in the usage string to the new location (or to the workspace script invocation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/contributors/folder-structure.md Outdated
Comment thread tools/release/commands/performance.js Outdated
Comment thread packages/e2e-test-utils-playwright/src/metrics/index.ts Outdated
Copy link
Copy Markdown
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

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

Thank you @USERSATOSHI for working on this. It looks great.

Let us address the feedback given by Copilot, then we should be ready to land this.

@manzoorwanijk manzoorwanijk marked this pull request as ready for review May 25, 2026 10:47
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: USERSATOSHI <tusharbharti@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

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

Thank you for working on this and refining the changes. This looks great now.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 15 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

tools/build-scripts/packages/resolve-trace-source-maps.cjs:10

  • The help/usage text points to tools/build/packages/resolve-trace-source-maps.cjs, but this script now lives under tools/build-scripts/packages/.... This makes --help output misleading and suggests a path that doesn’t exist.

Comment thread tools/release/commands/performance.js Outdated
Comment thread packages/e2e-test-utils-playwright/src/metrics/index.ts Outdated
Comment thread tools/build-scripts/package.json
Comment thread package.json
USERSATOSHI and others added 3 commits May 25, 2026 16:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@manzoorwanijk manzoorwanijk enabled auto-merge (squash) May 26, 2026 06:36
@manzoorwanijk manzoorwanijk merged commit 1231f4d into WordPress:trunk May 26, 2026
42 of 43 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] E2E Tests /packages/e2e-tests [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants