Skip to content

Trim npm dependencies, skip build tools in CI, and drop IE 11 targets - #3764

Open
Crabcyborg wants to merge 3 commits into
masterfrom
chore/trim-npm-deps
Open

Crabcyborg wants to merge 3 commits into
masterfrom
chore/trim-npm-deps

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Trims Lite's npm dependencies to what the build, lint and test tooling actually use, keeps the build-only toolchain out of CI installs, stops transpiling JS for Internet Explorer 11, and folds in the open Dependabot security bumps.

master this PR
Lockfile packages 1,778 1,458
npm audit findings 77 (2 critical, 19 high, 51 moderate, 5 low) 21 (2 critical, 8 high, 10 moderate, 1 low)
CI install (npm ci --omit=optional) 1,458 packages, 1.3 GB 1,144 packages, 968 MB
Built JS (13 bundles) 725 KB with IE 11 targets 580 KB

No features change. Built CSS and the .min.js files are unchanged. The JS bundles change only because IE 11 is no longer a target (see below).

Removed

Runtime dependencies that were never imported. Source code only imports @wordpress/i18n, @wordpress/dom-ready and prop-types from npm. Blocks and admin UIs use WordPress globals (wp.element, wp.components, wp.blocks, wp.blockEditor), so these npm copies were never bundled.

  • @babel/runtime, @wordpress/api-fetch, @wordpress/api-request, @wordpress/components, @wordpress/data, @wordpress/element, @wordpress/url, classnames, react, react-dom, styled-components
  • npm, listed as a runtime dependency and pulling in all of @npmcli/*, libnpm*, pacote and sigstore
  • glob, replaced by fs.readdirSync in webpack.config.js (the pattern only covered one directory level)

Unused dev tooling

  • webpack-dev-server, since npm run serve uses browser-sync with webpack-dev-middleware
  • copy-webpack-plugin and serialize-javascript (the latter only existed to patch the former)
  • @wordpress/babel-preset-default, not referenced by .babelrc
  • @babel/plugin-transform-react-jsx and babel-plugin-styled-components, only used by the .babelrc env.test block, which nothing activates (the JS unit tests call Babel with babelrc: false)

Build-only packages are skipped in CI

The webpack toolchain (webpack, webpack-cli, webpack-dev-middleware, the loaders and plugins, @svgr/webpack), sass, browser-sync, prompts, cross-env and google-closure-compiler move to optionalDependencies. The ESLint, Stylelint, JS unit test and Cypress workflows now install with npm ci --omit=optional, since none of them build anything (the built JS and CSS are committed). A plain npm install on a dev machine and bin/build-plugin.sh still install everything, so npm run build, npm run serve and npm run minimize work as before.

Lite stays the only plugin that installs Closure Compiler. Add-ons call ../formidable/node_modules/.bin/google-closure-compiler. Pro's bin/minify-jquery-i18n.sh was the last script still using npx and is fixed in https://github.com/Strategy11/formidable-pro/pull/7049.

Internet Explorer 11 is no longer a build target

.babelrc set targets: last 2 versions, ie >= 11, overriding .browserslistrc. With the override gone, Babel follows @wordpress/browserslist-config like WordPress core. The rebuilt bundles are about 20% smaller (for example formidable_blocks.js 36 KB to 21 KB, onboarding-wizard.js 22 KB to 9 KB). Some committed bundles were already stale against master's own build (for example formidable_admin.js lacked translators: comments that the build emits), so part of the JS diff is that drift.

The same change for add-ons:

Other removals in the second pass

  • The start script, which called wp-scripts from the uninstalled @wordpress/scripts.
  • @babel/plugin-syntax-jsx, already included by @babel/preset-react (removed from .babelrc, eslint.config.mjs and package.json).
  • eslint-import-resolver-node and eslint-plugin-prettier as direct dependencies. Nothing references them, and they still install through eslint-plugin-import and @wordpress/eslint-plugin.

Added

  • @eslint/eslintrc, which eslint.config.mjs imports directly but only resolved through hoisting.
  • stylelint, stylelint-scss and prettier as explicit devDependencies. These were already used (they are peers of @wordpress/stylelint-config and @wordpress/eslint-plugin) but only resolved because npm happened to hoist them. Removing the packages above changed the hoisting, so they are now declared.
  • settings.react.version: '16.14' in eslint.config.mjs. The WordPress preset auto-detects React, which is no longer installed. This pins the version it detected before, so lint results stay the same.

Security updates

The open Dependabot bumps are applied here as targeted lockfile updates, plus a non-forcing npm audit fix. Every new version was held to a 7-day release age (--before), and colord, ignore and table were pinned back to their newest releases older than that.

Out of 84 new or changed package versions, OSV has advisories for only one: qs 6.15.4, which replaces 6.15.2 with the same advisories. A full fix needs @wordpress/env 12. No new install scripts were introduced (fs-ext-extra-prebuilt already had one on master).

What's left needs a major bump and is out of scope here:

  • @wordpress/env 11 to 12 (simple-git critical, isomorphic-git, express/qs, @wp-playground/*)
  • html-validate 8 to 11 (glob, minimatch)
  • @wordpress/eslint-plugin (bundled @typescript-eslint 6.x)
  • webpack 5.97 to 5.113 (low, buildHttp is not used)

Dependabot PRs covered

Dependabot closes these automatically once this merges.

Verification

Second pass (CI install split and IE 11):

  • npm ci --include=dev --omit=optional --legacy-peer-deps: webpack, sass, Closure Compiler and browser-sync are absent. eslint . clean, stylelint "**/*.{css,scss}" clean, node --test tests/js/*.test.mjs 88/88, cypress verify passes, wp-env --version 11.17.0.
  • Full npm ci: npm run build succeeds, npm run minimize leaves formidable.min.js and frmstrp.min.js byte-identical.
  • The lockfile change in this pass only removes @babel/plugin-syntax-jsx 7.25.7 and marks the build packages optional. No versions change.
  • Not yet checked in a browser: the rebuilt non-IE bundles.

