Repository navigation
Trim npm dependencies, skip build tools in CI, and drop IE 11 targets - #3764
Crabcyborg wants to merge 3 commits into
Conversation
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>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
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>
There was a problem hiding this comment.
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-scriptsthennpm 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) theneslint .→ 0 errors, 144 warnings;stylelint "**/*.{css,scss}"→ clean;npm run test:unit→ 88/88.npm ciaccepted the lockfile as in sync withpackage.json.--omit=optionaldrops the native@unrs/resolver-binding-*package that ESLint's import resolver needs. Theunrs-resolverpostinstall script fetches it, so the lint job passes with install scripts enabled (I ran that postinstall by hand andeslint .went from 160 "Cannot find native binding" errors to 0). Installing with--ignore-scriptsbreaks 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.
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.
npm auditfindingsnpm ci --omit=optional)No features change. Built CSS and the
.min.jsfiles are unchanged. The JS bundles change only because IE 11 is no longer a target (see below).Removed
Runtime
dependenciesthat were never imported. Source code only imports@wordpress/i18n,@wordpress/dom-readyandprop-typesfrom 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-componentsnpm, listed as a runtime dependency and pulling in all of@npmcli/*,libnpm*,pacoteandsigstoreglob, replaced byfs.readdirSyncinwebpack.config.js(the pattern only covered one directory level)Unused dev tooling
webpack-dev-server, sincenpm run serveuses browser-sync with webpack-dev-middlewarecopy-webpack-pluginandserialize-javascript(the latter only existed to patch the former)@wordpress/babel-preset-default, not referenced by.babelrc@babel/plugin-transform-react-jsxandbabel-plugin-styled-components, only used by the.babelrcenv.testblock, which nothing activates (the JS unit tests call Babel withbabelrc: 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-envandgoogle-closure-compilermove tooptionalDependencies. The ESLint, Stylelint, JS unit test and Cypress workflows now install withnpm ci --omit=optional, since none of them build anything (the built JS and CSS are committed). A plainnpm installon a dev machine andbin/build-plugin.shstill install everything, sonpm run build,npm run serveandnpm run minimizework as before.Lite stays the only plugin that installs Closure Compiler. Add-ons call
../formidable/node_modules/.bin/google-closure-compiler. Pro'sbin/minify-jquery-i18n.shwas the last script still usingnpxand is fixed in https://github.com/Strategy11/formidable-pro/pull/7049.Internet Explorer 11 is no longer a build target
.babelrcsettargets: last 2 versions, ie >= 11, overriding.browserslistrc. With the override gone, Babel follows@wordpress/browserslist-configlike WordPress core. The rebuilt bundles are about 20% smaller (for exampleformidable_blocks.js36 KB to 21 KB,onboarding-wizard.js22 KB to 9 KB). Some committed bundles were already stale against master's own build (for exampleformidable_admin.jslackedtranslators: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
startscript, which calledwp-scriptsfrom the uninstalled@wordpress/scripts.@babel/plugin-syntax-jsx, already included by@babel/preset-react(removed from.babelrc,eslint.config.mjsandpackage.json).eslint-import-resolver-nodeandeslint-plugin-prettieras direct dependencies. Nothing references them, and they still install througheslint-plugin-importand@wordpress/eslint-plugin.Added
@eslint/eslintrc, whicheslint.config.mjsimports directly but only resolved through hoisting.stylelint,stylelint-scssandprettieras explicit devDependencies. These were already used (they are peers of@wordpress/stylelint-configand@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'ineslint.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), andcolord,ignoreandtablewere pinned back to their newest releases older than that.Out of 84 new or changed package versions, OSV has advisories for only one:
qs6.15.4, which replaces 6.15.2 with the same advisories. A full fix needs@wordpress/env12. No new install scripts were introduced (fs-ext-extra-prebuiltalready had one on master).What's left needs a major bump and is out of scope here:
@wordpress/env11 to 12 (simple-gitcritical,isomorphic-git,express/qs,@wp-playground/*)html-validate8 to 11 (glob,minimatch)@wordpress/eslint-plugin(bundled@typescript-eslint6.x)webpack5.97 to 5.113 (low,buildHttpis 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.mjs88/88,cypress verifypasses,wp-env --version11.17.0.npm ci:npm run buildsucceeds,npm run minimizeleavesformidable.min.jsandfrmstrp.min.jsbyte-identical.@babel/plugin-syntax-jsx7.25.7 and marks the build packages optional. No versions change.First pass:
Run locally against master installed with the same
npm ci --legacy-peer-depsthat CI uses:npm run build: all 248 built JS, CSS and POT files byte-identical to master, includingformidable_blocks.jsnpm run minimize:formidable.min.jsandfrmstrp.min.jsbyte-identicaleslint .: output identical to masterstylelint "**/*.{css,scss}": cleannode --test tests/js/*.test.mjs: 88/88 passoxlint .: cleannpm run servedependencies resolve,cypress verifypasses, wp-env 11.17 starts🤖 Generated with Claude Code
Summary by CodeRabbit