Files
stanza/registry/modules/ui-tailwind/module.ts
T
jake 678b5bc1af feat: add ui-shadcn-base, ui-shadcn-radix, and ui-tailwind modules; rename styling category to ui
- Rename `styling` → `ui` across the entire codebase (CATEGORIES array, docs, AGENTS.md, CLI tests, resolver, template tests, codemod runner); `ui` is `home: package` so shadcn installs into `packages/ui/` as a workspace dep rather than wiring directly into the app shell
- Add `ui-shadcn-base` (Tailwind v4 / CSS-first, no Radix peer) and `ui-shadcn-radix` (Tailwind v4 + Radix primitives) with full per-framework template sets for Next.js and TanStack Start: `components.json`, `globals.css`, `postcss.config.mjs`, `theme-provider.tsx`, shared `Button` + `utils.ts`; light/dark logos inlined from svgl
- Rename `styling-tailwind` → `ui-tailwind` to match the new category id; update its module definition to `category: "ui"` and `home: package`
- Add four new codemod builtins with tests: `add-array-entry-in-call` (inserts an element into a named array argument of any `CallExpression`), `replace-import` (rewrites a specifier in an existing import declaration), `set-html-attributes` (sets attributes on an HTML/JSX element by tag name or selector), `set-tsconfig-paths` (merges `compilerOptions` entries into a `tsconfig.json` AST node); register all four in the builtins index and export from `@stanza/codemods`
- Add `wrap-root-layout` builtin tests
- Update registry.mdx, concepts.mdx, cli.mdx, getting-started.mdx, agents.mdx, index.mdx, AGENTS.md, README.md, TODO.md, and SKILL.md to reflect the category rename and new modules
2026-05-25 15:26:08 -04:00

86 lines
2.9 KiB
TypeScript

import { defineModule } from "@stanza/registry";
export default defineModule({
id: "tailwind",
category: "ui",
label: "Tailwind CSS",
description: "Utility-first CSS framework. Pairs with any web framework.",
version: "0.2.0",
peers: { framework: ["next", "tanstack-start"] },
homepage: "https://tailwindcss.com",
// `tailwindcss` itself is shared; the per-framework integration dep varies.
devDependencies: { tailwindcss: "^4.3.0" },
adapters: [
{
key: "next",
match: { framework: "next" },
devDependencies: {
"@tailwindcss/postcss": "^4.3.0",
postcss: "^8.5.15",
},
templates: [
// Real plugin config lives in `packages/ui/` alongside the deps so
// pnpm's isolated linker exposes `@tailwindcss/postcss` to it. The
// app's `postcss.config.mjs` just re-exports it via the workspace
// package's subpath export.
{ src: "package/postcss.config.mjs", dest: "postcss.config.mjs", scope: "package" },
{
src: "next/postcss.config.mjs",
dest: "postcss.config.mjs",
scope: "app",
template: true,
},
],
codemods: [
{
// framework-next ships its own `app/globals.css` with base styles.
// Prepend Tailwind's `@import` so the CSS is well-formed (@import
// must precede all other rules) and we don't fight the framework
// module for ownership of the whole file.
id: "append-to-file",
args: {
file: "app/globals.css",
content: '@import "tailwindcss";',
marker: "tailwind",
position: "start",
},
},
],
},
{
key: "tanstack-start",
match: { framework: "tanstack-start" },
devDependencies: { "@tailwindcss/vite": "^4.3.0" },
codemods: [
{
// framework-tanstack-start ships `src/globals.css` (imported from
// `__root.tsx`); prepend Tailwind's `@import` so CSS stays valid
// (@import must precede all other rules). Same shape as the next
// adapter for symmetry.
id: "append-to-file",
args: {
file: "src/globals.css",
content: '@import "tailwindcss";',
marker: "tailwind",
position: "start",
},
},
{
// Splice tailwindcss() into the framework's existing vite.config.ts
// between tanstackStart() and react() — Start's plugin order is
// strict, and we want Tailwind compiled before React's JSX transform.
id: "add-plugin-to-call",
args: {
file: "vite.config.ts",
callee: "defineConfig",
property: "plugins",
call: "tailwindcss()",
imports: [{ from: "@tailwindcss/vite", default: "tailwindcss" }],
position: "before:react",
},
},
],
},
],
});