First pass:

Run locally against master installed with the same npm ci --legacy-peer-deps that CI uses:

  • npm run build: all 248 built JS, CSS and POT files byte-identical to master, including formidable_blocks.js
  • npm run minimize: formidable.min.js and frmstrp.min.js byte-identical
  • eslint .: output identical to master
  • stylelint "**/*.{css,scss}": clean
  • node --test tests/js/*.test.mjs: 88/88 pass
  • oxlint .: clean
  • npm run serve dependencies resolve, cypress verify passes, wp-env 11.17 starts
  • Full Cypress suite and a Gutenberg block check against wp-env are in progress. Results will be posted as a comment.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Color input validation now blocks certain black-color updates when a maxlength field contains a value that fails validation.
  • Chores
    • Updated build and dependency configurations. Existing dashboard, add-on, form, and onboarding interactions remain available.

Remove 18 packages that nothing imports or runs. Source code only
imports @wordpress/i18n, @wordpress/dom-ready and prop-types from npm.
React, wp.element and wp.components come from WordPress globals at
runtime, so the npm copies were never bundled. The npm package itself
was listed as a runtime dependency and pulled in its whole tree.

Replace glob in webpack.config.js with fs.readdirSync, since the
pattern only covers one directory level. Drop the unused env.test
block from .babelrc. Pin the React version for eslint-plugin-react,
since React is no longer installed for auto-detection.

Declare stylelint, stylelint-scss and prettier, which were already in
use but only resolved through hoisting.

Apply the pending Dependabot security bumps and a non-forcing npm
audit fix, holding every new version to a 7-day release age.

Built JS, CSS and POT output is byte-identical to master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Crabcyborg Crabcyborg added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code full automated qa Run analysis, PHPUnit, and Cypress E2E workflows labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates package, Babel, ESLint, CI, and webpack settings. It regenerates several JavaScript bundles as module-based builds and includes specific changes to color validation, radio-control cleanup, and a border-radius component method.

Changes: Build configuration and JavaScript bundles

Layer / File(s) Summary
Build and dependency settings
package.json, .babelrc, eslint.config.mjs, .github/workflows/*, webpack.config.js
Package dependencies and Babel and ESLint settings change. Four CI workflows omit optional dependencies during installation. Webpack discovers SCSS files in direct web-component subdirectories.
UI component bundles
js/formidable-color-picker.js, js/formidable-settings-components.js, js/formidable-web-components.js, js/formidable_overlay.js, js/formidable_styles.js
The bundles are reorganized. The color guard validates the maxlength value without trimming or removing #; radio-control cleanup adds frm_disabled; and parseDefaultValues still calls the removed parseValueUnit method. The overlay and style logic remain represented.
Page and block bundles
js/addons-page.js, js/form-templates.js, js/formidable_admin.js, js/formidable_blocks.js
The add-ons, template, admin, and block bundles are replaced or reorganized. The summaries retain the existing page and block flows. The admin bundle adds translator-context comments.
Dashboard and onboarding bundles
js/formidable_dashboard.js, js/frm_testing_mode.js, js/onboarding-wizard.js, js/welcome-tour.js
The bundles are reorganized into modules. The summaries retain the dashboard, testing-mode, onboarding, and welcome-tour flows, including the welcome tour’s dashboard and unseen-tour checks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Suggested reviewers: shervelmi, stephywells, liviu-p

Merge Risk: Minimal · up to ae4ea · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names three changes: trimming npm dependencies, keeping build tools out of CI installs, and dropping IE 11 targets. The raw summary supports each one. The .babelrc change removes the browser…
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.
Full details: Title check

Explanation

The title names three changes: trimming npm dependencies, keeping build tools out of CI installs, and dropping IE 11 targets. The raw summary supports each one. The .babelrc change removes the browser targets (last 2 versions and ie >= 11). The workflow files now use --omit=optional, so build tooling moved to optionalDependencies is skipped in CI. package.json drops runtime and dev dependencies. The title covers the main changes without listing files, though it does not mention the security updates or the lockfile reduction.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2a91b45 and ae4ea40.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 21

  • .babelrc
  • .github/workflows/cypress.yml
  • .github/workflows/js-unit-tests.yml
  • .github/workflows/jscs.yml
  • .github/workflows/stylelint.yml
  • eslint.config.mjs
  • js/addons-page.js
  • js/form-templates.js
  • js/formidable-color-picker.js
  • js/formidable-settings-components.js
  • js/formidable-web-components.js
  • js/formidable_admin.js
  • js/formidable_blocks.js
  • js/formidable_dashboard.js
  • js/formidable_overlay.js
  • js/formidable_styles.js
  • js/frm_testing_mode.js
  • js/onboarding-wizard.js
  • js/welcome-tour.js
  • package.json
  • webpack.config.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Crabcyborg Crabcyborg added priority: high franky-review and removed full automated qa Run analysis, PHPUnit, and Cypress E2E workflows labels Nov 27, 2026
Crabcyborg and others added 2 commits November 27, 2026 15:40
Move the webpack toolchain, Sass, browser-sync and Closure Compiler
to optionalDependencies. Workflows install with --omit=optional, so
CI skips them while local npm install still gets everything.

Also remove the dead start script, declare @eslint/eslintrc, and
drop @babel/plugin-syntax-jsx, eslint-import-resolver-node and
eslint-plugin-prettier, which nothing references directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the .babelrc targets so Babel follows the WordPress browser
list in .browserslistrc, and rebuild the bundles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Crabcyborg Crabcyborg changed the title build(deps): remove unused npm dependencies and apply security updates Trim npm dependencies, skip build tools in CI, and drop IE 11 targets Nov 27, 2026
@franky-the-going-merry franky-the-going-merry Bot added franky-working Franky is actively reviewing this and removed franky-working Franky is actively reviewing this labels Nov 27, 2026
@Crabcyborg Crabcyborg added this to the 7.2 milestone Nov 27, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 27, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving at ae4ea40. Nothing blocking. I rebuilt the output and ran the tooling this PR touches. The rebuilt bundles also work in a browser.

Tests run at ae4ea40 (every CI job except CodeRabbit, Psalm, Typos, DeepScan and Scrutinizer shows skipping, because the run tests / run analysis labels aren't set):

  • npm ci --legacy-peer-deps --include=dev --ignore-scripts then npm run build → every tracked output (13 JS bundles, CSS, .pot) is byte-identical to what's committed, so the committed bundles are a clean build of this head.
  • npm ci --omit=optional (the new CI install) then eslint . → 0 errors, 144 warnings; stylelint "**/*.{css,scss}" → clean; npm run test:unit → 88/88. npm ci accepted the lockfile as in sync with package.json.
  • --omit=optional drops the native @unrs/resolver-binding-* package that ESLint's import resolver needs. The unrs-resolver postinstall script fetches it, so the lint job passes with install scripts enabled (I ran that postinstall by hand and eslint . went from 160 "Cannot find native binding" errors to 0). Installing with --ignore-scripts breaks lint, so the CI install must keep scripts on.

