Skip to content

feat(premium-analytics): port icons package from next-woocommerce-analytics#49224

Open
chihsuan wants to merge 12 commits into
wooa7s-1320-configure-workspace-and-typescript-for-internal-packagesfrom
wooa7s-1314-integrate-icons-package-into-analytics
Open

feat(premium-analytics): port icons package from next-woocommerce-analytics#49224
chihsuan wants to merge 12 commits into
wooa7s-1320-configure-workspace-and-typescript-for-internal-packagesfrom
wooa7s-1314-integrate-icons-package-into-analytics

Conversation

@chihsuan
Copy link
Copy Markdown
Member

@chihsuan chihsuan commented May 28, 2026

Proposed changes

Second leaf in M2 — Shared Packages Integration (WOOA7S-1311): port @next-woo-analytics/icons into @automattic/jetpack-premium-analytics as 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/icons by 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

File Purpose
src/index.ts Barrel — the 13 local illustrated icons
src/<icon>/index.tsx × 13 Branded multi-fill WPDS illustrations (48×48 for most; fills driven by var(--wpds-color-*))
src/stories/icons.stories.tsx Storybook gallery of every exported icon
README.md Exports list, WPDS vs @wordpress/icons rationale

Audit vs @wordpress/icons

Per the Linear issue, audited the 13 illustrated icons against @wordpress/icons (tier 1) before porting. Names overlap for calendar, megaphone, payment, search, but upstream ships 24×24 monochrome glyphs designed for fill: 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

