@shivasankaran18/stackd 1.8.0 → 2.0.1

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 (73) hide show
  1. package/apps/cli/src/cli.ts +28 -2
  2. package/apps/cli/src/commands/create.ts +30 -0
  3. package/apps/cli/src/scripts/ui/shadcn.ts +4 -10
  4. package/apps/cli/src/scripts/ui/tailwind.ts +39 -0
  5. package/apps/web/app/scaffold/page.tsx +1 -1
  6. package/apps/web/package.json +1 -1
  7. package/apps/web/tsconfig.json +108 -20
  8. package/package.json +18 -20
  9. package/dist/apps/cli/src/cli.js +0 -217
  10. package/dist/apps/cli/src/commands/create.js +0 -148
  11. package/dist/apps/cli/src/scripts/Auth/jwt.js +0 -78
  12. package/dist/apps/cli/src/scripts/Auth/nextAuth.js +0 -131
  13. package/dist/apps/cli/src/scripts/Auth/passport.js +0 -218
  14. package/dist/apps/cli/src/scripts/backend/django.js +0 -20
  15. package/dist/apps/cli/src/scripts/backend/expressjs.js +0 -58
  16. package/dist/apps/cli/src/scripts/backend/expressts.js +0 -83
  17. package/dist/apps/cli/src/scripts/frontend/angularjs.js +0 -1
  18. package/dist/apps/cli/src/scripts/frontend/angularts.js +0 -22
  19. package/dist/apps/cli/src/scripts/frontend/nextjs.js +0 -62
  20. package/dist/apps/cli/src/scripts/frontend/reactjs.js +0 -31
  21. package/dist/apps/cli/src/scripts/frontend/reactts.js +0 -30
  22. package/dist/apps/cli/src/scripts/frontend/vuejs.js +0 -37
  23. package/dist/apps/cli/src/scripts/frontend/vuets.js +0 -43
  24. package/dist/apps/cli/src/scripts/orms/drizzleSetup.js +0 -85
  25. package/dist/apps/cli/src/scripts/orms/mongoSetup.js +0 -53
  26. package/dist/apps/cli/src/scripts/orms/prismaSetup.js +0 -12
  27. package/dist/apps/cli/src/scripts/ui/shadcn.js +0 -207
  28. package/dist/apps/cli/src/scripts/ui/tailwindcss.js +0 -102
  29. package/dist/apps/web/app/api/auth/[...nextauth]/route.js +0 -5
  30. package/dist/apps/web/app/api/scaffold/route.js +0 -251
  31. package/dist/apps/web/app/home/page.js +0 -19
  32. package/dist/apps/web/app/layout.js +0 -19
  33. package/dist/apps/web/app/page.js +0 -1
  34. package/dist/apps/web/app/providers.js +0 -7
  35. package/dist/apps/web/app/scaffold/page.js +0 -326
  36. package/dist/apps/web/components/Sidebar.js +0 -54
  37. package/dist/apps/web/components/theme-provider.js +0 -6
  38. package/dist/apps/web/components/ui/button.js +0 -32
  39. package/dist/apps/web/components/ui/card.js +0 -15
  40. package/dist/apps/web/components/ui/dropdown-menu.js +0 -54
  41. package/dist/apps/web/components/ui/input.js +0 -7
  42. package/dist/apps/web/components/ui/label.js +0 -9
  43. package/dist/apps/web/components/ui/scroll-area.js +0 -19
  44. package/dist/apps/web/components/ui/sonner.js +0 -15
  45. package/dist/apps/web/components/ui/steps.js +0 -14
  46. package/dist/apps/web/components/ui/switch.js +0 -9
  47. package/dist/apps/web/lib/auth.js +0 -32
  48. package/dist/apps/web/lib/redis.js +0 -9
  49. package/dist/apps/web/lib/utils.js +0 -5
  50. package/dist/packages/scripts/Auth/jwt.js +0 -78
  51. package/dist/packages/scripts/Auth/nextAuth.js +0 -131
  52. package/dist/packages/scripts/Auth/passport.js +0 -218
  53. package/dist/packages/scripts/backend/django.js +0 -20
  54. package/dist/packages/scripts/backend/expressjs.js +0 -58
  55. package/dist/packages/scripts/backend/expressts.js +0 -83
  56. package/dist/packages/scripts/frontend/angularjs.js +0 -1
  57. package/dist/packages/scripts/frontend/angularts.js +0 -22
  58. package/dist/packages/scripts/frontend/nextjs.js +0 -62
  59. package/dist/packages/scripts/frontend/reactjs.js +0 -31
  60. package/dist/packages/scripts/frontend/reactts.js +0 -30
  61. package/dist/packages/scripts/frontend/vuejs.js +0 -37
  62. package/dist/packages/scripts/frontend/vuets.js +0 -43
  63. package/dist/packages/scripts/orms/drizzleSetup.js +0 -85
  64. package/dist/packages/scripts/orms/mongoSetup.js +0 -53
  65. package/dist/packages/scripts/orms/prismaSetup.js +0 -12
  66. package/dist/packages/scripts/ui/shadcn.js +0 -207
  67. package/dist/packages/scripts/ui/tailwindcss.js +0 -102
  68. package/dist/stackd.js +0 -114
  69. package/dist/tsconfig.tsbuildinfo +0 -1
  70. package/packages/typescript-config/base.json +0 -19
  71. package/packages/typescript-config/nextjs.json +0 -12
  72. package/packages/typescript-config/package.json +0 -9
  73. package/packages/typescript-config/react-library.json +0 -7
@@ -1,83 +0,0 @@
1
- import { execSync } from 'node:child_process';
2
- import { mkdir, writeFile } from 'node:fs/promises';
3
- import { join } from 'node:path';
4
- export async function createExpressTS(config, projectDir, emitLog) {
5
- emitLog('Creating ExpressTS project...');
6
- await mkdir(join(projectDir, 'backend'));
7
- emitLog('Writing package.json...');
8
- const backendPackageJson = {
9
- name: "backend",
10
- version: "1.0.0",
11
- scripts: {
12
- "dev": "ts-node-dev --respawn --transpile-only src/index.ts",
13
- "build": "tsc",
14
- "start": "node dist/index.js"
15
- },
16
- dependencies: {
17
- "express": "^4.18.2",
18
- "cors": "^2.8.5",
19
- "dotenv": "^16.3.1"
20
- },
21
- devDependencies: {
22
- "@types/express": "^4.17.17",
23
- "@types/cors": "^2.8.13",
24
- "@types/node": "^20.4.5",
25
- "typescript": "^5.1.6",
26
- "ts-node-dev": "^2.0.0"
27
- }
28
- };
29
- await writeFile(join(projectDir, 'backend', 'package.json'), JSON.stringify(backendPackageJson, null, 2));
30
- emitLog('Writing tsconfig.json...');
31
- const tsConfig = {
32
- compilerOptions: {
33
- "target": "ES2020",
34
- "module": "CommonJS",
35
- "lib": ["ES2020"],
36
- "moduleResolution": "node",
37
- "outDir": "./dist",
38
- "rootDir": "./src",
39
- "strict": true,
40
- "esModuleInterop": true,
41
- "skipLibCheck": true,
42
- "forceConsistentCasingInFileNames": true,
43
- "resolveJsonModule": true
44
- },
45
- include: ["src/**/*"],
46
- exclude: ["node_modules"]
47
- };
48
- await writeFile(join(projectDir, 'backend', 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
49
- emitLog('Creating src directory...');
50
- await mkdir(join(projectDir, 'backend', 'src'));
51
- emitLog('Writing index.ts...');
52
- const backendIndex = `
53
- import express from 'express';
54
- import cors from 'cors';
55
- import dotenv from 'dotenv';
56
-
57
- dotenv.config();
58
-
59
- const app = express();
60
- const port = process.env.PORT || ${config.backendPort};
61
-
62
- app.use(cors());
63
- app.use(express.json());
64
-
65
- // Test route
66
- app.get('/api/test', (req, res) => {
67
- res.json({ message: 'Hello from Express!' });
68
- });
69
-
70
- // Health check route
71
- app.get('/api/health', (req, res) => {
72
- res.json({ status: 'ok', timestamp: new Date() });
73
- });
74
-
75
- app.listen(port, () => {
76
- console.log(\`Server running on port \${port}\`);
77
- });`;
78
- emitLog('Writing index.ts...');
79
- await writeFile(join(projectDir, 'backend', 'src', 'index.ts'), backendIndex.trim());
80
- emitLog('Installing dependencies...');
81
- await execSync("npm install", { cwd: projectDir + '/backend', stdio: "inherit" });
82
- emitLog('✅ ExpressTS project created successfully!');
83
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import { execSync } from "child_process";
2
- import path from "path";
3
- export default async function createAngularTS(config, projectDir) {
4
- try {
5
- const projectFullPath = path.join(projectDir, 'frontend');
6
- console.log('Installing Angular CLI...');
7
- await execSync(`npx @angular/cli@latest new frontend --skip-git --style=scss --routing=true --strict`, {
8
- cwd: projectDir,
9
- stdio: 'inherit'
10
- });
11
- console.log('Installing dependencies...');
12
- await execSync('npm install', {
13
- cwd: projectFullPath,
14
- stdio: 'inherit'
15
- });
16
- console.log('Angular project created successfully!');
17
- }
18
- catch (error) {
19
- console.error('Error creating Angular project:', error);
20
- throw error;
21
- }
22
- }
@@ -1,62 +0,0 @@
1
- // import { join } from 'node:path'
2
- // import { execSync, ExecSyncOptions } from 'child_process'
3
- // import { writeFile, mkdir } from 'node:fs/promises'
4
- // import { existsSync } from 'fs'
5
- export {};
6
- // export async function createNextJS(config: any, projectDir: string, emitLog: (log: string) => void) {
7
- // try {
8
- // const frontendDir = join(projectDir, 'frontend');
9
- // if (!existsSync(frontendDir)) {
10
- // emitLog('Creating frontend directory...');
11
- // await mkdir(frontendDir, { recursive: true });
12
- // }
13
- // emitLog('Creating Next.js project...');
14
- // const execOptions: ExecSyncOptions = {
15
- // cwd: frontendDir,
16
- // stdio: 'inherit',
17
- // encoding: 'utf-8'
18
- // };
19
- // execSync('npx create-next-app@latest . --typescript --tailwind --eslint --app --src-dir --import-alias "@/*" --no-git', execOptions);
20
- // emitLog('Updating package.json...');
21
- // const packageJsonPath = join(frontendDir, 'package.json');
22
- // const packageJson = require(packageJsonPath);
23
- // packageJson.scripts.dev = `next dev -p ${config.frontendPort}`;
24
- // await writeFile(
25
- // packageJsonPath,
26
- // JSON.stringify(packageJson, null, 2)
27
- // );
28
- // emitLog('Creating environment file...');
29
- // const envContent = `
30
- // NEXT_PUBLIC_API_URL=http://localhost:${config.backendPort}
31
- // NEXTAUTH_URL=http://localhost:${config.frontendPort}
32
- // NEXTAUTH_SECRET=your-secret-key-here
33
- // `;
34
- // await writeFile(
35
- // join(frontendDir, '.env'),
36
- // envContent.trim() + '\n'
37
- // );
38
- // emitLog('Setting up API proxy...');
39
- // const nextConfigContent = `
40
- // /** @type {import('next').NextConfig} */
41
- // const nextConfig = {
42
- // async rewrites() {
43
- // return [
44
- // {
45
- // source: '/api/:path*',
46
- // destination: 'http://localhost:${config.backendPort}/api/:path*'
47
- // }
48
- // ]
49
- // }
50
- // }
51
- // module.exports = nextConfig
52
- // `;
53
- // await writeFile(
54
- // join(frontendDir, 'next.config.js'),
55
- // nextConfigContent.trim() + '\n'
56
- // );
57
- // emitLog('✅ Next.js setup completed successfully!');
58
- // } catch (error) {
59
- // emitLog(`❌ Error setting up Next.js: ${error instanceof Error ? error.message : 'Unknown error'}`);
60
- // throw error;
61
- // }
62
- // }
@@ -1,31 +0,0 @@
1
- import { writeFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- export async function createReactJS(config, projectDir, emitLog) {
5
- emitLog('Creating ReactJS project...');
6
- await execSync(`npm create vite@latest frontend -- --template react`, {
7
- cwd: projectDir,
8
- stdio: 'inherit'
9
- });
10
- emitLog('Installing the dependencies for the frontend...');
11
- await execSync("npm install", { cwd: projectDir + "/frontend", stdio: "inherit" });
12
- emitLog('Writing Vite configuration...');
13
- const viteConfig = `
14
- import { defineConfig } from 'vite'
15
- import react from '@vitejs/plugin-react'
16
-
17
- export default defineConfig({
18
- plugins: [react()],
19
- server: {
20
- port: ${config.frontendPort},
21
- proxy: {
22
- '/api': {
23
- target: 'http://localhost:${config.backendPort}',
24
- changeOrigin: true
25
- }
26
- }
27
- }
28
- })`;
29
- await writeFile(join(projectDir, 'frontend', 'vite.config.js'), viteConfig.trim());
30
- emitLog('✅ ReactJS project created successfully!');
31
- }
@@ -1,30 +0,0 @@
1
- import { writeFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- export async function createReactTS(config, projectDir, emitLog) {
5
- emitLog('Creating ReactTS project...');
6
- await execSync(`npm create vite@latest frontend -- --template react-ts`, {
7
- cwd: projectDir,
8
- stdio: 'inherit'
9
- });
10
- emitLog('Installing the dependencies...');
11
- await execSync('npm install', { cwd: projectDir + '/frontend', stdio: 'inherit' });
12
- emitLog('Writing Vite configuration...');
13
- const viteConfig = `
14
- import { defineConfig } from 'vite'
15
- import react from '@vitejs/plugin-react'
16
- export default defineConfig({
17
- plugins: [react()],
18
- server: {
19
- port: ${config.frontendPort},
20
- proxy: {
21
- '/api': {
22
- target: 'http://localhost:${config.backendPort}',
23
- changeOrigin: true
24
- }
25
- }
26
- }
27
- })`;
28
- await writeFile(join(projectDir, 'frontend', 'vite.config.ts'), viteConfig.trim());
29
- emitLog('✅ ReactTS project created successfully!');
30
- }
@@ -1,37 +0,0 @@
1
- import { writeFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- export async function createVueJS(config, projectDir, emitLog) {
5
- emitLog('Creating VueJS project...');
6
- await execSync(`npm create vite@latest frontend -- --template vue`, {
7
- cwd: projectDir,
8
- stdio: 'inherit'
9
- });
10
- emitLog('Installing Vite...');
11
- console.log(projectDir);
12
- console.log(config);
13
- const viteConfig = `
14
- import { defineConfig } from 'vite'
15
- import vue from '@vitejs/plugin-vue'
16
-
17
- export default defineConfig({
18
- plugins: [vue()],
19
- server: {
20
- port: ${config.frontendPort},
21
- proxy: {
22
- '/api': {
23
- target: 'http://localhost:${config.backendPort}',
24
- changeOrigin: true
25
- }
26
- }
27
- }
28
- })`;
29
- emitLog('Writing Vite configuration...');
30
- await writeFile(join(projectDir, 'frontend', `vite.config.js`), viteConfig.trim());
31
- emitLog('Installing Vue Router and Pinia...');
32
- await execSync('npm install vue-router@4 pinia@2', {
33
- cwd: join(projectDir, 'frontend'),
34
- stdio: 'inherit'
35
- });
36
- emitLog('✅ VueJS project created successfully!');
37
- }
@@ -1,43 +0,0 @@
1
- import { writeFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- export async function createVueTS(config, projectDir, emitLog) {
5
- emitLog('Creating VueTS project...');
6
- emitLog('Installing Vite...');
7
- await execSync(`npm create vite@latest frontend -- --template vue-ts`, {
8
- cwd: projectDir,
9
- stdio: 'inherit'
10
- });
11
- emitLog('Configuring Vite...');
12
- const viteConfig = `
13
- import { defineConfig } from 'vite'
14
- import vue from '@vitejs/plugin-vue'
15
-
16
- export default defineConfig({
17
- plugins: [vue()],
18
- server: {
19
- port: ${config.frontendPort},
20
- proxy: {
21
- '/api': {
22
- target: 'http://localhost:${config.backendPort}',
23
- changeOrigin: true
24
- }
25
- }
26
- }
27
- })`;
28
- emitLog('Writing Vite configuration...');
29
- await writeFile(join(projectDir, 'frontend', `vite.config.ts`), viteConfig.trim());
30
- emitLog('Installing Vue Router and Pinia...');
31
- await execSync('npm install vue-router@4 pinia@2', {
32
- cwd: join(projectDir, 'frontend'),
33
- stdio: 'inherit'
34
- });
35
- emitLog('Installing TypeScript and other dependencies...');
36
- if (config.frontend === 'vue-ts') {
37
- await execSync('npm install -D @types/node', {
38
- cwd: join(projectDir, 'frontend'),
39
- stdio: 'inherit'
40
- });
41
- }
42
- emitLog('✅ VueTS project created successfully!');
43
- }
@@ -1,85 +0,0 @@
1
- import { join } from 'node:path';
2
- import { mkdir, writeFile } from 'node:fs/promises';
3
- import 'dotenv/config';
4
- export async function setupDrizzle(config, projectDir, emitLog) {
5
- try {
6
- emitLog('Starting Drizzle ORM setup...');
7
- const backendDir = join(projectDir, 'backend');
8
- const dbDir = join(backendDir, 'src', 'db');
9
- const schemasDir = join(dbDir, 'schema');
10
- emitLog('Creating directory structure...');
11
- await mkdir(schemasDir, { recursive: true });
12
- emitLog('✅ Directory structure created');
13
- emitLog('Generating environment configuration...');
14
- const envContent = `
15
- # Database Configuration
16
- ${config.env?.DATABASE_URL_ENV || 'DATABASE_URL'}=postgres://user:password@localhost:5432/${config.databaseName || 'myapp'}
17
- # Add other environment variables here
18
- NODE_ENV=development
19
- PORT=3000
20
- `;
21
- await writeFile(join(backendDir, '.env'), envContent.trim() + '\n');
22
- emitLog('✅ Environment configuration created');
23
- emitLog('Setting up database connection...');
24
- const dbCode = `
25
- import { drizzle } from 'drizzle-orm/node-postgres';
26
- import { Pool } from 'pg';
27
- import 'dotenv/config';
28
-
29
- const pool = new Pool({
30
- connectionString: process.env.${config.env?.DATABASE_URL_ENV || 'DATABASE_URL'},
31
- });
32
-
33
- export const db = drizzle(pool);
34
-
35
- export async function connectDB() {
36
- try {
37
- await pool.connect();
38
- console.log('Connected to PostgreSQL database');
39
- } catch (error) {
40
- console.error('Database connection error:', error);
41
- process.exit(1);
42
- }
43
- }
44
-
45
- export async function disconnectDB() {
46
- await pool.end();
47
- console.log('Disconnected from PostgreSQL database');
48
- }
49
- `;
50
- await writeFile(join(dbDir, 'index.ts'), dbCode);
51
- emitLog('✅ Database connection setup complete');
52
- emitLog('Creating example schema...');
53
- const exampleSchemaCode = `
54
- import { pgTable, serial, varchar, timestamp } from 'drizzle-orm/pg-core';
55
-
56
- export const examples = pgTable('examples', {
57
- id: serial('id').primaryKey(),
58
- name: varchar('name', { length: 256 }).notNull(),
59
- createdAt: timestamp('created_at').defaultNow(),
60
- });
61
- `;
62
- await writeFile(join(schemasDir, 'example.ts'), exampleSchemaCode);
63
- emitLog('✅ Example schema created');
64
- emitLog('Configuring Drizzle migrations...');
65
- const drizzleConfigCode = `
66
- import type { Config } from 'drizzle-kit';
67
-
68
- export default {
69
- schema: './src/db/schema/*',
70
- out: './src/db/migrations',
71
- driver: 'pg',
72
- dbCredentials: {
73
- connectionString: process.env.${config.env?.DATABASE_URL_ENV || 'DATABASE_URL'}!,
74
- },
75
- } satisfies Config;
76
- `;
77
- await writeFile(join(backendDir, 'drizzle.config.ts'), drizzleConfigCode);
78
- emitLog('✅ Drizzle configuration complete');
79
- emitLog('✅ Drizzle ORM setup completed successfully!');
80
- }
81
- catch (error) {
82
- emitLog(`❌ Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
83
- throw error;
84
- }
85
- }
@@ -1,53 +0,0 @@
1
- import { join } from 'node:path';
2
- import { mkdir, writeFile } from 'node:fs/promises';
3
- import 'dotenv/config';
4
- export async function setupMongoose(config, projectDir, emitLog) {
5
- const backendDir = join(projectDir, 'backend');
6
- const modelsDir = join(backendDir, 'src', 'models');
7
- await mkdir(modelsDir, { recursive: true });
8
- emitLog('Generating environment configuration...');
9
- const envContent = `
10
- # MongoDB Configuration
11
- ${config.env?.MONGODB_URI_ENV || 'MONGODB_URI'}=mongodb://localhost:27017/${config.databaseName || 'myapp'}
12
-
13
- # Add other environment variables here
14
- NODE_ENV=development
15
- PORT=3000
16
- `;
17
- await writeFile(join(backendDir, '.env'), envContent.trim() + '\n');
18
- emitLog('✅ Environment configuration created');
19
- emitLog('Setting up database connection...');
20
- const dbCode = `
21
- import mongoose from 'mongoose';
22
-
23
- const MONGODB_URI = process.env.${config.env?.MONGODB_URI_ENV || 'MONGODB_URI'} || 'mongodb://localhost:27017/${config.databaseName || 'myapp'}';
24
-
25
- export async function connectDB() {
26
- try {
27
- await mongoose.connect(MONGODB_URI);
28
- console.log('Connected to MongoDB');
29
- } catch (error) {
30
- console.error('MongoDB connection error:', error);
31
- process.exit(1);
32
- }
33
- }
34
-
35
- export async function disconnectDB() {
36
- await mongoose.disconnect();
37
- console.log('Disconnected from MongoDB');
38
- }
39
- `;
40
- emitLog('✅ Database connection setup complete');
41
- await writeFile(join(backendDir, 'db.ts'), dbCode);
42
- const exampleModelCode = `
43
- import mongoose from 'mongoose';
44
-
45
- const exampleSchema = new mongoose.Schema({
46
- name: { type: String, required: true },
47
- createdAt: { type: Date, default: Date.now },
48
- });
49
-
50
- export const Example = mongoose.model('Example', exampleSchema);
51
- `;
52
- await writeFile(join(modelsDir, 'example.ts'), exampleModelCode);
53
- }
@@ -1,12 +0,0 @@
1
- import { join } from 'node:path';
2
- import { execSync } from 'node:child_process';
3
- import { writeFileSync } from 'node:fs';
4
- export async function setupPrisma(config, projectDir, emitLog) {
5
- emitLog('Setting up Prisma...');
6
- const backendDir = join(projectDir, 'backend');
7
- const envContent = `DATABASE_URL=${config.dbUrl}\n`;
8
- writeFileSync(join(projectDir, 'backend', '.env'), envContent);
9
- await execSync('npm install prisma', { cwd: backendDir });
10
- await execSync('npx prisma init', { cwd: backendDir });
11
- emitLog('✅ Prisma setup complete');
12
- }
@@ -1,207 +0,0 @@
1
- import { writeFile, mkdir } from 'fs/promises';
2
- import { join } from 'path';
3
- import { execSync } from 'child_process';
4
- import { existsSync } from 'fs';
5
- export async function setupShadcn(config, projectDir, emitLog) {
6
- try {
7
- const frontendDir = join(projectDir, 'frontend');
8
- emitLog('📦 Setting up shadcn/ui...');
9
- // Make sure Tailwind is set up first
10
- emitLog('Ensuring Tailwind CSS is set up...');
11
- // Install shadcn/ui dependencies
12
- emitLog('Installing shadcn/ui dependencies...');
13
- execSync('npm install @shadcn/ui class-variance-authority clsx tailwind-merge lucide-react', {
14
- cwd: frontendDir,
15
- stdio: 'inherit'
16
- });
17
- // Create components.json configuration
18
- const componentsConfig = {
19
- $schema: "https://ui.shadcn.com/schema.json",
20
- style: "default",
21
- rsc: false,
22
- tailwind: {
23
- config: "tailwind.config.js",
24
- css: "src/index.css",
25
- baseColor: "slate",
26
- cssVariables: true,
27
- },
28
- aliases: {
29
- components: "@/components",
30
- utils: "@/lib/utils"
31
- }
32
- };
33
- await writeFile(join(frontendDir, 'components.json'), JSON.stringify(componentsConfig, null, 2));
34
- // Create utils file
35
- const utilsDir = join(frontendDir, 'src', 'lib');
36
- if (!existsSync(utilsDir)) {
37
- await mkdir(utilsDir, { recursive: true });
38
- }
39
- const utilsContent = `
40
- import { type ClassValue, clsx } from "clsx"
41
- import { twMerge } from "tailwind-merge"
42
-
43
- export function cn(...inputs: ClassValue[]) {
44
- return twMerge(clsx(inputs))
45
- }
46
- `;
47
- await writeFile(join(utilsDir, 'utils.ts'), utilsContent.trim() + '\n');
48
- emitLog('✅ shadcn/ui setup completed successfully!');
49
- }
50
- catch (error) {
51
- emitLog(`❌ Error setting up shadcn/ui: ${error instanceof Error ? error.message : 'Unknown error'}`);
52
- throw error;
53
- }
54
- }
55
- function generateShadcnTailwindConfig(frontend) {
56
- const baseConfig = {
57
- darkMode: ["class"],
58
- content: frontend === 'django'
59
- ? ["./templates/**/*.html", "./static/**/*.{js,ts}"]
60
- : ["./index.html", "./src/**/*.{js,ts,jsx,tsx,vue}"],
61
- theme: {
62
- container: {
63
- center: true,
64
- padding: "2rem",
65
- screens: {
66
- "2xl": "1400px",
67
- },
68
- },
69
- extend: {
70
- colors: {
71
- border: "hsl(var(--border))",
72
- input: "hsl(var(--input))",
73
- ring: "hsl(var(--ring))",
74
- background: "hsl(var(--background))",
75
- foreground: "hsl(var(--foreground))",
76
- primary: {
77
- DEFAULT: "hsl(var(--primary))",
78
- foreground: "hsl(var(--primary-foreground))",
79
- },
80
- secondary: {
81
- DEFAULT: "hsl(var(--secondary))",
82
- foreground: "hsl(var(--secondary-foreground))",
83
- },
84
- destructive: {
85
- DEFAULT: "hsl(var(--destructive))",
86
- foreground: "hsl(var(--destructive-foreground))",
87
- },
88
- muted: {
89
- DEFAULT: "hsl(var(--muted))",
90
- foreground: "hsl(var(--muted-foreground))",
91
- },
92
- accent: {
93
- DEFAULT: "hsl(var(--accent))",
94
- foreground: "hsl(var(--accent-foreground))",
95
- },
96
- popover: {
97
- DEFAULT: "hsl(var(--popover))",
98
- foreground: "hsl(var(--popover-foreground))",
99
- },
100
- card: {
101
- DEFAULT: "hsl(var(--card))",
102
- foreground: "hsl(var(--card-foreground))",
103
- },
104
- },
105
- borderRadius: {
106
- lg: "var(--radius)",
107
- md: "calc(var(--radius) - 2px)",
108
- sm: "calc(var(--radius) - 4px)",
109
- },
110
- keyframes: {
111
- "accordion-down": {
112
- from: { height: "0" },
113
- to: { height: "var(--radix-accordion-content-height)" },
114
- },
115
- "accordion-up": {
116
- from: { height: "var(--radix-accordion-content-height)" },
117
- to: { height: "0" },
118
- },
119
- },
120
- animation: {
121
- "accordion-down": "accordion-down 0.2s ease-out",
122
- "accordion-up": "accordion-up 0.2s ease-out",
123
- },
124
- },
125
- },
126
- plugins: ["require('tailwindcss-animate')"],
127
- };
128
- return `/** @type {import('tailwindcss').Config} */
129
- export default ${JSON.stringify(baseConfig, null, 2)}`;
130
- }
131
- function generateShadcnStyles(frontend) {
132
- return `@tailwind base;
133
- @tailwind components;
134
- @tailwind utilities;
135
- @layer base {
136
- :root {
137
- --background: 0 0% 100%;
138
- --foreground: 222.2 84% 4.9%;
139
-
140
- --card: 0 0% 100%;
141
- --card-foreground: 222.2 84% 4.9%;
142
-
143
- --popover: 0 0% 100%;
144
- --popover-foreground: 222.2 84% 4.9%;
145
-
146
- --primary: 222.2 47.4% 11.2%;
147
- --primary-foreground: 210 40% 98%;
148
-
149
- --secondary: 210 40% 96.1%;
150
- --secondary-foreground: 222.2 47.4% 11.2%;
151
-
152
- --muted: 210 40% 96.1%;
153
- --muted-foreground: 215.4 16.3% 46.9%;
154
-
155
- --accent: 210 40% 96.1%;
156
- --accent-foreground: 222.2 47.4% 11.2%;
157
-
158
- --destructive: 0 84.2% 60.2%;
159
- --destructive-foreground: 210 40% 98%;
160
-
161
- --border: 214.3 31.8% 91.4%;
162
- --input: 214.3 31.8% 91.4%;
163
- --ring: 222.2 84% 4.9%;
164
-
165
- --radius: 0.5rem;
166
- }
167
-
168
- .dark {
169
- --background: 222.2 84% 4.9%;
170
- --foreground: 210 40% 98%;
171
-
172
- --card: 222.2 84% 4.9%;
173
- --card-foreground: 210 40% 98%;
174
-
175
- --popover: 222.2 84% 4.9%;
176
- --popover-foreground: 210 40% 98%;
177
-
178
- --primary: 210 40% 98%;
179
- --primary-foreground: 222.2 47.4% 11.2%;
180
-
181
- --secondary: 217.2 32.6% 17.5%;
182
- --secondary-foreground: 210 40% 98%;
183
-
184
- --muted: 217.2 32.6% 17.5%;
185
- --muted-foreground: 215 20.2% 65.1%;
186
-
187
- --accent: 217.2 32.6% 17.5%;
188
- --accent-foreground: 210 40% 98%;
189
-
190
- --destructive: 0 62.8% 30.6%;
191
- --destructive-foreground: 210 40% 98%;
192
-
193
- --border: 217.2 32.6% 17.5%;
194
- --input: 217.2 32.6% 17.5%;
195
- --ring: 212.7 26.8% 83.9%;
196
- }
197
- }
198
-
199
- @layer base {
200
- * {
201
- @apply border-border;
202
- }
203
- body {
204
- @apply bg-background text-foreground;
205
- }
206
- }`;
207
- }