Commit 1bfb1c5
committed
Restrict published package to compiled output
`@oicl/openbridge-webcomponents@1.0.1` ships at 136 MB unpacked /
14,173 files. Two compounding problems:
**Test infrastructure leaking into the build.** `vite.config.ts`
configures `src/**/*.ts` as rollup input with only `*.stories.ts`
excluded. That sweeps in `*.spec.ts` files (importing `vitest` and
`vitest-browser-lit`), `src/storybook-util.ts` (importing
`@open-wc/lit-helpers`), and `src/ar/_test-utils.ts` (a Storybook
visual-test settle helper). Combined with `preserveModules: true` and
an externals list that doesn't cover test deps, rollup faithfully
outputs `vitest`, `@vitest`, `@open-wc`, `magic-string`, `tinyrainbow`,
etc. under `dist/node_modules/`. Extend the input glob's `ignore` to
also exclude `*.spec.ts`, `*.test.ts`, `src/storybook-util.ts`, and
`src/ar/_test-utils.ts`, and mirror the same exclude on
`vite-plugin-dts` so it stops emitting `.d.ts` for those files.
**No `files` allowlist.** Without one, npm publishes everything in
the package directory:
- `__vis__/linux/` (40 MB) — Playwright visual baselines
- `src/` (7 MB) — TS source, redundant with `dist/`
- `public/` (8 MB) — demo assets
- `AR-test-image.png` × 3 (24 MB) and `NotoSans.ttf` × 3 (1.8 MB) —
same assets shipped in `bundle/`, `dist/`, `public/`
- `companylogo-day.png` — demo asset used only by Storybook stories
Add an explicit `files` allowlist scoped to `dist/`, the standalone
bundle + sourcemap, and the custom-elements manifest. Drop
`dist/AR-test-image.png` and `dist/companylogo-day.png` via negation
since neither is referenced by shipped code. Keep one copy of
`NotoSans.ttf` (in `dist/`) so consumers can `@font-face` against it.
Also delete `public/vite.svg` — leftover from initial `npm create vite`
scaffolding, unreferenced anywhere — so it no longer auto-copies into
`dist/` during the regular build.
Result (measured locally): **7.2 MB tarball / 55.0 MB unpacked / 9,698
files** — down from ~59 MB / 136 MB / 14,173.1 parent c4eb8f5 commit 1bfb1c5
3 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
| |||
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
65 | 80 | | |
66 | 81 | | |
67 | 82 | | |
| |||
0 commit comments