Upstream Here Why
name: @next-woo-analytics/icons name: @automattic/jetpack-premium-analytics-icons Per the internal-packages convention in the parent README.md — the import specifier (@jetpack-premium-analytics/icons) comes from wpPlugin.packageNamespace; the name: field is separate and must use the @automattic/... form
@wordpress/primitives: "*", @wordpress/icons: "*" @wordpress/primitives: 4.46.0, @wordpress/icons: ^13.0.0 Jetpack convention — every other package pins concrete versions; the repo also sets minimumReleaseAge: 1440 which conflicts with "*"
wpModule: true, exports: { ".": "./build/src/index.js" } wpScript: true, module: "build-module/index.mjs", wpScriptModuleExports: "./build-module/index.mjs" Upstream wpModule: true told CIAB's wp-build to emit a standalone script module (build/packages/icons/index.js + index.asset.php). @wordpress/build's dependency-graph.mjs has the equivalent triple — wpScript: true + module + wpScriptModuleExports — used by sibling packages/init/. Skipped here because this leaf is consumed inline as TypeScript source (same pattern as the datetime leaf in #49221), not emitted as a separate runtime bundle. Can be promoted to wpScript later if a consumer wants the deduplicated module.
devDependencies: @automattic/design-system (removed) Unused — only @wordpress/ui is actually imported by the stories file
Leaf tsconfig.json (deleted) Parent already includes: [packages/**/*]; sibling packages/init/ has no leaf tsconfig either
src/stories/icons.stories.tsx title Icons/Gallery Packages/Premium Analytics/Icons Jetpack story-tree convention
Stories file imports / component Drop External/Internal comment separators (Jetpack import/order); add component: Icon to satisfy storybook/csf-component Lint conventions

Structural changes at the parent level:

  • package.json dependencies: add @wordpress/primitives@4.46.0 so the leaf's imports resolve under tsgo and eslint.
  • package.json devDependencies: 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 by projects/packages/videopress and projects/packages/publicize — so fresh CI installs don't ERR_PNPM_PEER_DEP_ISSUES.

packages/icons/ is not a pnpm workspace member (the root pnpm-workspace.yaml glob projects/*/* doesn't reach in two levels), so pnpm only sees the parent. The leaf package.json deps are declared mainly so import/no-extraneous-dependencies finds them. Same reasoning as the datetime port (#49221).

What's intentionally not here

  • No link: dep on the parent yet. Same reasoning as the datetime port: eslint-plugin-package-json's valid-dependencies rule rejects link: URLs by default, and no route or sibling package consumes icons yet — wp-build's packages/* autodiscovery is enough.
  • No Storybook discovery wiring. The stories file is committed but projects/js-packages/storybook/storybook/projects.js still has an explicit project allowlist that doesn't yet include premium-analytics. The file lints and typechecks; it'll start rendering in Storybook once that list is extended (separate scope).
  • No tests. The upstream package ships no tests; not adding speculative ones here.

Commit structure

Split for reviewability:

  1. chore: add @wordpress/primitives dependency — setup so the leaf's imports resolve
  2. feat: copy icons sources from next-woocommerce-analytics — verbatim source files (13 icon TSX files + barrel)
  3. feat: add icons package manifest — adapted leaf package.json (rename, pin, drop CIAB-isms)
  4. docs: add icons README — new for monorepo
  5. changelog: add entry
  6. feat: restore icons stories with Jetpack adaptations — restore the upstream gallery + wire up @wordpress/ui / @storybook/react devDeps
  7. chore: pin @storybook/react peer deps — pin storybook / typescript / @testing-library/dom to satisfy peers on fresh installs

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Requires Node 24 (repo engineStrict).

pnpm install
cd projects/packages/premium-analytics
pnpm typecheck   # tsgo --noEmit — passes
pnpm build       # wp-build — passes (~150ms)
pnpm exec eslint --flag v10_config_lookup_from_file --max-warnings=0 packages/icons/   # clean

Optional smoke import, to confirm the path alias works through the typechecker:

  1. Edit routes/dashboard/stage.tsx:
    import { calendar } from "@jetpack-premium-analytics/icons";
    void calendar;
  2. pnpm typecheck — resolves and passes.
  3. Revert the edit.

Optional — build-time resolution via link: (confirms wp-build tracks the package as a module dependency once a consumer imports it):

  1. Add to projects/packages/premium-analytics/package.json dependencies: "@jetpack-premium-analytics/icons": "link:packages/icons" (the valid-dependencies lint rejects link: — relax it for the temp edit).
  2. Import + reference a icons export in routes/dashboard/stage.tsx.
  3. pnpm install && pnpm buildbuild/routes/dashboard/content.min.asset.php lists the dependency under module_dependencies.
  4. Revert the edits + pnpm install.

Note: the @jetpack-premium-analytics/icons specifier is a temporary bridge inherited from the source repo. Once name-based identity (WordPress/gutenberg#78822, mirrored monorepo-wide by #48089) lands, the specifier becomes the package's own name (@automattic/jetpack-premium-analytics-icons) and the bare-scope alias/link: drop out — so long term there's no @jetpack-premium-analytics/... to maintain. The package README's usage example uses the working @jetpack-premium-analytics/icons specifier.

chihsuan added 5 commits May 28, 2026 15:34
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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the wooa7s-1314-integrate-icons-package-into-analytics branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack wooa7s-1314-integrate-icons-package-into-analytics
bin/jetpack-downloader test jetpack-mu-wpcom-plugin wooa7s-1314-integrate-icons-package-into-analytics

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • 🔴 Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 28, 2026
@chihsuan chihsuan self-assigned this May 28, 2026
chihsuan added 2 commits May 28, 2026 15:51
@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
@chihsuan chihsuan requested review from a team and retrofox May 28, 2026 08:05
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 28, 2026

Code Coverage Summary

No summary data is available for parent commit 2beeaa9, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 2beeaa9 is available.

Full summary · PHP report · JS report

Comment thread projects/packages/premium-analytics/packages/icons/README.md Outdated
chihsuan added 3 commits May 29, 2026 16:21
…and-typescript-for-internal-packages' into wooa7s-1314-integrate-icons-package-into-analytics

# Conflicts:
#	pnpm-lock.yaml
#	projects/packages/premium-analytics/package.json
Copy link
Copy Markdown
Contributor

@dognose24 dognose24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Walked through local verification (Node 24.14.0, branch tip):

  • pnpm typecheck — exit 0
  • pnpm build — icons transpiled (56ms), full build clean (icons not bundled, matches description's "no wpScript triple" choice)
  • pnpm exec eslint --flag v10_config_lookup_from_file --max-warnings=0 packages/icons/ — exit 0
  • Smoke import (calendar + megaphone from routes/dashboard/stage.tsx) — typecheck passes via the @jetpack-premium-analytics/* alias. Note: at this point in the stack no link: dep is wired, so pnpm build can'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).

Comment thread projects/packages/premium-analytics/packages/icons/README.md Outdated
Comment thread projects/packages/premium-analytics/packages/icons/README.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Premium Analytics [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants