Skip to content

+ proj: whitelist the published source files in seven libs - #243

Merged
catouse merged 2 commits into
dev_optimizefrom
dev_optimize_lib_files_field
Aug 31, 2026
Merged

+ proj: whitelist the published source files in seven libs#243
catouse merged 2 commits into
dev_optimizefrom
dev_optimize_lib_files_field

Conversation

@Lwrless

@Lwrless Lwrless commented Aug 23, 2026

Copy link
Copy Markdown
Member

.agents/skills/zui-standards/references/library.md:29 mandates
"files": ["./src/**/*"] on every lib. Without it, a pack ships whatever sits in the lib
directory — dev.ts, docs/, stray local files — alongside the sources consumers import.

Seven libs had no files field: avatar, form, icons, input-control,
input-group, upload, upload-imgs. With #240's three, that closes the gap.

Commits

  1. the whitelist — one 3-line block per manifest, 7 files.
  2. @zui/icons fonts — that whitelist was too narrow for one lib.

The icons fix

./src/**/* excludes lib/icons/public/, which holds the ZenIcon binaries that
src/style/icons-core.css:3-7 loads via @font-face as @/public/zenicon.{eot,woff,ttf,svg}
— referenced through the lib-root alias, which is why a search for relative ../public
paths does not find it. It also excluded public/fontawesome-license.md, which should
ship on its own merits.

This governs no publish today: scripts/build/publish.ts ships a single aggregate
package built from dist/zui, so the individual workspace packages are never published,
and scripts/build/config.ts:425-428 copies each lib's public/ from the working tree
regardless of files. But the manifest is the wrong place to leave a trap that only
springs if per-lib publishing is ever turned on — especially one that looks more correct
than it is.

@zui/icons is the only lib affected. A scan of every lib carrying a files whitelist
finds it is the only one whose src/ references a path outside src/; the public/ and
assets/ directories in dashboard, sortable, avatar and modal hold demo and
vendor files that nothing in src/ loads.

Verification

  • Edits are surgical. Each manifest was round-tripped through a JSON parse and checked
    for unchanged key order and unchanged values for every key but files. The first commit
    is exactly 21 insertions, 0 deletions.
  • Measured, not assumed. npm pack --dry-run on @zui/avatar: 29 files → 15,
    dropping dev.ts, docs/, tsconfig.json and 140 kB of assets/*.png. README.md
    stays — npm always includes it and files cannot exclude it.
  • @zui/icons now packs 11 files: the manifest, README, four src files and the five under
    public/. dev.ts, docs/ and the IcoMoon sources in assets/ stay excluded.
  • pnpm check green; full pnpm build green, 870 modules, every lib still resolving.

Placement

The plan called for the field "after devDependencies, before zui". There is no such
convention in this repo — key order varies widely, and the dominant shape among libs that
already have the field is keywords → files → exports → dependencies → devDependencies → zui. The rule actually applied is the one stable one: insert immediately before
"zui"
.

Two of the seven (avatar, form) also carry no keywords field. That is #246's scope,
untouched here; the two PRs overlap on five manifests but edit different regions and merge
cleanly.

`.agents/skills/zui-standards/references/library.md:29` mandates
`"files": ["./src/**/*"]` on every lib. Seven declared none, so a pack of those
packages shipped whatever sat in the lib directory alongside the sources
consumers import.

Measured on `@zui/avatar`: 29 files before, 15 after — the change drops
`dev.ts`, `docs/`, `tsconfig.json` and 140 kB of `assets/*.png` demo images,
none of which `src/` references.

`@zui/icons` is worth a note. Its `public/` directory holds the ZenIcon font
binaries that `src/style/icons-core.css:5` loads, and `./src/**/*` excludes
them. That is not a regression: `scripts/build/publish.ts` publishes a single
aggregate package built from `dist/zui`, not the individual workspace packages,
and `scripts/build/config.ts:425-428` copies each lib's `public/` into the
build from the working tree regardless of `files`. Verified — the built CSS
still resolves `url(./icons/zenicon.woff)` against an emitted font file.

Three libs still lack the field: `avatar-group`, `label` and `panel` are
covered by the CSS-only optimization branch.
The previous commit's `"files": ["./src/**/*"]` excludes `lib/icons/public/`,
which holds the ZenIcon binaries that `src/style/icons-core.css:3-7` loads via
`@font-face` as `@/public/zenicon.{eot,woff,ttf,svg}`. It also excluded
`public/fontawesome-license.md`, which should ship on its own merits.

This governs no publish today — `scripts/build/publish.ts` ships a single
aggregate package from `dist/zui`, and `scripts/build/config.ts:425-428` copies
each lib's `public/` from the working tree regardless of `files`. But the
manifest is the wrong place to leave a trap that only springs if per-lib
publishing is ever turned on, and it looked more correct than it was.

`npm pack --dry-run` on this lib now lists 11 files: the manifest, README, the
four src files, and the five files under `public/`. `dev.ts`, `docs/` and the
IcoMoon sources in `assets/` stay excluded — `src/` references none of them.

`@zui/icons` is the only lib affected. A scan of every lib carrying a `files`
whitelist finds it is the only one whose `src/` references a path outside
`src/`; the `public/` and `assets/` directories in `dashboard`, `sortable`,
`avatar` and `modal` hold demo and vendor files that nothing in `src/` loads.
@catouse
catouse marked this pull request as ready for review August 31, 2026 02:48
@catouse
catouse merged commit ebf5419 into dev_optimize Aug 31, 2026
0 of 3 checks passed
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.

2 participants