Skip to content

feat: remove primeng/@primeuix/* dependencies and vendor MIT-licensed source (cps-ui-kit)#719

Merged
fateeand merged 10 commits into
next-majorfrom
vendor-primeng-remove-dependency
Jul 16, 2026
Merged

feat: remove primeng/@primeuix/* dependencies and vendor MIT-licensed source (cps-ui-kit)#719
fateeand merged 10 commits into
next-majorfrom
vendor-primeng-remove-dependency

Conversation

@fateeand

Copy link
Copy Markdown
Collaborator

This PR targets the next-major branch, rather than master, as it is part of the next major version update.

Summary

  • Vendors PrimeNG 21.1.9 (last MIT release before v22's license change) into projects/cps-ui-kit/src/lib/primeng-temp/, and the @primeuix/{utils,styled,motion,styles} packages it depends on into primeuix-temp/. Removes primeng, primeicons, @primeuix/styled, @primeuix/utils from package.json - cps-ui-kit now has zero primeng-ecosystem npm dependencies
  • Rewrites cps-ui-kit source files that imported from these packages to point at the vendored code instead (mechanical import-path rewrite, no logic changes)
  • The final count of the copied-over files is 476 (360 primeng-temp + 116 primeuix-temp)
  • Adds NOTICE files documenting MIT attribution, provenance (source repo, commit/tag, fetch date), and every non-mechanical modification made to the vendored code, per MIT's terms and this repo's own Apache-2.0 §4 redistribution requirements
  • Verified production bundle size against next-major: composition app's shipped JS is not larger (initial bundle −13.3 kB raw / −2.4 kB gzip-estimate; total JS −26.4 kB) - the published cps-ui-kit package itself is larger (+4.7 MB, since it now contains the vendored source), but that doesn't reach the app's final bundle since it's tree-shaken

Why

PrimeNG drops MIT licensing at v22 (primeui.dev/nextchapter).
The change in the current PR freezes the code, removes the dependency risk ahead of Angular 22 upgrade, allows to tune it in case of any compatibilities with Angular 22, and allows us to gradually get rid of the PrimeNG code from the library: #686

Additional notes

  • primeng-temp//primeuix-temp/ are large (476 files) but every file carries a provenance header; see NOTICE.md in each directory for the itemized list of every non-mechanical change
  • Several PrimeNG features vendored here are never actually exposed by cps-table/cps-tree-table/etc. (native column filter, cell editing, context menus, drag-drop, etc.) and could be stripped for a further few files - but that means editing PrimeNG's own component logic, which is a fundamentally different (and higher-maintenance) kind of change than vendoring. Anyways, we will eventually get rid of this code while reimplementing/refactoring the components that depend on it

Release notes:

  • Remove primeng/@primeuix/* dependencies and vendor MIT-licensed source (cps-ui-kit)

fateeand and others added 10 commits July 13, 2026 15:11
Last MIT-licensed PrimeNG release before v22's license change.
Pinned exactly (not ^) since this version becomes the source-of-truth
for the upcoming vendoring work that removes the primeng dependency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PrimeNG drops MIT licensing starting v22 (see https://primeui.dev/nextchapter).
21.1.9 is the last MIT release, so its source for the ~14 PrimeNG submodules
cps-ui-kit actually uses (plus their full 37-module/437-file transitive
dependency closure, e.g. Table's template internally renders Button/Checkbox/
Select/icons) is vendored into
projects/cps-ui-kit/src/lib/primeng-temp/ instead of depending on the primeng
npm package.

- Copied unmodified from primefaces/primeng tag 21.1.9 via
  scripts/rewrite-primeng-imports.mjs, which also mechanically rewrote every
  `primeng/x` import to a relative path and stamped each file with a
  provenance header.
- Added `// @ts-nocheck` to vendored files (this repo's tsconfig is stricter
  than PrimeNG's own) plus targeted `$any()` template casts and a handful of
  widened shared-helper type signatures where Angular's strictTemplates
  flagged type mismatches that `@ts-nocheck` alone can't suppress. See
  primeng-temp/NOTICE.md for the itemized list of every non-mechanical
  change and why each was needed, including two cases that deliberately
  preserve pre-existing upstream quirks rather than "fixing" them.
- Removed `primeng`/`primeicons` from package.json; added `@primeuix/motion`
  and `@primeuix/styles` as explicit direct/peer dependencies (previously
  only transitive via primeng).
- Added root NOTICE + primeng-temp/NOTICE.md for MIT attribution per license
  terms and this repo's own Apache-2.0 §4 redistribution requirements.
- Excluded primeng-temp from eslint/prettier/jest-coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
projects/cps-ui-kit/styles/styles.scss (bundled with the published library
via ng-package.json assets) still had `@use 'primeicons/primeicons.css'`
after primeicons was dropped as a dependency. Nothing in cps-ui-kit
references pi-* icon classes (confirmed during the primeng vendoring work),
so this was dead weight rather than something to reinstate the dependency
for. Caught by a Playwright run: the missing stylesheet broke the whole
demo app via Vite's error overlay intercepting pointer events.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…maining npm deps

The vendored PrimeNG code (primeng-temp/) still depended on four npm
packages published under PrimeTek's separate primeuix monorepo. Vendors
those too, into projects/cps-ui-kit/src/lib/primeuix-temp/, so cps-ui-kit
has zero external primeng-ecosystem dependencies.

- Copied from primefaces/primeuix HEAD (commit b9467bc4) via
  scripts/rewrite-primeuix-imports.mjs - no matching git tags exist for the
  currently-installed npm versions, so HEAD was used after confirming every
  function/symbol actually used matches in shape (see
  primeuix-temp/NOTICE.md for the full version-drift disclosure).
- @primeuix/styles scoped to only the 17 component subdirectories actually
  referenced (of 94 available upstream); utils/styled/motion vendored in
  full since their barrels re-export everything.
- Original src/ (and motion's sibling types/) directory nesting preserved
  exactly per package, unlike primeng-temp - primeuix has real relative
  imports reaching outside src/ that depend on that nesting depth.
- No @ts-nocheck needed (primeuix's own tsconfig is already as strict as
  this repo's); only 7 small mechanical fixes were required (an explicit
  return, six underscore-prefixed unused parameters) - see
  primeuix-temp/NOTICE.md for the itemized list.
- Removed @primeuix/{utils,styled,motion,styles} from package.json entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…temp/

Prompted by a fair question: was every vendored file actually needed, or
did the original vendoring just blindly copy whole directories? Answer:
mostly needed, but not entirely.

Built a precise call-graph trace - starting from every symbol actually
imported by name anywhere in cps-ui-kit/src, through real re-export
chains to each symbol's true declaring file, then through that file's
own real imports - as opposed to the original vendoring's coarser
module/package-level reachability check.

- primeng-temp: 437 -> 417 files. Removed whole types/<component>/
  directories for components never vendored at all (chart, contextmenu,
  dataview, multiselect, password, picklist, textarea), plus orphaned
  index.ts stubs shadowed by public_api.ts.
- primeuix-temp: 183 -> 116 files. Removed 70 files from utils/styled
  that were vendored in full (their own index.ts re-exports everything,
  which made the original module-level check see "reachable via the
  barrel" without checking whether anything actually calls the specific
  function) - including styled's entire theme-customization action API
  (definePreset, usePreset, etc.), never reachable through cps-ui-kit's
  own public API either. motion and styles had zero waste (styles was
  already hand-scoped from the start).

Verified by deleting and rebuilding, not just by trusting the static
analysis - this caught 3 files the analysis incorrectly flagged, restored
after the rebuild surfaced them: primeng-temp/dom/domhandler.ts consumes
them via a namespace import (import * as utils) + property access rather
than a named import, which the symbol-scan missed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
29 "optional chain not nullable" warnings appeared on `ng serve`,
confined to three vendored PrimeNG files. Fixed each at its actual
root cause instead of suppressing the check:

- button.ts: Button.buttonProps (and, for consistency, the unused
  ButtonDirective's buttonProps) was typed as always-defined despite
  having no default value and never being bound anywhere in this
  codebase - the type was simply wrong, not the defensive `?.` in the
  template. Widened both to `ButtonProps | undefined`.
- table.ts: filterButtonProps has a full default object, so it's
  genuinely always defined - the leading `?.` in 5 template
  expressions was truly redundant. Removed just that one operator in
  each case, kept the deeper `popover?.x` chains since popover's own
  type legitimately allows undefined.
- tree.ts: a native (input) event bound directly on a static element
  guarantees a non-null $event.target - removed the redundant `?.`.

Verified individually via the compiler's own reported diagnostic
location for each case before touching it, since a blind strip-the-
operator pass would have been unsafe for the button.ts cases.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Precise per-feature audit of what cps-table/cps-tree-table/cps-datepicker/
cps-select actually expose from their vendored PrimeNG dependencies found
these were already dead today, independent of any further edits:

- 27 icon components (icons/) never rendered by any exposed feature -
  reachable only because icons/public_api.ts is a blanket `export *`
  barrel, the same blind spot already fixed once for primeuix-temp but
  never re-run against primeng-temp's own barrels.
- FilterSlashIcon: imported and listed in TableModule but never actually
  rendered (no data-p-icon="filter-slash" anywhere).
- api/contextmenuservice.ts: wires a <p-contextMenu> overlay that isn't
  vendored/used anywhere.

417 -> 360 files in primeng-temp/. A separate, much larger opportunity
was also identified and precisely quantified (stripping ~3200 dead lines
of unexposed Table/TreeTable features - column reordering, context-menu
rows, cell/row editing - which would cascade into removing RadioButton
and 2 more icons) but requires editing table.ts/treetable.ts's own
component logic rather than deleting files, and was deliberately left
out of scope for this change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@fateeand fateeand requested a review from Copilot July 15, 2026 13:58
@fateeand fateeand changed the title Remove primeng/@primeuix/* dependencies and vendor MIT-licensed source (cps-ui-kit) feat: remove primeng/@primeuix/* dependencies and vendor MIT-licensed source (cps-ui-kit) Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 72.43% 6035/8332
🟡 Branches 65.05% 2785/4281
🟡 Functions 72.03% 1123/1559
🟡 Lines 73.53% 5638/7668

Test suite run success

2391 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from 6910acc

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Playwright test results

passed  240 passed

Details

stats  240 tests across 5 suites
duration  8 minutes, 53 seconds
commit  6910acc
info  For details, download the Playwright report

@fateeand fateeand marked this pull request as ready for review July 15, 2026 14:10
@fateeand fateeand merged commit 3ddc69a into next-major Jul 16, 2026
12 of 13 checks passed
@fateeand fateeand deleted the vendor-primeng-remove-dependency branch July 16, 2026 10:55
@fateeand fateeand linked an issue Jul 16, 2026 that may be closed by this pull request
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.

Copy the used PrimeNG code to the repo

3 participants