Skip to content

Commit 78f27b3

Browse files
committed
Initial commit
0 parents  commit 78f27b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5110
-0
lines changed

.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This configuration only applies to the package manager root.
2+
/** @type {import("eslint").Linter.Config} */
3+
module.exports = {
4+
ignorePatterns: ["apps/**", "packages/**"],
5+
extends: ["@workspace/eslint-config/library.js"],
6+
parser: "@typescript-eslint/parser",
7+
parserOptions: {
8+
project: true,
9+
},
10+
}

.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# Local env files
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Testing
16+
coverage
17+
18+
# Turbo
19+
.turbo
20+
21+
# Vercel
22+
.vercel
23+
24+
# Build Outputs
25+
.next/
26+
out/
27+
build
28+
dist
29+
30+
31+
# Debug
32+
npm-debug.log*
33+
34+
# Misc
35+
.DS_Store
36+
*.pem

.npmrc

Whitespace-only changes.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# shadcn/ui monorepo template
2+
3+
This template is for creating a monorepo with shadcn/ui.
4+
5+
## Usage
6+
7+
```bash
8+
pnpm dlx shadcn@latest init
9+
```
10+
11+
## Adding components
12+
13+
To add components to your app, run the following command at the root of your `web` app:
14+
15+
```bash
16+
pnpm dlx shadcn@latest add button -c apps/web
17+
```
18+
19+
This will place the ui components in the `packages/ui/src/components` directory.
20+
21+
## Tailwind
22+
23+
Your `tailwind.config.ts` and `globals.css` are already set up to use the components from the `ui` package.
24+
25+
## Using components
26+
27+
To use the components in your app, import them from the `ui` package.
28+
29+
```tsx
30+
import { Button } from "@workspace/ui/components/button"
31+
```

apps/web/app/favicon.ico

25.3 KB
Binary file not shown.

apps/web/app/layout.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Geist, Geist_Mono } from "next/font/google"
2+
3+
import "@workspace/ui/globals.css"
4+
import { Providers } from "@/components/providers"
5+
6+
const fontSans = Geist({
7+
subsets: ["latin"],
8+
variable: "--font-sans",
9+
})
10+
11+
const fontMono = Geist_Mono({
12+
subsets: ["latin"],
13+
variable: "--font-mono",
14+
})
15+
16+
export default function RootLayout({
17+
children,
18+
}: Readonly<{
19+
children: React.ReactNode
20+
}>) {
21+
return (
22+
<html lang="en" suppressHydrationWarning>
23+
<body
24+
className={`${fontSans.variable} ${fontMono.variable} font-sans antialiased `}
25+
>
26+
<Providers>{children}</Providers>
27+
</body>
28+
</html>
29+
)
30+
}

apps/web/app/page.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Button } from "@workspace/ui/components/button"
2+
3+
export default function Page() {
4+
return (
5+
<div className="flex items-center justify-center min-h-svh">
6+
<div className="flex flex-col items-center justify-center gap-4">
7+
<h1 className="text-2xl font-bold">Hello World</h1>
8+
<Button size="sm">Button</Button>
9+
</div>
10+
</div>
11+
)
12+
}

apps/web/components.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "../../packages/ui/tailwind.config.ts",
8+
"css": "../../packages/ui/src/styles/globals.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true
11+
},
12+
"iconLibrary": "lucide",
13+
"aliases": {
14+
"components": "@/components",
15+
"hooks": "@/hooks",
16+
"lib": "@/lib",
17+
"utils": "@workspace/ui/lib/utils",
18+
"ui": "@workspace/ui/components"
19+
}
20+
}

apps/web/components/.gitkeep

Whitespace-only changes.

apps/web/components/providers.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import { ThemeProvider as NextThemesProvider } from "next-themes"
5+
6+
export function Providers({ children }: { children: React.ReactNode }) {
7+
return (
8+
<NextThemesProvider
9+
attribute="class"
10+
defaultTheme="system"
11+
enableSystem
12+
disableTransitionOnChange
13+
enableColorScheme
14+
>
15+
{children}
16+
</NextThemesProvider>
17+
)
18+
}

apps/web/eslint.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { nextJsConfig } from "@workspace/eslint-config/next-js"
2+
3+
/** @type {import("eslint").Linter.Config} */
4+
export default nextJsConfig

apps/web/hooks/.gitkeep

Whitespace-only changes.

apps/web/lib/.gitkeep

Whitespace-only changes.

apps/web/next-env.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/web/next.config.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
transpilePackages: ["@workspace/ui"],
4+
}
5+
6+
export default nextConfig

apps/web/package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "web",
3+
"version": "0.0.1",
4+
"type": "module",
5+
"private": true,
6+
"scripts": {
7+
"dev": "next dev --turbopack",
8+
"build": "next build",
9+
"start": "next start",
10+
"lint": "next lint"
11+
},
12+
"dependencies": {
13+
"@workspace/ui": "workspace:*",
14+
"lucide-react": "0.456.0",
15+
"next-themes": "^0.4.3",
16+
"next": "^15.1.0",
17+
"react": "^19.0.0",
18+
"react-dom": "^19.0.0"
19+
},
20+
"devDependencies": {
21+
"@types/node": "^20",
22+
"@types/react": "18.3.0",
23+
"@types/react-dom": "18.3.1",
24+
"@workspace/eslint-config": "workspace:^",
25+
"@workspace/typescript-config": "workspace:*",
26+
"postcss": "^8",
27+
"tailwindcss": "^3.4.1",
28+
"typescript": "^5"
29+
}
30+
}

