Files
cacti/build
c1e7c75752 chore(deps): ship pace.js 1.3.1 with the body-class fix (#8761)
package.json and package-lock.json already pin pace-js 1.3.1, but the
committed include/js/pace.js was still the 1.2.4 build.

Regenerate include/js/pace.js from 1.3.1. Upstream 1.3.1 now rejects the
__proto__/constructor/prototype keys itself, so the sync-js transform no longer
injects that guard (it would duplicate it) and instead fails the build if the
upstream guard disappears. 1.3.1 still ships the empty-alternative body-class
regex, so that fix is still applied. Update the sync_js test fixture and
build/README.md, and drop the stale patches/pace-js+1.2.4.patch path filter
from htmx-filters.yml (develop has no patches directory).

Refs #8759

Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-17 11:58:26 -05:00
..

Front-end JavaScript build

The JavaScript libraries listed in the repository-root package.json are managed through npm so that Dependabot can track them and raise security alerts. Their built files under include/js/ are generated, not committed.

Building

npm ci        # installs the pinned versions and runs the build (postinstall)
npm run build:js   # or run the sync explicitly

build/sync-js.mjs copies the upstream dist files into include/js/.

What is managed here

assetMap in build/sync-js.mjs lists the npm-sourced, generated files. It includes the main UI libraries, Chart.js, Touch Punch, Moment, daterangepicker, mark.js, and hotkeys-js. The latter libraries retain their existing public paths under include/js/vendor/. Moment is pinned to a patched release; mark.js uses the published 8.11.1 release rather than the old copy marked 9.0.0.

The copy transforms apply Pace's body-class fix (and fail the build if Pace stops rejecting prototype keys, which 1.3.1 does upstream), rewrite screenfull's ESM export, and replace removed jQuery APIs in tablesorter's core, widgets, and minified pager. No npm package source is modified. Unexpected Pace or screenfull source formats fail the build so an update cannot silently discard the fixes.

build/legacy-js.json lists the remaining Cacti-maintained adapters and their compatibility requirements. They are not interchangeable with upstream distributions. The inventory test covers every root browser script and every static JavaScript dependency in the shared header.

Only Cacti's own themed CSS for jquery-ui and jstree remains committed; those are Cacti theme assets, not upstream library files.

include/themes/<theme>/select2.css is the unmodified upstream Select2 CSS, committed (not npm-synced) per-theme so it loads alongside each theme's other vendor CSS files; it should be refreshed by hand whenever the select2 version in package.json changes. Cacti's own Select2-to-theme adapter rules live in each theme's main.css instead.

Release and source-tree checkouts

Because generated files may be absent or stale in a source checkout, npm ci must run before a release tarball is assembled and after a fresh git clone. The release pipeline must invoke npm ci (which runs the build via postinstall).