create-stackkit-app 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -7
- package/dist/lib/create-project.js +88 -5
- package/dist/lib/template-composer.js +1 -1
- package/modules/auth/better-auth-express/adapters/mongoose-mongodb.ts +13 -0
- package/modules/auth/better-auth-express/adapters/prisma-mongodb.ts +15 -0
- package/modules/auth/better-auth-express/adapters/prisma-postgresql.ts +15 -0
- package/modules/auth/better-auth-express/files/schemas/prisma-mongodb-schema.prisma +72 -0
- package/modules/auth/better-auth-express/files/schemas/prisma-postgresql-schema.prisma +72 -0
- package/modules/auth/better-auth-express/module.json +26 -3
- package/modules/auth/better-auth-nextjs/adapters/mongoose-mongodb.ts +24 -0
- package/modules/auth/better-auth-nextjs/adapters/prisma-mongodb.ts +26 -0
- package/modules/auth/better-auth-nextjs/adapters/prisma-postgresql.ts +26 -0
- package/modules/auth/better-auth-nextjs/files/schemas/prisma-mongodb-schema.prisma +72 -0
- package/modules/auth/better-auth-nextjs/files/schemas/prisma-postgresql-schema.prisma +72 -0
- package/modules/auth/better-auth-nextjs/module.json +26 -5
- package/modules/auth/better-auth-react/module.json +7 -5
- package/modules/auth/clerk-express/module.json +23 -8
- package/modules/auth/clerk-nextjs/module.json +51 -14
- package/modules/auth/clerk-react/module.json +17 -7
- package/modules/database/mongoose-mongodb/module.json +44 -6
- package/modules/database/prisma-mongodb/files/prisma/schema.prisma +1 -1
- package/modules/database/prisma-mongodb/module.json +28 -4
- package/modules/database/prisma-postgresql/files/prisma/schema.prisma +1 -1
- package/modules/database/prisma-postgresql/module.json +28 -4
- package/package.json +1 -1
- package/templates/express/.env.example +11 -0
- package/templates/express/eslint.config.cjs +42 -0
- package/templates/express/package.json +38 -0
- package/templates/express/src/app.ts +69 -0
- package/templates/express/src/config/env.ts +23 -0
- package/templates/{bases/express-base → express}/src/middlewares/error.middleware.ts +9 -3
- package/templates/{bases/nextjs-base → nextjs}/app/page.tsx +5 -5
- package/templates/react-vite/.env.example +2 -0
- package/templates/react-vite/README.md +85 -0
- package/templates/{bases/react-vite-base → react-vite}/index.html +1 -0
- package/templates/{bases/react-vite-base → react-vite}/package.json +18 -3
- package/templates/react-vite/src/api/client.ts +47 -0
- package/templates/react-vite/src/api/services/user.service.ts +26 -0
- package/templates/react-vite/src/components/ErrorBoundary.tsx +51 -0
- package/templates/react-vite/src/components/Layout.tsx +13 -0
- package/templates/react-vite/src/components/Loading.tsx +8 -0
- package/templates/react-vite/src/components/SEO.tsx +49 -0
- package/templates/react-vite/src/config/constants.ts +5 -0
- package/templates/react-vite/src/hooks/index.ts +64 -0
- package/templates/react-vite/src/index.css +1 -0
- package/templates/react-vite/src/lib/queryClient.ts +12 -0
- package/templates/react-vite/src/main.tsx +22 -0
- package/templates/react-vite/src/pages/About.tsx +74 -0
- package/templates/react-vite/src/pages/Home.tsx +45 -0
- package/templates/react-vite/src/pages/NotFound.tsx +24 -0
- package/templates/react-vite/src/pages/UserProfile.tsx +40 -0
- package/templates/react-vite/src/router.tsx +33 -0
- package/templates/react-vite/src/types/api.ts +20 -0
- package/templates/react-vite/src/utils/helpers.ts +51 -0
- package/templates/react-vite/src/utils/storage.ts +35 -0
- package/templates/react-vite/src/vite-env.d.ts +11 -0
- package/templates/{bases/react-vite-base → react-vite}/template.json +2 -1
- package/templates/react-vite/vite.config.ts +13 -0
- package/modules/database/drizzle-postgresql/files/drizzle.config.ts +0 -10
- package/modules/database/drizzle-postgresql/files/lib/db.ts +0 -7
- package/modules/database/drizzle-postgresql/files/lib/schema.ts +0 -8
- package/modules/database/drizzle-postgresql/module.json +0 -34
- package/templates/bases/express-base/.env.example +0 -2
- package/templates/bases/express-base/package.json +0 -23
- package/templates/bases/express-base/src/app.ts +0 -34
- package/templates/bases/express-base/src/config/env.ts +0 -14
- package/templates/bases/react-vite-base/README.md +0 -73
- package/templates/bases/react-vite-base/src/App.css +0 -42
- package/templates/bases/react-vite-base/src/App.tsx +0 -35
- package/templates/bases/react-vite-base/src/index.css +0 -68
- package/templates/bases/react-vite-base/src/main.tsx +0 -10
- package/templates/bases/react-vite-base/vite.config.ts +0 -7
- /package/templates/{bases/express-base → express}/src/server.ts +0 -0
- /package/templates/{bases/express-base → express}/template.json +0 -0
- /package/templates/{bases/express-base → express}/tsconfig.json +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/README.md +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/app/favicon.ico +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/app/globals.css +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/app/layout.tsx +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/eslint.config.mjs +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/next.config.ts +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/package.json +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/postcss.config.mjs +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/public/file.svg +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/public/globe.svg +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/public/next.svg +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/public/vercel.svg +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/public/window.svg +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/template.json +0 -0
- /package/templates/{bases/nextjs-base → nextjs}/tsconfig.json +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/eslint.config.js +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/public/vite.svg +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/src/assets/react.svg +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/tsconfig.app.json +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/tsconfig.json +0 -0
- /package/templates/{bases/react-vite-base → react-vite}/tsconfig.node.json +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useLoaderData, useParams } from 'react-router';
|
|
3
|
+
import { userService } from '../api/services/user.service';
|
|
4
|
+
|
|
5
|
+
type User = { id?: string; name?: string; email?: string; avatar?: string; [key: string]: any };
|
|
6
|
+
|
|
7
|
+
export default function UserProfile() {
|
|
8
|
+
const loaderUser = useLoaderData() as User | undefined;
|
|
9
|
+
const { userId } = useParams();
|
|
10
|
+
|
|
11
|
+
const { data: user = loaderUser ?? {} } = useQuery({
|
|
12
|
+
queryKey: ['user', userId],
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
if (!userId) throw new Error('Missing user id');
|
|
15
|
+
return await userService.getUser(userId);
|
|
16
|
+
},
|
|
17
|
+
initialData: loaderUser,
|
|
18
|
+
staleTime: 1000 * 60,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className="min-h-screen bg-black text-white flex items-center justify-center">
|
|
23
|
+
<div className="max-w-xl p-8 bg-zinc-900 rounded-md shadow">
|
|
24
|
+
<div className="flex items-center gap-4">
|
|
25
|
+
{user.avatar ? (
|
|
26
|
+
<img src={user.avatar} alt={user.name} className="w-16 h-16 rounded-full" />
|
|
27
|
+
) : (
|
|
28
|
+
<div className="w-16 h-16 rounded-full bg-zinc-700 flex items-center justify-center text-xl">
|
|
29
|
+
{user.name?.[0] ?? 'U'}
|
|
30
|
+
</div>
|
|
31
|
+
)}
|
|
32
|
+
<div>
|
|
33
|
+
<h2 className="text-2xl font-semibold">{user.name}</h2>
|
|
34
|
+
<p className="text-sm text-zinc-400">{user.email}</p>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createBrowserRouter } from 'react-router';
|
|
2
|
+
import { userService } from './api/services/user.service';
|
|
3
|
+
import { ErrorBoundary } from './components/ErrorBoundary';
|
|
4
|
+
import Layout from './components/Layout';
|
|
5
|
+
import About from './pages/About';
|
|
6
|
+
import Home from './pages/Home';
|
|
7
|
+
import NotFound from './pages/NotFound';
|
|
8
|
+
import UserProfile from './pages/UserProfile';
|
|
9
|
+
|
|
10
|
+
export const router = createBrowserRouter([
|
|
11
|
+
{
|
|
12
|
+
path: '/',
|
|
13
|
+
Component: Layout,
|
|
14
|
+
errorElement: <ErrorBoundary />,
|
|
15
|
+
children: [
|
|
16
|
+
{ index: true, Component: Home },
|
|
17
|
+
{ path: 'about', Component: About },
|
|
18
|
+
{
|
|
19
|
+
path: 'users/:userId',
|
|
20
|
+
loader: async ({ params }) => {
|
|
21
|
+
const id = params.userId;
|
|
22
|
+
if (!id) throw new Response('Missing user id', { status: 400 });
|
|
23
|
+
const user = await userService.getUser(id);
|
|
24
|
+
return user;
|
|
25
|
+
},
|
|
26
|
+
Component: UserProfile,
|
|
27
|
+
},
|
|
28
|
+
{ path: '*', Component: NotFound },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
export default router;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ApiResponse<T = unknown> {
|
|
2
|
+
data: T;
|
|
3
|
+
message?: string;
|
|
4
|
+
status: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PaginatedResponse<T> {
|
|
8
|
+
data: T[];
|
|
9
|
+
total: number;
|
|
10
|
+
page: number;
|
|
11
|
+
pageSize: number;
|
|
12
|
+
totalPages: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ApiError {
|
|
16
|
+
message: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
status?: number;
|
|
19
|
+
errors?: Record<string, string[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function cn(...classes: (string | boolean | undefined | null)[]): string {
|
|
2
|
+
return classes.filter(Boolean).join(' ');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function formatDate(date: Date | string): string {
|
|
6
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
7
|
+
return d.toLocaleDateString('en-US', {
|
|
8
|
+
year: 'numeric',
|
|
9
|
+
month: 'long',
|
|
10
|
+
day: 'numeric',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function truncate(str: string, maxLength: number): string {
|
|
15
|
+
if (str.length <= maxLength) return str;
|
|
16
|
+
return str.slice(0, maxLength) + '...';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function delay(ms: number): Promise<void> {
|
|
20
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function debounce<T extends (...args: never[]) => unknown>(
|
|
24
|
+
func: T,
|
|
25
|
+
wait: number
|
|
26
|
+
): (...args: Parameters<T>) => void {
|
|
27
|
+
let timeout: ReturnType<typeof setTimeout> | null = null;
|
|
28
|
+
|
|
29
|
+
return function executedFunction(...args: Parameters<T>) {
|
|
30
|
+
const later = () => {
|
|
31
|
+
timeout = null;
|
|
32
|
+
func(...args);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (timeout) clearTimeout(timeout);
|
|
36
|
+
timeout = setTimeout(later, wait);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function capitalize(str: string): string {
|
|
41
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function slugify(str: string): string {
|
|
45
|
+
return str
|
|
46
|
+
.toLowerCase()
|
|
47
|
+
.trim()
|
|
48
|
+
.replace(/[^\w\s-]/g, '')
|
|
49
|
+
.replace(/[\s_-]+/g, '-')
|
|
50
|
+
.replace(/^-+|-+$/g, '');
|
|
51
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const storage = {
|
|
2
|
+
get: <T>(key: string, defaultValue?: T): T | null => {
|
|
3
|
+
try {
|
|
4
|
+
const item = localStorage.getItem(key);
|
|
5
|
+
return item ? JSON.parse(item) : (defaultValue ?? null);
|
|
6
|
+
} catch (error) {
|
|
7
|
+
console.error('Error reading from localStorage:', error);
|
|
8
|
+
return defaultValue ?? null;
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
set: <T>(key: string, value: T): void => {
|
|
13
|
+
try {
|
|
14
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error('Error writing to localStorage:', error);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
remove: (key: string): void => {
|
|
21
|
+
try {
|
|
22
|
+
localStorage.removeItem(key);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('Error removing from localStorage:', error);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
clear: (): void => {
|
|
29
|
+
try {
|
|
30
|
+
localStorage.clear();
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error('Error clearing localStorage:', error);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
"name": "react-vite-base",
|
|
3
3
|
"displayName": "React (Vite)",
|
|
4
4
|
"framework": "react-vite",
|
|
5
|
-
"description": "React
|
|
5
|
+
"description": "Production-ready React 19 + Vite with TypeScript, Router, TanStack Query, and more",
|
|
6
6
|
"files": [
|
|
7
7
|
"src/",
|
|
8
8
|
"public/",
|
|
9
|
+
".env.example",
|
|
9
10
|
".gitignore",
|
|
10
11
|
"eslint.config.js",
|
|
11
12
|
"index.html",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { defineConfig } from 'vite';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react(), tailwindcss()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
'@': path.resolve(__dirname, './src'),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
|
|
2
|
-
|
|
3
|
-
export const users = pgTable('users', {
|
|
4
|
-
id: serial('id').primaryKey(),
|
|
5
|
-
name: text('name').notNull(),
|
|
6
|
-
email: text('email').notNull().unique(),
|
|
7
|
-
createdAt: timestamp('created_at').defaultNow(),
|
|
8
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "drizzle-postgresql",
|
|
3
|
-
"description": "Drizzle ORM with PostgreSQL",
|
|
4
|
-
"category": "database",
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"drizzle-orm": "^0.36.4",
|
|
7
|
-
"postgres": "^3.4.5"
|
|
8
|
-
},
|
|
9
|
-
"devDependencies": {
|
|
10
|
-
"drizzle-kit": "^0.28.1"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"db:generate": "drizzle-kit generate",
|
|
14
|
-
"db:migrate": "drizzle-kit migrate",
|
|
15
|
-
"db:studio": "drizzle-kit studio"
|
|
16
|
-
},
|
|
17
|
-
"env": {
|
|
18
|
-
"DATABASE_URL": "postgresql://postgres:password@localhost:5432/myapp"
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
{
|
|
22
|
-
"source": "files/lib/db.ts",
|
|
23
|
-
"destination": "lib/db.ts"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"source": "files/lib/schema.ts",
|
|
27
|
-
"destination": "lib/schema.ts"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"source": "files/drizzle.config.ts",
|
|
31
|
-
"destination": "drizzle.config.ts"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "my-app",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "tsx watch src/server.ts",
|
|
7
|
-
"build": "tsc",
|
|
8
|
-
"start": "node dist/server.js",
|
|
9
|
-
"lint": "eslint src"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"express": "^4.21.2",
|
|
13
|
-
"dotenv": "^16.4.7",
|
|
14
|
-
"cors": "^2.8.5"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@types/express": "^5.0.0",
|
|
18
|
-
"@types/node": "^22.10.5",
|
|
19
|
-
"@types/cors": "^2.8.17",
|
|
20
|
-
"tsx": "^4.19.2",
|
|
21
|
-
"typescript": "^5.7.2"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import cors from 'cors';
|
|
2
|
-
import express, { Application, NextFunction, Request, Response } from 'express';
|
|
3
|
-
import { env } from './config/env';
|
|
4
|
-
import { errorHandler } from './middlewares/error.middleware';
|
|
5
|
-
|
|
6
|
-
// app initialization
|
|
7
|
-
const app: Application = express();
|
|
8
|
-
app.use(express.json());
|
|
9
|
-
|
|
10
|
-
// cors configuration
|
|
11
|
-
app.use(
|
|
12
|
-
cors({
|
|
13
|
-
origin: [env.app.site_url],
|
|
14
|
-
credentials: true,
|
|
15
|
-
})
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
// Home page route
|
|
19
|
-
app.get('/', (req: Request, res: Response) => {
|
|
20
|
-
res.send('Hello World!');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// unhandled routes
|
|
24
|
-
app.use((req: Request, res: Response, next: NextFunction) => {
|
|
25
|
-
const error: any = new Error(`Can't find ${req.originalUrl} on this server!`);
|
|
26
|
-
error.status = 404;
|
|
27
|
-
|
|
28
|
-
next(error);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Global error handler
|
|
32
|
-
app.use(errorHandler);
|
|
33
|
-
|
|
34
|
-
export default app;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import dotenv from 'dotenv';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
dotenv.config({ path: path.join(process.cwd(), '.env') });
|
|
5
|
-
|
|
6
|
-
const env = {
|
|
7
|
-
app: {
|
|
8
|
-
port: Number(process.env.PORT) || 3000,
|
|
9
|
-
url: process.env.APP_URL || 'http://localhost:3000',
|
|
10
|
-
site_url: process.env.SITE_URL || 'http://localhost:5173',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { env };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## React Compiler
|
|
11
|
-
|
|
12
|
-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
-
|
|
14
|
-
## Expanding the ESLint configuration
|
|
15
|
-
|
|
16
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
-
|
|
26
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
// eslint.config.js
|
|
50
|
-
import reactX from 'eslint-plugin-react-x'
|
|
51
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
-
|
|
53
|
-
export default defineConfig([
|
|
54
|
-
globalIgnores(['dist']),
|
|
55
|
-
{
|
|
56
|
-
files: ['**/*.{ts,tsx}'],
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
73
|
-
```
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#root {
|
|
2
|
-
max-width: 1280px;
|
|
3
|
-
margin: 0 auto;
|
|
4
|
-
padding: 2rem;
|
|
5
|
-
text-align: center;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.logo {
|
|
9
|
-
height: 6em;
|
|
10
|
-
padding: 1.5em;
|
|
11
|
-
will-change: filter;
|
|
12
|
-
transition: filter 300ms;
|
|
13
|
-
}
|
|
14
|
-
.logo:hover {
|
|
15
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
|
16
|
-
}
|
|
17
|
-
.logo.react:hover {
|
|
18
|
-
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes logo-spin {
|
|
22
|
-
from {
|
|
23
|
-
transform: rotate(0deg);
|
|
24
|
-
}
|
|
25
|
-
to {
|
|
26
|
-
transform: rotate(360deg);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
31
|
-
a:nth-of-type(2) .logo {
|
|
32
|
-
animation: logo-spin infinite 20s linear;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.card {
|
|
37
|
-
padding: 2em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.read-the-docs {
|
|
41
|
-
color: #888;
|
|
42
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import reactLogo from './assets/react.svg'
|
|
3
|
-
import viteLogo from '/vite.svg'
|
|
4
|
-
import './App.css'
|
|
5
|
-
|
|
6
|
-
function App() {
|
|
7
|
-
const [count, setCount] = useState(0)
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<>
|
|
11
|
-
<div>
|
|
12
|
-
<a href="https://vite.dev" target="_blank">
|
|
13
|
-
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://react.dev" target="_blank">
|
|
16
|
-
<img src={reactLogo} className="logo react" alt="React logo" />
|
|
17
|
-
</a>
|
|
18
|
-
</div>
|
|
19
|
-
<h1>Vite + React</h1>
|
|
20
|
-
<div className="card">
|
|
21
|
-
<button onClick={() => setCount((count) => count + 1)}>
|
|
22
|
-
count is {count}
|
|
23
|
-
</button>
|
|
24
|
-
<p>
|
|
25
|
-
Edit <code>src/App.tsx</code> and save to test HMR
|
|
26
|
-
</p>
|
|
27
|
-
</div>
|
|
28
|
-
<p className="read-the-docs">
|
|
29
|
-
Click on the Vite and React logos to learn more
|
|
30
|
-
</p>
|
|
31
|
-
</>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default App
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
-
line-height: 1.5;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
color: rgba(255, 255, 255, 0.87);
|
|
8
|
-
background-color: #242424;
|
|
9
|
-
|
|
10
|
-
font-synthesis: none;
|
|
11
|
-
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
a {
|
|
17
|
-
font-weight: 500;
|
|
18
|
-
color: #646cff;
|
|
19
|
-
text-decoration: inherit;
|
|
20
|
-
}
|
|
21
|
-
a:hover {
|
|
22
|
-
color: #535bf2;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
body {
|
|
26
|
-
margin: 0;
|
|
27
|
-
display: flex;
|
|
28
|
-
place-items: center;
|
|
29
|
-
min-width: 320px;
|
|
30
|
-
min-height: 100vh;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
h1 {
|
|
34
|
-
font-size: 3.2em;
|
|
35
|
-
line-height: 1.1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
button {
|
|
39
|
-
border-radius: 8px;
|
|
40
|
-
border: 1px solid transparent;
|
|
41
|
-
padding: 0.6em 1.2em;
|
|
42
|
-
font-size: 1em;
|
|
43
|
-
font-weight: 500;
|
|
44
|
-
font-family: inherit;
|
|
45
|
-
background-color: #1a1a1a;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
transition: border-color 0.25s;
|
|
48
|
-
}
|
|
49
|
-
button:hover {
|
|
50
|
-
border-color: #646cff;
|
|
51
|
-
}
|
|
52
|
-
button:focus,
|
|
53
|
-
button:focus-visible {
|
|
54
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@media (prefers-color-scheme: light) {
|
|
58
|
-
:root {
|
|
59
|
-
color: #213547;
|
|
60
|
-
background-color: #ffffff;
|
|
61
|
-
}
|
|
62
|
-
a:hover {
|
|
63
|
-
color: #747bff;
|
|
64
|
-
}
|
|
65
|
-
button {
|
|
66
|
-
background-color: #f9f9f9;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|