feat(add): write v0 examples into a project from the registry - #27
Draft
johnleider wants to merge 9 commits into
Draft
feat(add): write v0 examples into a project from the registry#27johnleider wants to merge 9 commits into
johnleider wants to merge 9 commits into
Conversation
`vuetify add` only handled integrations. It now also resolves a name against the v0 registry, so `vuetify add dialog` copies a runnable, styled example in instead of leaving the user to find it in the docs and paste it by hand. It copies the example, not the primitive's source. v0 is a published package, so ejecting `Dialog` itself would fork a consumer off the upgrade path for no gain; the file they cannot get today is the one that actually renders. The styling preflight is the part that makes this work at all. Examples style themselves with semantic utilities (`bg-primary`, `text-on-surface`), which need two layers: `createThemePlugin` to emit the `--v0-*` custom properties, and an UnoCSS or Tailwind config to map them. Copying the markup without them produces something that looks broken and reads as v0's fault, so `add` detects both, offers the patch, and warns when the theme plugin is absent. The UnoCSS config is edited through magicast — appending the block would leave the file syntactically invalid — and existing colors are preserved. Non-interactive runs stay unblocked and non-destructive: `--yes` picks the canonical example, refuses to guess between ambiguous names, and skips existing files rather than clobbering them, leaving `--overwrite` as the explicit opt-in. New strings are English-only; `enableFallback` covers ru until translated.
Phase 1 of the local component-library lifecycle: successful `vuetify add` records origin, path, and files into project inventory, with `list` and `status` commands for inspection and disk health checks.
Match the docs registry item shape so soft-deps can act on collections without reverse-engineering utility class names.
User-facing warnings point at the docs/registry plugin (useTheme) so `vuetify add use-theme` is the obvious next step. Detection still scans for createThemePlugin in app code.
Use registry title (useTheme, Dialog, createDataTable) for interactive option labels and suggestions; keep kebab name as the resolve value.
Insert disabled section headers so interactive select no longer mixes component and composable families. Transformers get their own group.
Clack disabled options cannot be restyled as true headings; a light ── prefix makes section boundaries obvious in the picker.
Plugins like useTheme wire create*Plugin into the app (src/plugins + main.ts/registerPlugins) instead of only seeding docs examples. Examples are opt-in via --example or an interactive confirm; --yes installs only.
Complete the local component-library lifecycle on the CLI: scaffold components, diff/refresh against registry origins, resolve @alias registries, publish a local registry, and prefer install recipes from registry JSON when present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vuetify addconsumers for the docs registry seed, plus the local component-library lifecycle:vuetify.jsoncreate*Plugin(registryinstallrecipe preferred)@alias/nameand--registryPairs with docs seed: vuetifyjs/0#721
Test plan
add dialog,add use-theme, list/statusgenerate MyCard→registry build→ serve parent →add my-card --registry …diff/refreshon tracked itemsadd @local/fooafter alias invuetify.json