From fae5e7829263d80eb4b19bdcc9b8ea595060b837 Mon Sep 17 00:00:00 2001 From: shadcn Date: Thu, 26 Feb 2026 17:11:56 +0400 Subject: [PATCH] feat: add astro template --- .changeset/happy-days-drum.md | 5 ++ .../(create)/components/template-picker.tsx | 4 + apps/v4/app/(create)/lib/search-params.ts | 2 + apps/v4/content/docs/(root)/meta.json | 2 +- apps/v4/content/docs/(root)/new.mdx | 78 ++++++++++++------- apps/v4/registry/config.ts | 2 + apps/v4/scripts/build-registry.mts | 2 + packages/shadcn/src/templates/astro.ts | 60 ++++++++++++++ packages/shadcn/src/templates/index.ts | 2 + templates/astro-app/.gitignore | 23 ++++++ templates/astro-app/.prettierignore | 6 ++ templates/astro-app/.prettierrc | 19 +++++ templates/astro-app/README.md | 36 +++++++++ templates/astro-app/astro.config.mjs | 13 ++++ templates/astro-app/eslint.config.js | 23 ++++++ templates/astro-app/package.json | 37 +++++++++ templates/astro-app/public/favicon.svg | 3 + templates/astro-app/src/layouts/main.astro | 15 ++++ templates/astro-app/src/pages/index.astro | 20 +++++ templates/astro-app/src/styles/global.css | 1 + templates/astro-app/tsconfig.json | 13 ++++ templates/astro-monorepo/.gitignore | 33 ++++++++ templates/astro-monorepo/.npmrc | 1 + templates/astro-monorepo/.prettierignore | 6 ++ templates/astro-monorepo/.prettierrc | 19 +++++ templates/astro-monorepo/README.md | 39 ++++++++++ .../astro-monorepo/apps/web/astro.config.mjs | 13 ++++ .../astro-monorepo/apps/web/components.json | 20 +++++ .../astro-monorepo/apps/web/eslint.config.js | 23 ++++++ .../astro-monorepo/apps/web/package.json | 35 +++++++++ .../apps/web/public/favicon.svg | 3 + .../apps/web/src/components/.gitkeep | 0 .../apps/web/src/layouts/main.astro | 15 ++++ .../astro-monorepo/apps/web/src/lib/.gitkeep | 0 .../apps/web/src/pages/index.astro | 28 +++++++ .../astro-monorepo/apps/web/tsconfig.json | 14 ++++ templates/astro-monorepo/package.json | 23 ++++++ .../packages/ui/components.json | 20 +++++ .../packages/ui/eslint.config.js | 23 ++++++ .../astro-monorepo/packages/ui/package.json | 37 +++++++++ .../packages/ui/src/components/.gitkeep | 0 .../packages/ui/src/hooks/.gitkeep | 0 .../packages/ui/src/lib/.gitkeep | 0 .../packages/ui/src/styles/globals.css | 4 + .../astro-monorepo/packages/ui/tsconfig.json | 18 +++++ .../packages/ui/tsconfig.lint.json | 14 ++++ templates/astro-monorepo/pnpm-workspace.yaml | 3 + templates/astro-monorepo/tsconfig.json | 9 +++ templates/astro-monorepo/turbo.json | 15 ++++ 49 files changed, 752 insertions(+), 29 deletions(-) create mode 100644 .changeset/happy-days-drum.md create mode 100644 packages/shadcn/src/templates/astro.ts create mode 100644 templates/astro-app/.gitignore create mode 100644 templates/astro-app/.prettierignore create mode 100644 templates/astro-app/.prettierrc create mode 100644 templates/astro-app/README.md create mode 100644 templates/astro-app/astro.config.mjs create mode 100644 templates/astro-app/eslint.config.js create mode 100644 templates/astro-app/package.json create mode 100644 templates/astro-app/public/favicon.svg create mode 100644 templates/astro-app/src/layouts/main.astro create mode 100644 templates/astro-app/src/pages/index.astro create mode 100644 templates/astro-app/src/styles/global.css create mode 100644 templates/astro-app/tsconfig.json create mode 100644 templates/astro-monorepo/.gitignore create mode 100644 templates/astro-monorepo/.npmrc create mode 100644 templates/astro-monorepo/.prettierignore create mode 100644 templates/astro-monorepo/.prettierrc create mode 100644 templates/astro-monorepo/README.md create mode 100644 templates/astro-monorepo/apps/web/astro.config.mjs create mode 100644 templates/astro-monorepo/apps/web/components.json create mode 100644 templates/astro-monorepo/apps/web/eslint.config.js create mode 100644 templates/astro-monorepo/apps/web/package.json create mode 100644 templates/astro-monorepo/apps/web/public/favicon.svg create mode 100644 templates/astro-monorepo/apps/web/src/components/.gitkeep create mode 100644 templates/astro-monorepo/apps/web/src/layouts/main.astro create mode 100644 templates/astro-monorepo/apps/web/src/lib/.gitkeep create mode 100644 templates/astro-monorepo/apps/web/src/pages/index.astro create mode 100644 templates/astro-monorepo/apps/web/tsconfig.json create mode 100644 templates/astro-monorepo/package.json create mode 100644 templates/astro-monorepo/packages/ui/components.json create mode 100644 templates/astro-monorepo/packages/ui/eslint.config.js create mode 100644 templates/astro-monorepo/packages/ui/package.json create mode 100644 templates/astro-monorepo/packages/ui/src/components/.gitkeep create mode 100644 templates/astro-monorepo/packages/ui/src/hooks/.gitkeep create mode 100644 templates/astro-monorepo/packages/ui/src/lib/.gitkeep create mode 100644 templates/astro-monorepo/packages/ui/src/styles/globals.css create mode 100644 templates/astro-monorepo/packages/ui/tsconfig.json create mode 100644 templates/astro-monorepo/packages/ui/tsconfig.lint.json create mode 100644 templates/astro-monorepo/pnpm-workspace.yaml create mode 100644 templates/astro-monorepo/tsconfig.json create mode 100644 templates/astro-monorepo/turbo.json diff --git a/.changeset/happy-days-drum.md b/.changeset/happy-days-drum.md new file mode 100644 index 0000000000..4dc297b390 --- /dev/null +++ b/.changeset/happy-days-drum.md @@ -0,0 +1,5 @@ +--- +"shadcn": major +--- + +add astro template support diff --git a/apps/v4/app/(create)/components/template-picker.tsx b/apps/v4/app/(create)/components/template-picker.tsx index bcc23a4a76..5c11a333ed 100644 --- a/apps/v4/app/(create)/components/template-picker.tsx +++ b/apps/v4/app/(create)/components/template-picker.tsx @@ -25,10 +25,14 @@ const VITE_LOGO = const LARAVEL_LOGO = 'Laravel' +const ASTRO_LOGO = + 'Astro' + export const TEMPLATES = [ [ { value: "next", title: "Next.js", logo: NEXT_LOGO }, { value: "vite", title: "Vite", logo: VITE_LOGO }, + { value: "astro", title: "Astro", logo: ASTRO_LOGO }, ], [ { value: "start", title: "TanStack Start", logo: START_LOGO }, diff --git a/apps/v4/app/(create)/lib/search-params.ts b/apps/v4/app/(create)/lib/search-params.ts index 1cbf55fd28..c092c4db95 100644 --- a/apps/v4/app/(create)/lib/search-params.ts +++ b/apps/v4/app/(create)/lib/search-params.ts @@ -73,6 +73,8 @@ const designSystemSearchParams = { "react-router-monorepo", "vite", "vite-monorepo", + "astro", + "astro-monorepo", "laravel", ] as const).withDefault("next"), rtl: parseAsBoolean.withDefault(false), diff --git a/apps/v4/content/docs/(root)/meta.json b/apps/v4/content/docs/(root)/meta.json index b0949ac28a..307a8f1544 100644 --- a/apps/v4/content/docs/(root)/meta.json +++ b/apps/v4/content/docs/(root)/meta.json @@ -17,6 +17,6 @@ "[Changelog](/docs/changelog)", "[llms.txt](/llms.txt)", "legacy", - "new" + "!new" ] } diff --git a/apps/v4/content/docs/(root)/new.mdx b/apps/v4/content/docs/(root)/new.mdx index e6f250bc7d..90f8528a57 100644 --- a/apps/v4/content/docs/(root)/new.mdx +++ b/apps/v4/content/docs/(root)/new.mdx @@ -1,9 +1,9 @@ --- title: Your project is ready! -description: You've created a new project with shadcn/ui. Here's what to do next. +description: You've created a new project with shadcn/ui. --- -Here are the next steps to start building. +Here's a few things you can do to get started building with shadcn/ui. ## Add Components @@ -39,19 +39,61 @@ Browse all components on the [Components](/docs/components) page. ## Customize Your Theme -You can create a custom theme visually on [ui.shadcn.com](https://ui.shadcn.com) and apply it to your project using a preset code. +You can edit your theme directly in your CSS file. Learn more about [Theming](/docs/theming) and how to use CSS variables or utility classes. + +If you want to try a new preset, you can create a custom theme visually on [ui.shadcn.com](https://ui.shadcn.com) and apply it to your project using a preset code. ```bash -npx shadcn@latest init --preset a2r6bw +npx shadcn@latest init --preset [CODE] ``` -You can also edit your theme directly in your CSS file. Learn more about [Theming](/docs/theming). +## Add a block -## Configure Your Project +You can add a block to your project using the CLI. -Your project settings are stored in `components.json`. You can change import aliases, the icon library, or switch between base primitives. +```bash +npx shadcn@latest add login-03 +``` -Learn more about [components.json](/docs/components-json). +This will add the `login-03` block to your project. Import and use it in your code. + +```tsx title="app/page.tsx" +import { Login03 } from "@/components/login-03" + +export default function Home() { + return +} +``` + +## Install from Registries + +shadcn/ui has a growing ecosystem of community registries. You can install components from any registry URL using the CLI. + +```bash +npx shadcn@latest add @[registry]/[name] +``` + +Browse the [Registry Directory](/docs/directory) for a list of available registries. + +## Use AI to Build + +shadcn/ui is designed to work with AI. Your AI assistant can read the component source code in your project, understand the APIs, and compose them together to build pages and features. + +Here are some example prompts to try: + +- _"Create a signup page with a form for entering name, email and password."_ +- _"Create a settings page with a form for updating profile information."_ +- _"Build a dashboard with a header, stats cards, and a data table."_ + +## Install the shadcn Skills + +Install the shadcn skill in your AI assistant. This will give your AI assistant access to the full component registry, documentation, and search. + +```bash +npx skills add shadcn-ui/ui +``` + +Learn more about the [shadcn skill](/docs/skill). ## Connect the MCP Server @@ -62,23 +104,3 @@ npx shadcn@latest mcp init ``` Learn more on the [MCP Server](/docs/mcp) page. - -## Use AI to Build - -shadcn/ui is designed to work with AI. Your AI assistant can read the component source code in your project, understand the APIs, and compose them together to build pages and features. - -Here are some example prompts to try: - -- _"Create a settings page with a form for updating profile information."_ -- _"Add a sidebar navigation with collapsible groups."_ -- _"Build a dashboard with a header, stats cards, and a data table."_ - -## Install from Registries - -shadcn/ui has a growing ecosystem of community registries. You can install components from any registry URL using the CLI. - -```bash -npx shadcn@latest add https://example.com/r/my-component.json -``` - -Browse registries on the [Directory](/docs/directory) page. You can also [build and publish your own registry](/docs/registry). diff --git a/apps/v4/registry/config.ts b/apps/v4/registry/config.ts index 594a602ec0..54d71f7fa9 100644 --- a/apps/v4/registry/config.ts +++ b/apps/v4/registry/config.ts @@ -104,6 +104,8 @@ export const designSystemConfigSchema = z "vite-monorepo", "react-router-monorepo", "start-monorepo", + "astro", + "astro-monorepo", ]) .default("next") .optional(), diff --git a/apps/v4/scripts/build-registry.mts b/apps/v4/scripts/build-registry.mts index c1b9f44388..d30aa409f7 100644 --- a/apps/v4/scripts/build-registry.mts +++ b/apps/v4/scripts/build-registry.mts @@ -27,10 +27,12 @@ const TEMPLATE_NAMES = [ "vite-app", "react-router-app", "start-app", + "astro-app", "next-monorepo", "vite-monorepo", "react-router-monorepo", "start-monorepo", + "astro-monorepo", ] // Collect paths for batch prettier formatting at the end. diff --git a/packages/shadcn/src/templates/astro.ts b/packages/shadcn/src/templates/astro.ts new file mode 100644 index 0000000000..424477881b --- /dev/null +++ b/packages/shadcn/src/templates/astro.ts @@ -0,0 +1,60 @@ +import dedent from "dedent" + +import { createTemplate } from "./create-template" +import { fontsourceMonorepoInit } from "./monorepo" + +export const astro = createTemplate({ + name: "astro", + title: "Astro", + defaultProjectName: "astro-app", + templateDir: "astro-app", + frameworks: ["astro"], + create: async () => { + // Empty for now. + }, + files: [ + { + type: "registry:page", + path: "src/pages/index.astro", + target: "src/pages/index.astro", + content: dedent`--- +import Layout from "@/layouts/main.astro" +import { ComponentExample } from "@/components/component-example" +--- + + + + +`, + }, + ], + monorepo: { + templateDir: "astro-monorepo", + packageManager: "pnpm", + installArgs: ["--no-frozen-lockfile"], + init: fontsourceMonorepoInit, + files: [ + { + type: "registry:page", + path: "src/pages/index.astro", + target: "src/pages/index.astro", + content: dedent`--- +import "@workspace/ui/globals.css" +import { ComponentExample } from "@/components/component-example" +--- + + + + + + Astro App + + + + + +`, + }, + ], + }, +}) diff --git a/packages/shadcn/src/templates/index.ts b/packages/shadcn/src/templates/index.ts index 654c64214b..54af7acce4 100644 --- a/packages/shadcn/src/templates/index.ts +++ b/packages/shadcn/src/templates/index.ts @@ -1,3 +1,4 @@ +import { astro } from "./astro" import { next } from "./next" import { reactRouter } from "./react-router" import { start } from "./start" @@ -15,6 +16,7 @@ export const templates = { vite, start, "react-router": reactRouter, + astro, } // Resolve a template key from a detected framework name. diff --git a/templates/astro-app/.gitignore b/templates/astro-app/.gitignore new file mode 100644 index 0000000000..f52a46e5dc --- /dev/null +++ b/templates/astro-app/.gitignore @@ -0,0 +1,23 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store + +# jetbrains setting folder +.idea/ diff --git a/templates/astro-app/.prettierignore b/templates/astro-app/.prettierignore new file mode 100644 index 0000000000..35bc32e4af --- /dev/null +++ b/templates/astro-app/.prettierignore @@ -0,0 +1,6 @@ +node_modules/ +coverage/ +.pnpm-store/ +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/templates/astro-app/.prettierrc b/templates/astro-app/.prettierrc new file mode 100644 index 0000000000..0b9ca38b50 --- /dev/null +++ b/templates/astro-app/.prettierrc @@ -0,0 +1,19 @@ +{ + "endOfLine": "lf", + "semi": false, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 80, + "plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"], + "tailwindStylesheet": "src/styles/global.css", + "tailwindFunctions": ["cn", "cva"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/templates/astro-app/README.md b/templates/astro-app/README.md new file mode 100644 index 0000000000..e17b0f0122 --- /dev/null +++ b/templates/astro-app/README.md @@ -0,0 +1,36 @@ +# Astro + React + TypeScript + shadcn/ui + +This is a template for a new Astro project with React, TypeScript, and shadcn/ui. + +## Adding components + +To add components to your app, run the following command: + +```bash +npx shadcn@latest add button +``` + +This will place the ui components in the `src/components` directory. + +## Using components + +To use the components in your app, import them in an `.astro` file: + +```astro +--- +import { Button } from "@/components/ui/button" +--- + + + + + + Astro App + + +
+ +
+ + +``` diff --git a/templates/astro-app/astro.config.mjs b/templates/astro-app/astro.config.mjs new file mode 100644 index 0000000000..00bde21728 --- /dev/null +++ b/templates/astro-app/astro.config.mjs @@ -0,0 +1,13 @@ +// @ts-check + +import tailwindcss from "@tailwindcss/vite" +import { defineConfig } from "astro/config" +import react from "@astrojs/react" + +// https://astro.build/config +export default defineConfig({ + vite: { + plugins: [tailwindcss()], + }, + integrations: [react()], +}) diff --git a/templates/astro-app/eslint.config.js b/templates/astro-app/eslint.config.js new file mode 100644 index 0000000000..2d58690525 --- /dev/null +++ b/templates/astro-app/eslint.config.js @@ -0,0 +1,23 @@ +import js from "@eslint/js" +import globals from "globals" +import reactHooks from "eslint-plugin-react-hooks" +import reactRefresh from "eslint-plugin-react-refresh" +import tseslint from "typescript-eslint" +import { defineConfig, globalIgnores } from "eslint/config" + +export default defineConfig([ + globalIgnores(["dist", ".astro"]), + { + files: ["**/*.{ts,tsx}"], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + }, +]) diff --git a/templates/astro-app/package.json b/templates/astro-app/package.json new file mode 100644 index 0000000000..7bce68808a --- /dev/null +++ b/templates/astro-app/package.json @@ -0,0 +1,37 @@ +{ + "name": "astro-app", + "type": "module", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro", + "lint": "eslint .", + "format": "prettier --write \"**/*.{ts,tsx,astro}\"", + "typecheck": "astro check" + }, + "dependencies": { + "@astrojs/react": "^4.4.2", + "@tailwindcss/vite": "^4.1.18", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "astro": "^5.17.1", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "tailwindcss": "^4.1.18" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "prettier": "^3.8.1", + "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-tailwindcss": "^0.7.2", + "typescript": "~5.9.3", + "typescript-eslint": "^8.46.4" + } +} diff --git a/templates/astro-app/public/favicon.svg b/templates/astro-app/public/favicon.svg new file mode 100644 index 0000000000..6f7f1ea714 --- /dev/null +++ b/templates/astro-app/public/favicon.svg @@ -0,0 +1,3 @@ + + + diff --git a/templates/astro-app/src/layouts/main.astro b/templates/astro-app/src/layouts/main.astro new file mode 100644 index 0000000000..69b80d2a09 --- /dev/null +++ b/templates/astro-app/src/layouts/main.astro @@ -0,0 +1,15 @@ +--- +import "@/styles/global.css" +--- + + + + + + + Astro App + + + + + diff --git a/templates/astro-app/src/pages/index.astro b/templates/astro-app/src/pages/index.astro new file mode 100644 index 0000000000..547b92ceab --- /dev/null +++ b/templates/astro-app/src/pages/index.astro @@ -0,0 +1,20 @@ +--- +import Layout from "@/layouts/main.astro" +--- + + +
+
+

Project ready!

+

You may now add components and start building.

+ + Read the docs + +
+
+
diff --git a/templates/astro-app/src/styles/global.css b/templates/astro-app/src/styles/global.css new file mode 100644 index 0000000000..f1d8c73cdc --- /dev/null +++ b/templates/astro-app/src/styles/global.css @@ -0,0 +1 @@ +@import "tailwindcss"; diff --git a/templates/astro-app/tsconfig.json b/templates/astro-app/tsconfig.json new file mode 100644 index 0000000000..c94dcf53b4 --- /dev/null +++ b/templates/astro-app/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "react", + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/templates/astro-monorepo/.gitignore b/templates/astro-monorepo/.gitignore new file mode 100644 index 0000000000..df22b3d81d --- /dev/null +++ b/templates/astro-monorepo/.gitignore @@ -0,0 +1,33 @@ +# Dependencies +node_modules +.pnp +.pnp.js + +# Local env files +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Testing +coverage + +# Turbo +.turbo + +# Vercel +.vercel + +# Build Outputs +dist + +# Astro +.astro + +# Debug +npm-debug.log* + +# Misc +.DS_Store +*.pem diff --git a/templates/astro-monorepo/.npmrc b/templates/astro-monorepo/.npmrc new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/templates/astro-monorepo/.npmrc @@ -0,0 +1 @@ + diff --git a/templates/astro-monorepo/.prettierignore b/templates/astro-monorepo/.prettierignore new file mode 100644 index 0000000000..6b8b7077c3 --- /dev/null +++ b/templates/astro-monorepo/.prettierignore @@ -0,0 +1,6 @@ +dist/ +node_modules/ +.turbo/ +coverage/ +pnpm-lock.yaml +.pnpm-store/ diff --git a/templates/astro-monorepo/.prettierrc b/templates/astro-monorepo/.prettierrc new file mode 100644 index 0000000000..5f9a623251 --- /dev/null +++ b/templates/astro-monorepo/.prettierrc @@ -0,0 +1,19 @@ +{ + "endOfLine": "lf", + "semi": false, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 80, + "plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"], + "tailwindStylesheet": "packages/ui/src/styles/globals.css", + "tailwindFunctions": ["cn", "cva"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/templates/astro-monorepo/README.md b/templates/astro-monorepo/README.md new file mode 100644 index 0000000000..8cf2961609 --- /dev/null +++ b/templates/astro-monorepo/README.md @@ -0,0 +1,39 @@ +# Astro + React + TypeScript + shadcn/ui (Monorepo) + +This is a monorepo template for Astro with React, TypeScript, and shadcn/ui. + +## Structure + +- `apps/web` - Astro application +- `packages/ui` - Shared UI components (shadcn/ui) + +## Adding components + +To add components, run the following command from the root: + +```bash +npx shadcn@latest add button -c apps/web +``` + +## Using components + +To use the components in your app, import them in an `.astro` file: + +```astro +--- +import { Button } from "@workspace/ui/components/button" +--- + + + + + + Astro App + + +
+ +
+ + +``` diff --git a/templates/astro-monorepo/apps/web/astro.config.mjs b/templates/astro-monorepo/apps/web/astro.config.mjs new file mode 100644 index 0000000000..00bde21728 --- /dev/null +++ b/templates/astro-monorepo/apps/web/astro.config.mjs @@ -0,0 +1,13 @@ +// @ts-check + +import tailwindcss from "@tailwindcss/vite" +import { defineConfig } from "astro/config" +import react from "@astrojs/react" + +// https://astro.build/config +export default defineConfig({ + vite: { + plugins: [tailwindcss()], + }, + integrations: [react()], +}) diff --git a/templates/astro-monorepo/apps/web/components.json b/templates/astro-monorepo/apps/web/components.json new file mode 100644 index 0000000000..963cc37627 --- /dev/null +++ b/templates/astro-monorepo/apps/web/components.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "radix-nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "", + "css": "../../packages/ui/src/styles/globals.css", + "baseColor": "neutral", + "cssVariables": true + }, + "iconLibrary": "lucide", + "aliases": { + "components": "@/components", + "hooks": "@/hooks", + "lib": "@/lib", + "utils": "@workspace/ui/lib/utils", + "ui": "@workspace/ui/components" + } +} diff --git a/templates/astro-monorepo/apps/web/eslint.config.js b/templates/astro-monorepo/apps/web/eslint.config.js new file mode 100644 index 0000000000..2d58690525 --- /dev/null +++ b/templates/astro-monorepo/apps/web/eslint.config.js @@ -0,0 +1,23 @@ +import js from "@eslint/js" +import globals from "globals" +import reactHooks from "eslint-plugin-react-hooks" +import reactRefresh from "eslint-plugin-react-refresh" +import tseslint from "typescript-eslint" +import { defineConfig, globalIgnores } from "eslint/config" + +export default defineConfig([ + globalIgnores(["dist", ".astro"]), + { + files: ["**/*.{ts,tsx}"], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + }, +]) diff --git a/templates/astro-monorepo/apps/web/package.json b/templates/astro-monorepo/apps/web/package.json new file mode 100644 index 0000000000..8a60a7dfc1 --- /dev/null +++ b/templates/astro-monorepo/apps/web/package.json @@ -0,0 +1,35 @@ +{ + "name": "web", + "version": "0.0.1", + "type": "module", + "private": true, + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro", + "lint": "eslint", + "format": "prettier --write \"**/*.{ts,tsx,astro}\"", + "typecheck": "astro check" + }, + "dependencies": { + "@astrojs/react": "^4.4.2", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@workspace/ui": "workspace:*", + "astro": "^5.17.1", + "react": "^19.2.4", + "react-dom": "^19.2.4" + }, + "devDependencies": { + "@eslint/js": "^9.39.2", + "@tailwindcss/vite": "^4.1.18", + "@types/node": "^25.1.0", + "eslint": "^9.39.2", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^17.2.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.54.0" + } +} diff --git a/templates/astro-monorepo/apps/web/public/favicon.svg b/templates/astro-monorepo/apps/web/public/favicon.svg new file mode 100644 index 0000000000..6f7f1ea714 --- /dev/null +++ b/templates/astro-monorepo/apps/web/public/favicon.svg @@ -0,0 +1,3 @@ + + + diff --git a/templates/astro-monorepo/apps/web/src/components/.gitkeep b/templates/astro-monorepo/apps/web/src/components/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/astro-monorepo/apps/web/src/layouts/main.astro b/templates/astro-monorepo/apps/web/src/layouts/main.astro new file mode 100644 index 0000000000..f8d346643d --- /dev/null +++ b/templates/astro-monorepo/apps/web/src/layouts/main.astro @@ -0,0 +1,15 @@ +--- +import "@workspace/ui/globals.css" +--- + + + + + + + Astro App + + + + + diff --git a/templates/astro-monorepo/apps/web/src/lib/.gitkeep b/templates/astro-monorepo/apps/web/src/lib/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/astro-monorepo/apps/web/src/pages/index.astro b/templates/astro-monorepo/apps/web/src/pages/index.astro new file mode 100644 index 0000000000..ea13d31fa4 --- /dev/null +++ b/templates/astro-monorepo/apps/web/src/pages/index.astro @@ -0,0 +1,28 @@ +--- +import "@workspace/ui/globals.css" +--- + + + + + + + Astro App + + +
+
+

Project ready!

+

You may now add components and start building.

+ + Read the docs + +
+
+ + diff --git a/templates/astro-monorepo/apps/web/tsconfig.json b/templates/astro-monorepo/apps/web/tsconfig.json new file mode 100644 index 0000000000..0dd4da6841 --- /dev/null +++ b/templates/astro-monorepo/apps/web/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"], + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "react", + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"], + "@workspace/ui/*": ["../../packages/ui/src/*"] + } + } +} diff --git a/templates/astro-monorepo/package.json b/templates/astro-monorepo/package.json new file mode 100644 index 0000000000..4772b9b07f --- /dev/null +++ b/templates/astro-monorepo/package.json @@ -0,0 +1,23 @@ +{ + "name": "astro-monorepo", + "version": "0.0.1", + "private": true, + "scripts": { + "build": "turbo build", + "dev": "turbo dev", + "lint": "turbo lint", + "format": "turbo format", + "typecheck": "turbo typecheck" + }, + "devDependencies": { + "prettier": "^3.8.1", + "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-tailwindcss": "^0.7.2", + "turbo": "^2.8.8", + "typescript": "5.9.3" + }, + "packageManager": "pnpm@9.0.6", + "engines": { + "node": ">=20" + } +} diff --git a/templates/astro-monorepo/packages/ui/components.json b/templates/astro-monorepo/packages/ui/components.json new file mode 100644 index 0000000000..e2686f3797 --- /dev/null +++ b/templates/astro-monorepo/packages/ui/components.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "radix-nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "", + "css": "src/styles/globals.css", + "baseColor": "neutral", + "cssVariables": true + }, + "iconLibrary": "lucide", + "aliases": { + "components": "@workspace/ui/components", + "utils": "@workspace/ui/lib/utils", + "hooks": "@workspace/ui/hooks", + "lib": "@workspace/ui/lib", + "ui": "@workspace/ui/components" + } +} diff --git a/templates/astro-monorepo/packages/ui/eslint.config.js b/templates/astro-monorepo/packages/ui/eslint.config.js new file mode 100644 index 0000000000..702f89bf8b --- /dev/null +++ b/templates/astro-monorepo/packages/ui/eslint.config.js @@ -0,0 +1,23 @@ +import js from "@eslint/js" +import globals from "globals" +import reactHooks from "eslint-plugin-react-hooks" +import reactRefresh from "eslint-plugin-react-refresh" +import tseslint from "typescript-eslint" +import { defineConfig, globalIgnores } from "eslint/config" + +export default defineConfig([ + globalIgnores(["dist"]), + { + files: ["**/*.{ts,tsx}"], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + }, +]) diff --git a/templates/astro-monorepo/packages/ui/package.json b/templates/astro-monorepo/packages/ui/package.json new file mode 100644 index 0000000000..ab26802149 --- /dev/null +++ b/templates/astro-monorepo/packages/ui/package.json @@ -0,0 +1,37 @@ +{ + "name": "@workspace/ui", + "version": "0.0.0", + "type": "module", + "private": true, + "scripts": { + "lint": "eslint", + "format": "prettier --write \"**/*.{ts,tsx}\"", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "react": "^19.2.4", + "react-dom": "^19.2.4", + "zod": "^3.25.76" + }, + "devDependencies": { + "@tailwindcss/vite": "^4.1.18", + "@turbo/gen": "^2.8.1", + "@types/node": "^25.1.0", + "@types/react": "^19.2.10", + "@types/react-dom": "^19.2.3", + "@eslint/js": "^9.39.2", + "eslint": "^9.39.2", + "eslint-plugin-react-hooks": "^7.0.1", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^17.2.0", + "typescript-eslint": "^8.54.0", + "tailwindcss": "^4.1.18", + "typescript": "^5.9.3" + }, + "exports": { + "./globals.css": "./src/styles/globals.css", + "./lib/*": "./src/lib/*.ts", + "./components/*": "./src/components/*.tsx", + "./hooks/*": "./src/hooks/*.ts" + } +} diff --git a/templates/astro-monorepo/packages/ui/src/components/.gitkeep b/templates/astro-monorepo/packages/ui/src/components/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/astro-monorepo/packages/ui/src/hooks/.gitkeep b/templates/astro-monorepo/packages/ui/src/hooks/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/astro-monorepo/packages/ui/src/lib/.gitkeep b/templates/astro-monorepo/packages/ui/src/lib/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/astro-monorepo/packages/ui/src/styles/globals.css b/templates/astro-monorepo/packages/ui/src/styles/globals.css new file mode 100644 index 0000000000..f00da9a136 --- /dev/null +++ b/templates/astro-monorepo/packages/ui/src/styles/globals.css @@ -0,0 +1,4 @@ +@import "tailwindcss"; +@source "../../../apps/**/*.{ts,tsx,astro}"; +@source "../../../components/**/*.{ts,tsx}"; +@source "../**/*.{ts,tsx}"; diff --git a/templates/astro-monorepo/packages/ui/tsconfig.json b/templates/astro-monorepo/packages/ui/tsconfig.json new file mode 100644 index 0000000000..db4b78de10 --- /dev/null +++ b/templates/astro-monorepo/packages/ui/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "@workspace/ui/*": ["./src/*"] + } + }, + "include": ["."], + "exclude": ["node_modules", "dist"] +} diff --git a/templates/astro-monorepo/packages/ui/tsconfig.lint.json b/templates/astro-monorepo/packages/ui/tsconfig.lint.json new file mode 100644 index 0000000000..08a184e477 --- /dev/null +++ b/templates/astro-monorepo/packages/ui/tsconfig.lint.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "skipLibCheck": true, + "strict": true, + "outDir": "dist" + }, + "include": ["src", "turbo"], + "exclude": ["node_modules", "dist"] +} diff --git a/templates/astro-monorepo/pnpm-workspace.yaml b/templates/astro-monorepo/pnpm-workspace.yaml new file mode 100644 index 0000000000..3ff5faaaf5 --- /dev/null +++ b/templates/astro-monorepo/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +packages: + - "apps/*" + - "packages/*" diff --git a/templates/astro-monorepo/tsconfig.json b/templates/astro-monorepo/tsconfig.json new file mode 100644 index 0000000000..63b9f0ef83 --- /dev/null +++ b/templates/astro-monorepo/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "skipLibCheck": true, + "strict": true + } +} diff --git a/templates/astro-monorepo/turbo.json b/templates/astro-monorepo/turbo.json new file mode 100644 index 0000000000..5caa8348d3 --- /dev/null +++ b/templates/astro-monorepo/turbo.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://turbo.build/schema.json", + "ui": "tui", + "tasks": { + "build": { + "dependsOn": ["^build"], + "inputs": ["$TURBO_DEFAULT$", ".env*"], + "outputs": ["dist/**"] + }, + "lint": { "dependsOn": ["^lint"] }, + "format": { "dependsOn": ["^format"] }, + "typecheck": { "dependsOn": ["^typecheck"] }, + "dev": { "cache": false, "persistent": true } + } +}