refactor: align v2 with main's monorepo structure and tooling (vitest, storybook test, workshop folded in)#2265
Conversation
Move the published @sanity/ui package from the repo root into packages/ui, the Figma plugin into packages/figma, and Storybook into apps/storybook, mirroring the monorepo layout on the main branch. The repo root becomes a private workspace root (sanity-ui-monorepo) that orchestrates via pnpm filters. - semantic-release now runs from packages/ui (release config and CHANGELOG moved along with the package) - eslint configs are now per-package (packages/ui and apps/storybook) - stories import @sanity/ui sources from packages/ui; the storybook app is a private workspace package with its own vercel.json - cypress e2e stays at the root and keeps testing the workshop build; the root workshop:build copies packages/ui/dist into dist/ so the existing Vercel setup and CI keep working, and packages/ui gets its own vercel.json for deploys rooted at the package - pnpm overrides now use literal versions (previously $-references to root devDependencies which no longer exist)
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…t addon) Mirror the testing setup from the main branch: - packages/ui unit tests now run with vitest (jsdom, vitest-axe, @testing-library/jest-dom/vitest). The vitest config aliases @sanity/ui to the package source, so tests no longer require a build first. - Storybook is upgraded from 8.6 to 10 and gains @storybook/addon-vitest: every story runs as a browser smoke test in headless Chromium (playwright), and the cypress e2e specs are ported to story play functions (Autocomplete, MenuButton, Dialog, Tab, TextInput, Layer) and viewport-controlled browser tests in apps/storybook/tests/ (Box, Grid, Layer z-offset, MenuButton tab behavior). - The mdx-only pages (Colors, FocusRings, Tones, README) are converted to regular stories / markdown, matching main. - cypress is removed entirely (specs, config, root deps and scripts); the CI cypress job is replaced with a storybook-test job that installs and caches the playwright chromium browser and runs pnpm test:browser. The unit test job no longer needs a build step. - vitest is pinned to 4.1.9 (4.1.10 has an inline snapshot regression), and packages/ui gets a vite ^7 devDependency so vitest resolves vite 7 rather than deduping onto the workshop's vite 6, which breaks inline snapshot state in multi-file runs.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Mirror main's move of the workshop into the Storybook app: - Adopt the Storybook stories from main that fold in the workshop fixtures (richer component stories plus new hooks/, theme/, utils/ sections and a shared options.ts), adapted to the v2 component API (space instead of the v3-only gap argType, column/row grid item props, ButtonProps, no polymorphic as-prop inference) - Delete every src/**/__workshop__ directory and the workshop tooling (workshop.config.ts, workshop.runtime.ts, the fonts plugin, workshop-env.d.ts) and drop the @sanity/ui-workshop dependency - Move the autocomplete __mocks__ used by stories into apps/storybook - Remove the workshop deploy configs (root vercel.json and packages/ui/vercel.json); the Storybook app keeps its own vercel.json - pnpm dev now starts Storybook only; the workshop:* scripts, http-server and npm-run-all2 root deps are gone
Summary
Gives the
v2branch the same monorepo structure and tooling asmain, in three commits:1. Monorepo structure (
refactor: structure as a pnpm monorepo matching main)packages/ui— the published@sanity/uipackage;packages/figma— the Figma plugin (nowprivate);apps/storybook— Storybook as a private workspace app; private workspace root (sanity-ui-monorepo) orchestrating via pnpm filtersgit mvso history follows renamespackages/ui(release config + CHANGELOG moved with the package)pnpm.overridesuse literal versions (previous$-references pointed at root devDependencies that no longer exist)2. Testing modernization (
test: replace jest with vitest and cypress with storybook test)Mirrors main's
9c116d2c:packages/ui(jsdom per test file,vitest-axe,@testing-library/jest-dom/vitest);@sanity/uiis aliased to source so unit tests need no build@storybook/addon-vitest: every story runs as a browser smoke test in headless Chromium (playwright)playfunctions andapps/storybook/tests/viewport/browser tests; cypress fully removed; CI cypress job replaced with astorybook-testjob (cached playwright browser)4.1.9(4.1.10 has an inline-snapshot regression) with avite@^7devDependency inpackages/uiso vitest doesn't dedupe onto vite 63. Workshop folded into Storybook (
refactor: fold the workshop into Storybook)Mirrors main's
c051b4e4:hooks/,theme/, andutils/sidebar sections (UseElementRect, UseMediaIndex, BoundaryElement, ElementQuery, Layer, Portal, VirtualList, theme Debug/Build/Canvas/Color) and a sharedoptions.tsspaceinstead ofgapargTypes,column/rowgrid-item props,ButtonProps, no polymorphicas-prop inference)src/**/__workshop__directory, the workshop tooling (workshop.config.ts,workshop.runtime.ts, fonts plugin,workshop-env.d.ts) and the@sanity/ui-workshopdependency; autocomplete__mocks__move into the Storybook appvercel.json,packages/ui/vercel.json);pnpm devnow starts Storybook onlyDemo
workshop_stories_in_storybook_demo.mp4
Former workshop content in Storybook: UseElementRect hook demo, VirtualList, Layer z-offset debug, theme Debug and Build stories, and the new HOOKS / UTILS / THEME sidebar sections.
Sidebar with hooks, utils, theme sections
Earlier demos: storybook10_vitest_play_tests_demo.mp4 (Storybook 10 + vitest addon play tests) and storybook_and_workshop_monorepo_demo.mp4 (initial monorepo restructure).
Testing
pnpm test— 28 vitest suites, 79 unit tests pass (no build needed)pnpm test:browser— 55 files, 239 browser tests pass (every story as a smoke test incl. the folded-in workshop stories, play functions, viewport tests)pnpm build(@sanity/ui+ figma plugin),pnpm storybook:build(Storybook 10)pnpm ts:check,pnpm lint --max-warnings 0,pnpm exec prettier --check .pnpm install --frozen-lockfilepnpm --filter @sanity/ui exec semantic-release --dry-run(config loads frompackages/ui)To show artifacts inline, enable in settings.