Dependency removals. I grepped every import in js/src, assets and the webpack config against package.json. The only npm packages the source imports are @wordpress/i18n, @wordpress/dom-ready and prop-types, all kept. glob → fs.readdirSync in webpack.config.js matches the old one-level pattern. The .babelrc change falls back to the existing .browserslistrc.

What the bundle diff contains. It isn't only the IE 11 target. On the merge base, a clean rebuild with master's own config already differs from master's committed bundles (all 13 files). So the PR also ships source that master merged but never built, for example the translators: comments in formidable_admin.js and the unconcatenated module layout. The description mentions this drift, so I'm just recording that I confirmed it.

Live check, PR loaded in the preview env (formidable at ae4ea40, serving the rebuilt js/*.js): the form builder, Dashboard, Add-Ons, Global Settings and Styles pages all load with no JS errors from these files. The only console errors are 404s for other plugins' assets and TinyMCE's unload policy warning. In the builder, clicking a field opens frm-single-settings-1. In Styles, the Image Opacity slider updated its text, hidden value (34%) and aria-valuetext, and the field-shape radio switched to circle.

Not exercised: Cypress, the onboarding wizard, welcome tour, form templates page, Gutenberg blocks, testing mode, overlay, and color-picker interaction. The merge with master was not rebuilt. Master has 2 newer commits touching package.json, webpack.config.js, webpack.dev.js and bin/build-plugin.sh. git merge-tree reports no conflicts.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant