stackkit-cli 0.4.2 → 0.4.3

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.
Files changed (133) hide show
  1. package/README.md +17 -10
  2. package/bin/stackkit.js +1 -1
  3. package/dist/commands/add.js +26 -24
  4. package/dist/commands/init.d.ts +1 -1
  5. package/dist/commands/init.js +34 -29
  6. package/dist/commands/list.js +12 -12
  7. package/dist/index.js +25 -23
  8. package/dist/types/index.d.ts +14 -14
  9. package/dist/utils/code-inject.d.ts +1 -1
  10. package/dist/utils/code-inject.js +6 -6
  11. package/dist/utils/detect.d.ts +1 -1
  12. package/dist/utils/detect.js +48 -44
  13. package/dist/utils/env-editor.js +20 -20
  14. package/dist/utils/files.js +4 -4
  15. package/dist/utils/json-editor.d.ts +3 -3
  16. package/dist/utils/json-editor.js +10 -14
  17. package/dist/utils/logger.d.ts +1 -1
  18. package/dist/utils/logger.js +8 -8
  19. package/dist/utils/package-manager.d.ts +2 -2
  20. package/dist/utils/package-manager.js +33 -26
  21. package/modules/auth/better-auth-express/adapters/mongoose-mongodb.ts +13 -0
  22. package/modules/auth/better-auth-express/adapters/prisma-mongodb.ts +15 -0
  23. package/modules/auth/better-auth-express/adapters/prisma-postgresql.ts +15 -0
  24. package/modules/auth/better-auth-express/files/lib/auth.ts +1 -1
  25. package/modules/auth/better-auth-express/files/routes/auth.ts +3 -3
  26. package/modules/auth/better-auth-express/files/schemas/prisma-mongodb-schema.prisma +72 -0
  27. package/modules/auth/better-auth-express/files/schemas/prisma-postgresql-schema.prisma +72 -0
  28. package/modules/auth/better-auth-express/module.json +26 -3
  29. package/modules/auth/better-auth-nextjs/adapters/mongoose-mongodb.ts +24 -0
  30. package/modules/auth/better-auth-nextjs/adapters/prisma-mongodb.ts +26 -0
  31. package/modules/auth/better-auth-nextjs/adapters/prisma-postgresql.ts +26 -0
  32. package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +2 -3
  33. package/modules/auth/better-auth-nextjs/files/lib/auth.ts +4 -4
  34. package/modules/auth/better-auth-nextjs/files/schemas/prisma-mongodb-schema.prisma +72 -0
  35. package/modules/auth/better-auth-nextjs/files/schemas/prisma-postgresql-schema.prisma +72 -0
  36. package/modules/auth/better-auth-nextjs/module.json +26 -5
  37. package/modules/auth/better-auth-react/files/lib/auth-client.ts +2 -2
  38. package/modules/auth/better-auth-react/module.json +7 -5
  39. package/modules/auth/clerk-express/files/lib/auth.ts +1 -1
  40. package/modules/auth/clerk-express/module.json +22 -8
  41. package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +1 -1
  42. package/modules/auth/clerk-nextjs/files/middleware.ts +3 -3
  43. package/modules/auth/clerk-nextjs/module.json +50 -14
  44. package/modules/auth/clerk-react/files/lib/auth-provider.tsx +2 -2
  45. package/modules/auth/clerk-react/module.json +16 -7
  46. package/modules/database/mongoose-mongodb/files/lib/db.ts +3 -3
  47. package/modules/database/mongoose-mongodb/module.json +43 -6
  48. package/modules/database/prisma-mongodb/files/lib/db.ts +2 -2
  49. package/modules/database/prisma-mongodb/files/prisma/schema.prisma +1 -1
  50. package/modules/database/prisma-mongodb/module.json +28 -4
  51. package/modules/database/prisma-postgresql/files/lib/db.ts +2 -2
  52. package/modules/database/prisma-postgresql/files/prisma/schema.prisma +1 -1
  53. package/modules/database/prisma-postgresql/module.json +28 -4
  54. package/package.json +1 -1
  55. package/templates/express/.env.example +11 -0
  56. package/templates/express/eslint.config.cjs +42 -0
  57. package/templates/express/package.json +39 -0
  58. package/templates/express/src/app.ts +71 -0
  59. package/templates/express/src/config/env.ts +23 -0
  60. package/templates/express/src/middlewares/error.middleware.ts +18 -0
  61. package/templates/{bases/express-base → express}/src/server.ts +2 -2
  62. package/templates/express/template.json +44 -0
  63. package/templates/express/tsconfig.json +31 -0
  64. package/templates/{bases/nextjs-base → nextjs}/app/layout.tsx +1 -5
  65. package/templates/nextjs/app/page.tsx +57 -0
  66. package/templates/{bases/nextjs-base → nextjs}/package.json +2 -1
  67. package/templates/{bases/nextjs-base → nextjs}/template.json +13 -1
  68. package/templates/react-vite/.env.example +2 -0
  69. package/templates/react-vite/README.md +85 -0
  70. package/templates/react-vite/eslint.config.js +23 -0
  71. package/templates/{bases/react-vite-base → react-vite}/index.html +1 -0
  72. package/templates/{bases/react-vite-base → react-vite}/package.json +16 -2
  73. package/templates/react-vite/src/api/client.ts +47 -0
  74. package/templates/react-vite/src/api/services/user.service.ts +18 -0
  75. package/templates/react-vite/src/components/ErrorBoundary.tsx +51 -0
  76. package/templates/react-vite/src/components/Layout.tsx +13 -0
  77. package/templates/react-vite/src/components/Loading.tsx +8 -0
  78. package/templates/react-vite/src/components/SEO.tsx +49 -0
  79. package/templates/react-vite/src/config/constants.ts +5 -0
  80. package/templates/react-vite/src/hooks/index.ts +64 -0
  81. package/templates/react-vite/src/index.css +1 -0
  82. package/templates/react-vite/src/lib/queryClient.ts +12 -0
  83. package/templates/react-vite/src/main.tsx +22 -0
  84. package/templates/react-vite/src/pages/About.tsx +78 -0
  85. package/templates/react-vite/src/pages/Home.tsx +49 -0
  86. package/templates/react-vite/src/pages/NotFound.tsx +24 -0
  87. package/templates/react-vite/src/pages/UserProfile.tsx +40 -0
  88. package/templates/react-vite/src/router.tsx +33 -0
  89. package/templates/react-vite/src/types/api.d.ts +20 -0
  90. package/templates/react-vite/src/types/user.d.ts +6 -0
  91. package/templates/react-vite/src/utils/helpers.ts +51 -0
  92. package/templates/react-vite/src/utils/storage.ts +35 -0
  93. package/templates/react-vite/src/vite-env.d.ts +11 -0
  94. package/templates/react-vite/template.json +46 -0
  95. package/templates/react-vite/tsconfig.json +4 -0
  96. package/templates/react-vite/vite.config.ts +13 -0
  97. package/modules/database/drizzle-postgresql/files/drizzle.config.ts +0 -10
  98. package/modules/database/drizzle-postgresql/files/lib/db.ts +0 -7
  99. package/modules/database/drizzle-postgresql/files/lib/schema.ts +0 -8
  100. package/modules/database/drizzle-postgresql/module.json +0 -35
  101. package/templates/bases/express-base/.env.example +0 -2
  102. package/templates/bases/express-base/package.json +0 -23
  103. package/templates/bases/express-base/src/app.ts +0 -34
  104. package/templates/bases/express-base/src/config/env.ts +0 -14
  105. package/templates/bases/express-base/src/middlewares/error.middleware.ts +0 -12
  106. package/templates/bases/express-base/template.json +0 -7
  107. package/templates/bases/express-base/tsconfig.json +0 -14
  108. package/templates/bases/nextjs-base/app/page.tsx +0 -65
  109. package/templates/bases/react-vite-base/README.md +0 -73
  110. package/templates/bases/react-vite-base/eslint.config.js +0 -23
  111. package/templates/bases/react-vite-base/src/App.css +0 -42
  112. package/templates/bases/react-vite-base/src/App.tsx +0 -35
  113. package/templates/bases/react-vite-base/src/index.css +0 -68
  114. package/templates/bases/react-vite-base/src/main.tsx +0 -10
  115. package/templates/bases/react-vite-base/template.json +0 -19
  116. package/templates/bases/react-vite-base/tsconfig.json +0 -7
  117. package/templates/bases/react-vite-base/vite.config.ts +0 -7
  118. /package/templates/{bases/nextjs-base → nextjs}/README.md +0 -0
  119. /package/templates/{bases/nextjs-base → nextjs}/app/favicon.ico +0 -0
  120. /package/templates/{bases/nextjs-base → nextjs}/app/globals.css +0 -0
  121. /package/templates/{bases/nextjs-base → nextjs}/eslint.config.mjs +0 -0
  122. /package/templates/{bases/nextjs-base → nextjs}/next.config.ts +0 -0
  123. /package/templates/{bases/nextjs-base → nextjs}/postcss.config.mjs +0 -0
  124. /package/templates/{bases/nextjs-base → nextjs}/public/file.svg +0 -0
  125. /package/templates/{bases/nextjs-base → nextjs}/public/globe.svg +0 -0
  126. /package/templates/{bases/nextjs-base → nextjs}/public/next.svg +0 -0
  127. /package/templates/{bases/nextjs-base → nextjs}/public/vercel.svg +0 -0
  128. /package/templates/{bases/nextjs-base → nextjs}/public/window.svg +0 -0
  129. /package/templates/{bases/nextjs-base → nextjs}/tsconfig.json +0 -0
  130. /package/templates/{bases/react-vite-base → react-vite}/public/vite.svg +0 -0
  131. /package/templates/{bases/react-vite-base → react-vite}/src/assets/react.svg +0 -0
  132. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.app.json +0 -0
  133. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.node.json +0 -0
@@ -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
+ type ApiResponse<T = unknown> = {
2
+ data: T;
3
+ message?: string;
4
+ status: number;
5
+ };
6
+
7
+ type PaginatedResponse<T> = {
8
+ data: T[];
9
+ total: number;
10
+ page: number;
11
+ pageSize: number;
12
+ totalPages: number;
13
+ };
14
+
15
+ type ApiError = {
16
+ message: string;
17
+ code?: string;
18
+ status?: number;
19
+ errors?: Record<string, string[]>;
20
+ };
@@ -0,0 +1,6 @@
1
+ type User = {
2
+ id: string;
3
+ name: string;
4
+ email: string;
5
+ avatar?: string;
6
+ };
@@ -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
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_API_URL: string;
5
+ readonly VITE_APP_NAME?: string;
6
+ readonly VITE_APP_VERSION?: string;
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv;
11
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "react-vite-base",
3
+ "displayName": "React (Vite)",
4
+ "framework": "react-vite",
5
+ "description": "Production-ready React 19 + Vite with TypeScript, Router, TanStack Query, and more",
6
+ "files": [
7
+ "src/",
8
+ "public/",
9
+ ".env.example",
10
+ ".gitignore",
11
+ "eslint.config.js",
12
+ "index.html",
13
+ "package.json",
14
+ "README.md",
15
+ "tsconfig.json",
16
+ "tsconfig.app.json",
17
+ "tsconfig.node.json",
18
+ "vite.config.ts"
19
+ ],
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build": "tsc -b && vite build",
23
+ "lint": "eslint .",
24
+ "lint:fix": "eslint . --fix",
25
+ "preview": "vite preview"
26
+ },
27
+ "jsScripts": {
28
+ "dev": "vite",
29
+ "build": "vite build",
30
+ "lint": "eslint .",
31
+ "lint:fix": "eslint . --fix",
32
+ "preview": "vite preview"
33
+ },
34
+ "fileReplacements": [
35
+ {
36
+ "file": "index.html",
37
+ "from": "/src/main.tsx",
38
+ "to": "/src/main.jsx"
39
+ },
40
+ {
41
+ "file": "vite.config.ts",
42
+ "from": "main.tsx",
43
+ "to": "main.jsx"
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
4
+ }
@@ -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,10 +0,0 @@
1
- import { defineConfig } from 'drizzle-kit';
2
-
3
- export default defineConfig({
4
- schema: './lib/schema.ts',
5
- out: './drizzle',
6
- dialect: 'postgresql',
7
- dbCredentials: {
8
- url: process.env.DATABASE_URL!,
9
- },
10
- });
@@ -1,7 +0,0 @@
1
- import { drizzle } from 'drizzle-orm/postgres-js';
2
- import postgres from 'postgres';
3
-
4
- const connectionString = process.env.DATABASE_URL!;
5
-
6
- export const client = postgres(connectionString, { prepare: false });
7
- export const db = drizzle(client);
@@ -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,35 +0,0 @@
1
- {
2
- "name": "drizzle-postgresql",
3
- "displayName": "Drizzle + PostgreSQL",
4
- "description": "Drizzle ORM with PostgreSQL",
5
- "category": "database",
6
- "dependencies": {
7
- "drizzle-orm": "^0.36.4",
8
- "postgres": "^3.4.5"
9
- },
10
- "devDependencies": {
11
- "drizzle-kit": "^0.28.1"
12
- },
13
- "scripts": {
14
- "db:generate": "drizzle-kit generate",
15
- "db:migrate": "drizzle-kit migrate",
16
- "db:studio": "drizzle-kit studio"
17
- },
18
- "env": {
19
- "DATABASE_URL": "postgresql://postgres:password@localhost:5432/myapp"
20
- },
21
- "files": [
22
- {
23
- "source": "files/lib/db.ts",
24
- "destination": "lib/db.ts"
25
- },
26
- {
27
- "source": "files/lib/schema.ts",
28
- "destination": "lib/schema.ts"
29
- },
30
- {
31
- "source": "files/drizzle.config.ts",
32
- "destination": "drizzle.config.ts"
33
- }
34
- ]
35
- }
@@ -1,2 +0,0 @@
1
- PORT=3000
2
- NODE_ENV=development
@@ -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,12 +0,0 @@
1
- import { NextFunction, Request, Response } from 'express';
2
-
3
- export const errorHandler = (err: any, req: Request, res: Response, next: NextFunction) => {
4
- const statusCode = err.status || 500;
5
- const errorMessage = err?.message || 'Internal server error!';
6
-
7
- res.status(statusCode).json({
8
- success: false,
9
- message: errorMessage,
10
- errors: errorMessage,
11
- });
12
- };
@@ -1,7 +0,0 @@
1
- {
2
- "name": "express-base",
3
- "displayName": "Express.js",
4
- "framework": "express",
5
- "description": "Express.js REST API with TypeScript",
6
- "files": ["src/", ".env.example", ".gitignore", "package.json", "tsconfig.json"]
7
- }
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "rootDir": "./src",
4
- "outDir": "./dist",
5
- "module": "ESNext",
6
- "moduleResolution": "node",
7
- "target": "ES2023",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "ignoreDeprecations": "5.0"
11
- },
12
- "include": ["src/**/*"],
13
- "exclude": ["node_modules", "dist"]
14
- }
@@ -1,65 +0,0 @@
1
- import Image from "next/image";
2
-
3
- export default function Home() {
4
- return (
5
- <div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
6
- <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
7
- <Image
8
- className="dark:invert"
9
- src="/next.svg"
10
- alt="Next.js logo"
11
- width={100}
12
- height={20}
13
- priority
14
- />
15
- <div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
16
- <h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
17
- To get started, edit the page.tsx file.
18
- </h1>
19
- <p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
20
- Looking for a starting point or more instructions? Head over to{" "}
21
- <a
22
- href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
23
- className="font-medium text-zinc-950 dark:text-zinc-50"
24
- >
25
- Templates
26
- </a>{" "}
27
- or the{" "}
28
- <a
29
- href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
30
- className="font-medium text-zinc-950 dark:text-zinc-50"
31
- >
32
- Learning
33
- </a>{" "}
34
- center.
35
- </p>
36
- </div>
37
- <div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
38
- <a
39
- className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
40
- href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
41
- target="_blank"
42
- rel="noopener noreferrer"
43
- >
44
- <Image
45
- className="dark:invert"
46
- src="/vercel.svg"
47
- alt="Vercel logomark"
48
- width={16}
49
- height={16}
50
- />
51
- Deploy Now
52
- </a>
53
- <a
54
- className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
55
- href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
56
- target="_blank"
57
- rel="noopener noreferrer"
58
- >
59
- Documentation
60
- </a>
61
- </div>
62
- </main>
63
- </div>
64
- );
65
- }
@@ -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,23 +0,0 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
- import reactRefresh from 'eslint-plugin-react-refresh'
5
- import tseslint from 'typescript-eslint'
6
- import { defineConfig, globalIgnores } from 'eslint/config'
7
-
8
- export default defineConfig([
9
- globalIgnores(['dist']),
10
- {
11
- files: ['**/*.{ts,tsx}'],
12
- extends: [
13
- js.configs.recommended,
14
- tseslint.configs.recommended,
15
- reactHooks.configs.flat.recommended,
16
- reactRefresh.configs.vite,
17
- ],
18
- languageOptions: {
19
- ecmaVersion: 2020,
20
- globals: globals.browser,
21
- },
22
- },
23
- ])
@@ -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