Skip to content

chore: replace Nx workspace scripts with pnpm recursive commands#1220

Open
danieliser wants to merge 4 commits into
developfrom
chore/remove-nx
Open

chore: replace Nx workspace scripts with pnpm recursive commands#1220
danieliser wants to merge 4 commits into
developfrom
chore/remove-nx

Conversation

@danieliser

@danieliser danieliser commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove Nx and unused @nx/* dev dependencies from the core plugin workspace.
  • Replace nx run-many package scripts with native pnpm -r commands (--sort for builds, --parallel for lint/format).
  • Delete nx.json and refresh the lockfile.

Test plan

  • pnpm install
  • pnpm run build:tsc
  • pnpm run packages:lint
  • pnpm run packages:format

Summary by CodeRabbit

  • Chores
    • Removed workspace tooling and switched orchestration to pnpm recursive runs for build/lint/format tasks.
    • Converted per-package publish hooks from prepublish to prepack so builds run at pack time; per-package build/type scripts remain.
    • Added a postinstall helper to conditionally run package build steps when TypeScript is available.

Review Change Stack

Remove unused Nx tooling and run package scripts via pnpm -r instead.
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Walkthrough

Nx configuration is removed and root scripts/devDependencies are migrated from Nx to pnpm recursive commands; workspace packages replace prepublishOnly hooks with prepack, and a postinstall helper (bin/postinstall-packages.js) was added.

Changes

Nx to pnpm Toolchain Migration

Layer / File(s) Summary
Root scripts and Nx deps removal
package.json
Root package.json removes Nx devDependencies and changes postinstall, build:tsc, build:types, and packages:* scripts from Nx run-many targets to pnpm -r workspace commands.
Postinstall helper
bin/postinstall-packages.js
Adds a postinstall Node CLI that exits early if TypeScript isn't resolvable; otherwise runs pnpm run build:tsc && pnpm run build:types with inherited stdio.
Replace prepublishOnly with prepack in packages
packages/*/package.json (components, core-data, cta-admin, cta-editor, data, fields, i18n, layout, registry, types, use-query-params, utils)
Many package manifests switch their publish lifecycle script from prepublishOnly to prepack, retaining the pnpm run build:tsc && pnpm run build:types command sequence.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs:

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing Nx workspace scripts with pnpm recursive commands, which is the core objective across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-nx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions Bot and others added 2 commits May 27, 2026 07:59
Replace per-package prepublishOnly hooks with a root postinstall that
runs pnpm recursive TypeScript builds topologically. prepublishOnly ran
in parallel during install and caused components to compile before utils.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 702386bf17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Outdated
},
"scripts": {
"preinstall": "npx -y only-allow pnpm",
"postinstall": "pnpm run build:tsc && pnpm run build:types",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep postinstall from requiring devDependencies

This new lifecycle hook makes production installs fail: postinstall now runs the TypeScript builds, but typescript/tsc is only in devDependencies, and the pnpm 10 install docs state that --prod skips devDependencies while scripts still run unless --ignore-scripts is set. In any environment that does pnpm install --prod or otherwise omits dev deps, install will complete dependency resolution and then fail at this hook before the package can be used.

Useful? React with 👍 / 👎.

},
"scripts": {
"prepublishOnly": "pnpm run build:tsc && pnpm run build:types",
"build:tsc": "tsc",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the per-package publish build hook

Removing prepublishOnly means a direct pnpm publish/pnpm -r publish from a clean checkout no longer builds this package before packing it; pnpm's publish lifecycle still includes prepublishOnly, and this package's main, types, and files all expect ignored build/build-types artifacts to exist. The custom bin/bump-and-publish-packages.js path builds first, but any other publish path can now ship a tarball with missing entrypoints.

Useful? React with 👍 / 👎.

Skip postinstall package builds when TypeScript is unavailable (e.g.
pnpm install --prod). Restore publish-time builds via prepack instead of
prepublishOnly to avoid install-time race conditions.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 103: The postinstall script calls execSync('pnpm run build:tsc && pnpm
run build:types') in bin/postinstall-packages.js without protecting failures, so
a failing build aborts pnpm install; wrap that execSync call in a try/catch
around the code path that runs when require.resolve('typescript') succeeds, and
in the catch log the error (use console.error or the existing logger) and exit
with code 0 (or otherwise return/continue) so postinstall does not fail the
install when build:tsc or build:types errors; keep the existing behavior for the
require.resolve('typescript') absent case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 100abd3e-e42a-4c3d-b9d9-ebb40dc50509

📥 Commits

Reviewing files that changed from the base of the PR and between 702386b and 27723af.

📒 Files selected for processing (14)
  • bin/postinstall-packages.js
  • package.json
  • packages/components/package.json
  • packages/core-data/package.json
  • packages/cta-admin/package.json
  • packages/cta-editor/package.json
  • packages/data/package.json
  • packages/fields/package.json
  • packages/i18n/package.json
  • packages/layout/package.json
  • packages/registry/package.json
  • packages/types/package.json
  • packages/use-query-params/package.json
  • packages/utils/package.json
✅ Files skipped from review due to trivial changes (2)
  • bin/postinstall-packages.js
  • packages/data/package.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/i18n/package.json
  • packages/use-query-params/package.json
  • packages/layout/package.json
  • packages/types/package.json
  • packages/core-data/package.json
  • packages/utils/package.json

Comment thread package.json
},
"scripts": {
"preinstall": "npx -y only-allow pnpm",
"postinstall": "node bin/postinstall-packages.js",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the postinstall helper exists and inspect its TS-availability guard
fd -t f 'postinstall-packages.js' bin
echo '--- contents ---'
fd -t f 'postinstall-packages.js' bin --exec cat {}

Repository: PopupMaker/Popup-Maker

Length of output: 649


Fix postinstall failure handling when TypeScript is present but the build fails

bin/postinstall-packages.js correctly skips the build when typescript is missing (require.resolve('typescript') + process.exit(0)), but when TypeScript exists it runs execSync('pnpm run build:tsc && pnpm run build:types') with no try/catch—so a failing build:tsc/build:types will still fail the postinstall step and can break pnpm install.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 103, The postinstall script calls execSync('pnpm run
build:tsc && pnpm run build:types') in bin/postinstall-packages.js without
protecting failures, so a failing build aborts pnpm install; wrap that execSync
call in a try/catch around the code path that runs when
require.resolve('typescript') succeeds, and in the catch log the error (use
console.error or the existing logger) and exit with code 0 (or otherwise
return/continue) so postinstall does not fail the install when build:tsc or
build:types errors; keep the existing behavior for the
require.resolve('typescript') absent case.

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.

1 participant