apps/web/postcss.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "@workspace/ui/postcss.config";

apps/web/tailwind.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "@workspace/ui/tailwind.config";

apps/web/tsconfig.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": "@workspace/typescript-config/nextjs.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"paths": {
6+
"@/*": ["./*"],
7+
"@workspace/ui/*": ["../../packages/ui/src/*"]
8+
},
9+
"plugins": [
10+
{
11+
"name": "next"
12+
}
13+
]
14+
},
15+
"include": [
16+
"next-env.d.ts",
17+
"next.config.mjs",
18+
"**/*.ts",
19+
"**/*.tsx",
20+
".next/types/**/*.ts"
21+
],
22+
"exclude": ["node_modules"]
23+
}

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "shadcn-ui-monorepo",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"build": "turbo build",
7+
"dev": "turbo dev",
8+
"lint": "turbo lint",
9+
"format": "prettier --write \"**/*.{ts,tsx,md}\""
10+
},
11+
"devDependencies": {
12+
"@workspace/eslint-config": "workspace:*",
13+
"@workspace/typescript-config": "workspace:*",
14+
"prettier": "^3.2.5",
15+
"turbo": "^2.3.0",
16+
"typescript": "5.5.4"
17+
},
18+
"packageManager": "[email protected]",
19+
"engines": {
20+
"node": ">=20"
21+
}
22+
}

packages/eslint-config/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@workspace/eslint-config`
2+
3+
Shared eslint configuration for the workspace.

packages/eslint-config/base.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import js from "@eslint/js"
2+
import eslintConfigPrettier from "eslint-config-prettier"
3+
import onlyWarn from "eslint-plugin-only-warn"
4+
import turboPlugin from "eslint-plugin-turbo"
5+
import tseslint from "typescript-eslint"
6+
7+
/**
8+
* A shared ESLint configuration for the repository.
9+
*
10+
* @type {import("eslint").Linter.Config}
11+
* */
12+
export const config = [
13+
js.configs.recommended,
14+
eslintConfigPrettier,
15+
...tseslint.configs.recommended,
16+
{
17+
plugins: {
18+
turbo: turboPlugin,
19+
},
20+
rules: {
21+
"turbo/no-undeclared-env-vars": "warn",
22+
},
23+
},
24+
{
25+
plugins: {
26+
onlyWarn,
27+
},
28+
},
29+
{
30+
ignores: ["dist/**"],
31+
},
32+
]

packages/eslint-config/next.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import js from "@eslint/js"
2+
import pluginNext from "@next/eslint-plugin-next"
3+
import eslintConfigPrettier from "eslint-config-prettier"
4+
import pluginReact from "eslint-plugin-react"
5+
import pluginReactHooks from "eslint-plugin-react-hooks"
6+
import globals from "globals"
7+
import tseslint from "typescript-eslint"
8+
9+
import { config as baseConfig } from "./base.js"
10+
11+
/**
12+
* A custom ESLint configuration for libraries that use Next.js.
13+
*
14+
* @type {import("eslint").Linter.Config}
15+
* */
16+
export const nextJsConfig = [
17+
...baseConfig,
18+
js.configs.recommended,
19+
eslintConfigPrettier,
20+
...tseslint.configs.recommended,
21+
{
22+
...pluginReact.configs.flat.recommended,
23+
languageOptions: {
24+
...pluginReact.configs.flat.recommended.languageOptions,
25+
globals: {
26+
...globals.serviceworker,
27+
},
28+
},
29+
},
30+
{
31+
plugins: {
32+
"@next/next": pluginNext,
33+
},
34+
rules: {
35+
...pluginNext.configs.recommended.rules,
36+
...pluginNext.configs["core-web-vitals"].rules,
37+
},
38+
},
39+
{
40+
plugins: {
41+
"react-hooks": pluginReactHooks,
42+
},
43+
settings: { react: { version: "detect" } },
44+
rules: {
45+
...pluginReactHooks.configs.recommended.rules,
46+
// React scope no longer necessary with new JSX transform.
47+
"react/react-in-jsx-scope": "off",
48+
"react/prop-types": "off",
49+
},
50+
},
51+
]

packages/eslint-config/package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@workspace/eslint-config",
3+
"version": "0.0.0",
4+
"type": "module",
5+
"private": true,
6+
"exports": {
7+
"./base": "./base.js",
8+
"./next-js": "./next.js",
9+
"./react-internal": "./react-internal.js"
10+
},
11+
"devDependencies": {
12+
"@next/eslint-plugin-next": "^15.1.0",
13+
"@typescript-eslint/eslint-plugin": "^8.15.0",
14+
"@typescript-eslint/parser": "^8.15.0",
15+
"eslint": "^9.15.0",
16+
"eslint-config-prettier": "^9.1.0",
17+
"eslint-plugin-only-warn": "^1.1.0",
18+
"eslint-plugin-react": "^7.37.2",
19+
"eslint-plugin-react-hooks": "^5.0.0",
20+
"eslint-plugin-turbo": "^2.3.0",
21+
"globals": "^15.12.0",
22+
"typescript": "^5.3.3",
23+
"typescript-eslint": "^8.15.0"
24+
}
25+
}

0 commit comments

Comments
 (0)