feat(premium-analytics): port icons package from next-woocommerce-analytics#49224
Conversation
Required by the icons package being ported in subsequent commits. Refs WOOA7S-1314
…lytics Verbatim port of the 13 illustrated WPDS icons (calendar, channel, coupon, customer, device, goal, location, megaphone, payment, payment-return, product-blouse, reports, search) plus the barrel index that re-exports navigation/settings/plus/info from @wordpress/icons. The upstream stories file is dropped (depends on @wordpress/ui — a CIAB-only package). The upstream leaf tsconfig.json is also dropped: this package's parent tsconfig already covers packages/**/*. The leaf package.json is added in a follow-up commit (adapted for the monorepo, not copyable verbatim). Refs WOOA7S-1314
Adapt upstream package.json for the Jetpack monorepo: - Rename to @automattic/jetpack-premium-analytics-icons (the import specifier @jetpack-premium-analytics/icons comes from the parent's wpPlugin.packageNamespace; see parent README). - private: true and version 0.1.0 (matches sibling packages/init). - Pin @wordpress/primitives 4.46.0 (Jetpack convention) and bump @wordpress/icons to ^13.0.0 (matches parent). - Add main/types pointing at src/index.ts and sideEffects: false so tooling can resolve the package from source. - Drop upstream wpModule/exports (CIAB-specific build conventions) and the design-system / @wordpress/ui devDeps (only used by the now-dropped stories file). Refs WOOA7S-1314
The upstream icons package shipped no README; document the exported icons, the WPDS / @wordpress/icons split, and the dual-naming convention link back to the parent README. Refs WOOA7S-1314
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
@wordpress/ui is a published package (already pinned at 0.13.0 by sibling packages videopress and publicize), not CIAB-only — restore the upstream stories gallery so the icons remain discoverable. Adaptations from upstream: - Title: 'Icons/Gallery' → 'Packages/Premium Analytics/Icons' (Jetpack story-tree convention). - Add component: Icon to the default export to satisfy storybook/csf-component. - Drop the External/Internal-dependencies comment separators and the blank line between import groups so import/order passes. Adds @wordpress/ui@0.13.0 and @storybook/react@10.3.6 as devDeps on both the parent and the leaf package.json (parent so pnpm resolves them; leaf so import/no-extraneous-dependencies finds them). Note: the stories file is not yet wired into the central Storybook config at projects/js-packages/storybook/storybook/projects.js, so it won't render in Storybook until that list is extended. Tracked separately. Refs WOOA7S-1314
Adding @storybook/react@10.3.6 as a devDep brings unmet peer dependencies (storybook, typescript, @testing-library/dom) that ERR_PNPM_PEER_DEP_ISSUES blocks fresh CI installs on. Pin the same versions sibling packages videopress and publicize already pin: storybook@10.3.6 typescript@5.9.3 @testing-library/dom@10.4.1 Refs WOOA7S-1314
…and-typescript-for-internal-packages' into wooa7s-1314-integrate-icons-package-into-analytics # Conflicts: # pnpm-lock.yaml # projects/packages/premium-analytics/package.json
dognose24
left a comment
There was a problem hiding this comment.
Walked through local verification (Node 24.14.0, branch tip):
pnpm typecheck— exit 0pnpm build— icons transpiled (56ms), full build clean (icons not bundled, matches description's "nowpScripttriple" choice)pnpm exec eslint --flag v10_config_lookup_from_file --max-warnings=0 packages/icons/— exit 0- Smoke import (
calendar+megaphonefromroutes/dashboard/stage.tsx) — typecheck passes via the@jetpack-premium-analytics/*alias. Note: at this point in the stack nolink:dep is wired, sopnpm buildcan't resolve the same import (by design per PR description — no consumer wires it yet).
One mismatch with the PR description: it mentions "re-exports from @wordpress/icons for utility glyphs (dashboard/navigation, settings, plus, info)" but src/index.ts has no re-exports — only the 13 local illustrated icons. The README is internally consistent (only the 13 are listed), so this looks like a description-only mismatch worth updating.
Two small doc nits inline. Otherwise LGTM. Disclosure: downstream consumer of these icons via WOOA7S-1329 (dashboard menu icon + widget headers need these).
Proposed changes
Second leaf in M2 — Shared Packages Integration (WOOA7S-1311): port
@next-woo-analytics/iconsinto@automattic/jetpack-premium-analyticsas an internal package. Provides 13 illustrated WPDS icons (calendar,channel,coupon,customer,device,goal,location,megaphone,payment,payment-return,product-blouse,reports,search). Utility glyphs (dashboard/navigation,settings,plus,info) are imported directly from@wordpress/iconsby consumers — the re-exports originally ported here were dropped during review.A true leaf — no internal deps, only
@wordpress/primitives. Stacked on #49189 (which sets up the@jetpack-premium-analytics/*tsconfig paths alias this work relies on); sibling to the datetime port (#49221) and shares its conventions.What's in the package
src/index.tssrc/<icon>/index.tsx× 13var(--wpds-color-*))src/stories/icons.stories.tsxREADME.md@wordpress/iconsrationaleAudit vs
@wordpress/iconsPer the Linear issue, audited the 13 illustrated icons against
@wordpress/icons(tier 1) before porting. Names overlap forcalendar,megaphone,payment,search, but upstream ships 24×24 monochrome glyphs designed forfill: currentColor— visually distinct from these multi-fill WPDS illustrations. No swap warranted. The 4 utility icons (dashboard/navigation,settings,plus,info) already come from upstream — initially preserved as re-exports, then dropped during review so the package stays free of upstream names; consumers import them directly from@wordpress/icons.Monorepo adaptations
name: @next-woo-analytics/iconsname: @automattic/jetpack-premium-analytics-iconsREADME.md— the import specifier (@jetpack-premium-analytics/icons) comes fromwpPlugin.packageNamespace; thename:field is separate and must use the@automattic/...form@wordpress/primitives: "*",@wordpress/icons: "*"@wordpress/primitives: 4.46.0,@wordpress/icons: ^13.0.0minimumReleaseAge: 1440which conflicts with"*"wpModule: true,exports: { ".": "./build/src/index.js" }wpScript: true,module: "build-module/index.mjs",wpScriptModuleExports: "./build-module/index.mjs"wpModule: truetold CIAB's wp-build to emit a standalone script module (build/packages/icons/index.js+index.asset.php).@wordpress/build'sdependency-graph.mjshas the equivalent triple —wpScript: true+module+wpScriptModuleExports— used by siblingpackages/init/. Skipped here because this leaf is consumed inline as TypeScript source (same pattern as thedatetimeleaf in #49221), not emitted as a separate runtime bundle. Can be promoted towpScriptlater if a consumer wants the deduplicated module.devDependencies: @automattic/design-system@wordpress/uiis actually imported by the stories filetsconfig.jsonincludes: [packages/**/*]; siblingpackages/init/has no leaf tsconfig eithersrc/stories/icons.stories.tsxtitleIcons/GalleryPackages/Premium Analytics/Iconscomponentimport/order); addcomponent: Iconto satisfystorybook/csf-componentStructural changes at the parent level:
package.jsondependencies: add@wordpress/primitives@4.46.0so the leaf's imports resolve undertsgoandeslint.package.jsondevDependencies: add@wordpress/ui@0.13.0,@storybook/react@10.3.6, plus its peer pins (storybook@10.3.6,typescript@5.9.3,@testing-library/dom@10.4.1) — matching the versions already pinned byprojects/packages/videopressandprojects/packages/publicize— so fresh CI installs don'tERR_PNPM_PEER_DEP_ISSUES.packages/icons/is not a pnpm workspace member (the rootpnpm-workspace.yamlglobprojects/*/*doesn't reach in two levels), so pnpm only sees the parent. The leafpackage.jsondeps are declared mainly soimport/no-extraneous-dependenciesfinds them. Same reasoning as the datetime port (#49221).What's intentionally not here
link:dep on the parent yet. Same reasoning as the datetime port:eslint-plugin-package-json'svalid-dependenciesrule rejectslink:URLs by default, and no route or sibling package consumesiconsyet — wp-build'spackages/*autodiscovery is enough.projects/js-packages/storybook/storybook/projects.jsstill has an explicit project allowlist that doesn't yet includepremium-analytics. The file lints and typechecks; it'll start rendering in Storybook once that list is extended (separate scope).Commit structure
Split for reviewability:
chore: add @wordpress/primitives dependency— setup so the leaf's imports resolvefeat: copy icons sources from next-woocommerce-analytics— verbatim source files (13 icon TSX files + barrel)feat: add icons package manifest— adapted leafpackage.json(rename, pin, drop CIAB-isms)docs: add icons README— new for monorepochangelog: add entryfeat: restore icons stories with Jetpack adaptations— restore the upstream gallery + wire up@wordpress/ui/@storybook/reactdevDepschore: pin @storybook/react peer deps— pinstorybook/typescript/@testing-library/domto satisfy peers on fresh installsRelated product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Requires Node 24 (repo
engineStrict).Optional smoke import, to confirm the path alias works through the typechecker:
routes/dashboard/stage.tsx:pnpm typecheck— resolves and passes.Optional — build-time resolution via
link:(confirms wp-build tracks the package as a module dependency once a consumer imports it):projects/packages/premium-analytics/package.jsondependencies:"@jetpack-premium-analytics/icons": "link:packages/icons"(thevalid-dependencieslint rejectslink:— relax it for the temp edit).iconsexport inroutes/dashboard/stage.tsx.pnpm install && pnpm build→build/routes/dashboard/content.min.asset.phplists the dependency undermodule_dependencies.pnpm install.