@shivasankaran18/stackd 1.7.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.
- package/apps/cli/src/cli.ts +28 -2
- package/apps/cli/src/commands/create.ts +30 -0
- package/apps/cli/src/scripts/ui/shadcn.ts +4 -10
- package/apps/cli/src/scripts/ui/tailwind.ts +39 -0
- package/apps/web/app/scaffold/page.tsx +1 -1
- package/apps/web/package.json +1 -1
- package/apps/web/tsconfig.json +108 -20
- package/package.json +19 -21
- package/stackd.ts +0 -0
- package/dist/apps/cli/src/cli.js +0 -217
- package/dist/apps/cli/src/commands/create.js +0 -148
- package/dist/apps/cli/src/scripts/Auth/jwt.js +0 -78
- package/dist/apps/cli/src/scripts/Auth/nextAuth.js +0 -131
- package/dist/apps/cli/src/scripts/Auth/passport.js +0 -218
- package/dist/apps/cli/src/scripts/backend/django.js +0 -20
- package/dist/apps/cli/src/scripts/backend/expressjs.js +0 -58
- package/dist/apps/cli/src/scripts/backend/expressts.js +0 -83
- package/dist/apps/cli/src/scripts/frontend/angularjs.js +0 -1
- package/dist/apps/cli/src/scripts/frontend/angularts.js +0 -22
- package/dist/apps/cli/src/scripts/frontend/nextjs.js +0 -62
- package/dist/apps/cli/src/scripts/frontend/reactjs.js +0 -31
- package/dist/apps/cli/src/scripts/frontend/reactts.js +0 -30
- package/dist/apps/cli/src/scripts/frontend/vuejs.js +0 -37
- package/dist/apps/cli/src/scripts/frontend/vuets.js +0 -43
- package/dist/apps/cli/src/scripts/orms/drizzleSetup.js +0 -85
- package/dist/apps/cli/src/scripts/orms/mongoSetup.js +0 -53
- package/dist/apps/cli/src/scripts/orms/prismaSetup.js +0 -12
- package/dist/apps/cli/src/scripts/ui/shadcn.js +0 -207
- package/dist/apps/cli/src/scripts/ui/tailwindcss.js +0 -102
- package/dist/apps/web/app/api/auth/[...nextauth]/route.js +0 -5
- package/dist/apps/web/app/api/scaffold/route.js +0 -251
- package/dist/apps/web/app/home/page.js +0 -19
- package/dist/apps/web/app/layout.js +0 -19
- package/dist/apps/web/app/page.js +0 -1
- package/dist/apps/web/app/providers.js +0 -7
- package/dist/apps/web/app/scaffold/page.js +0 -326
- package/dist/apps/web/components/Sidebar.js +0 -54
- package/dist/apps/web/components/theme-provider.js +0 -6
- package/dist/apps/web/components/ui/button.js +0 -32
- package/dist/apps/web/components/ui/card.js +0 -15
- package/dist/apps/web/components/ui/dropdown-menu.js +0 -54
- package/dist/apps/web/components/ui/input.js +0 -7
- package/dist/apps/web/components/ui/label.js +0 -9
- package/dist/apps/web/components/ui/scroll-area.js +0 -19
- package/dist/apps/web/components/ui/sonner.js +0 -15
- package/dist/apps/web/components/ui/steps.js +0 -14
- package/dist/apps/web/components/ui/switch.js +0 -9
- package/dist/apps/web/lib/auth.js +0 -32
- package/dist/apps/web/lib/redis.js +0 -9
- package/dist/apps/web/lib/utils.js +0 -5
- package/dist/packages/scripts/Auth/jwt.js +0 -78
- package/dist/packages/scripts/Auth/nextAuth.js +0 -131
- package/dist/packages/scripts/Auth/passport.js +0 -218
- package/dist/packages/scripts/backend/django.js +0 -20
- package/dist/packages/scripts/backend/expressjs.js +0 -58
- package/dist/packages/scripts/backend/expressts.js +0 -83
- package/dist/packages/scripts/frontend/angularjs.js +0 -1
- package/dist/packages/scripts/frontend/angularts.js +0 -22
- package/dist/packages/scripts/frontend/nextjs.js +0 -62
- package/dist/packages/scripts/frontend/reactjs.js +0 -31
- package/dist/packages/scripts/frontend/reactts.js +0 -30
- package/dist/packages/scripts/frontend/vuejs.js +0 -37
- package/dist/packages/scripts/frontend/vuets.js +0 -43
- package/dist/packages/scripts/orms/drizzleSetup.js +0 -85
- package/dist/packages/scripts/orms/mongoSetup.js +0 -53
- package/dist/packages/scripts/orms/prismaSetup.js +0 -12
- package/dist/packages/scripts/ui/shadcn.js +0 -207
- package/dist/packages/scripts/ui/tailwindcss.js +0 -102
- package/dist/stackd.js +0 -114
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/packages/typescript-config/base.json +0 -19
- package/packages/typescript-config/nextjs.json +0 -12
- package/packages/typescript-config/package.json +0 -9
- package/packages/typescript-config/react-library.json +0 -7
@@ -1,102 +0,0 @@
|
|
1
|
-
import { writeFile } from 'node:fs/promises';
|
2
|
-
import { join } from 'node:path';
|
3
|
-
import { execSync } from 'child_process';
|
4
|
-
import { existsSync } from 'fs';
|
5
|
-
import { mkdir } from 'fs/promises';
|
6
|
-
export async function setupTailwindCSS(config, projectDir, emitLog) {
|
7
|
-
try {
|
8
|
-
const frontendDir = join(projectDir, 'frontend');
|
9
|
-
const srcDir = join(frontendDir, 'src');
|
10
|
-
// Ensure directories exist
|
11
|
-
if (!existsSync(frontendDir)) {
|
12
|
-
emitLog('Creating frontend directory...');
|
13
|
-
await mkdir(frontendDir, { recursive: true });
|
14
|
-
}
|
15
|
-
if (!existsSync(srcDir)) {
|
16
|
-
emitLog('Creating src directory...');
|
17
|
-
await mkdir(srcDir, { recursive: true });
|
18
|
-
}
|
19
|
-
// Initialize package.json if it doesn't exist
|
20
|
-
if (!existsSync(join(frontendDir, 'package.json'))) {
|
21
|
-
emitLog('Initializing package.json...');
|
22
|
-
execSync('npm init -y', {
|
23
|
-
cwd: frontendDir,
|
24
|
-
stdio: 'inherit'
|
25
|
-
});
|
26
|
-
}
|
27
|
-
// Install dependencies using npm directly
|
28
|
-
emitLog('Installing Tailwind CSS dependencies...');
|
29
|
-
execSync('npm install tailwindcss@latest postcss@latest autoprefixer@latest --save-dev', {
|
30
|
-
cwd: frontendDir,
|
31
|
-
stdio: 'inherit'
|
32
|
-
});
|
33
|
-
// Create tailwind.config.js manually instead of using npx
|
34
|
-
emitLog('Creating Tailwind configuration...');
|
35
|
-
const tailwindConfig = generateTailwindConfig(config.frontend);
|
36
|
-
await writeFile(join(frontendDir, 'tailwind.config.js'), tailwindConfig);
|
37
|
-
// Create postcss.config.js
|
38
|
-
emitLog('Creating PostCSS configuration...');
|
39
|
-
const postcssConfig = `
|
40
|
-
module.exports = {
|
41
|
-
plugins: {
|
42
|
-
tailwindcss: {},
|
43
|
-
autoprefixer: {},
|
44
|
-
},
|
45
|
-
}`;
|
46
|
-
await writeFile(join(frontendDir, 'postcss.config.js'), postcssConfig);
|
47
|
-
// Add Tailwind directives to CSS
|
48
|
-
emitLog('Creating CSS file with Tailwind directives...');
|
49
|
-
const tailwindDirectives = `
|
50
|
-
@tailwind base;
|
51
|
-
@tailwind components;
|
52
|
-
@tailwind utilities;
|
53
|
-
`;
|
54
|
-
await writeFile(join(srcDir, 'index.css'), tailwindDirectives);
|
55
|
-
emitLog('✅ Tailwind CSS setup completed successfully!');
|
56
|
-
}
|
57
|
-
catch (error) {
|
58
|
-
emitLog(`❌ Error setting up Tailwind CSS: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
59
|
-
throw error;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
function generateTailwindConfig(framework) {
|
63
|
-
const baseConfig = {
|
64
|
-
content: [
|
65
|
-
"./index.html",
|
66
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
67
|
-
],
|
68
|
-
theme: {
|
69
|
-
extend: {
|
70
|
-
colors: {
|
71
|
-
background: 'hsl(var(--background))',
|
72
|
-
foreground: 'hsl(var(--foreground))',
|
73
|
-
},
|
74
|
-
},
|
75
|
-
},
|
76
|
-
plugins: [],
|
77
|
-
};
|
78
|
-
switch (framework) {
|
79
|
-
case 'react-ts':
|
80
|
-
case 'react':
|
81
|
-
baseConfig.content = [
|
82
|
-
"./index.html",
|
83
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
84
|
-
];
|
85
|
-
break;
|
86
|
-
case 'vue-ts':
|
87
|
-
case 'vue':
|
88
|
-
baseConfig.content = [
|
89
|
-
"./index.html",
|
90
|
-
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
91
|
-
];
|
92
|
-
break;
|
93
|
-
case 'django':
|
94
|
-
baseConfig.content = [
|
95
|
-
"./templates/**/*.html",
|
96
|
-
"./static/**/*.{js,ts}",
|
97
|
-
];
|
98
|
-
break;
|
99
|
-
}
|
100
|
-
return `/** @type {import('tailwindcss').Config} */
|
101
|
-
module.exports = ${JSON.stringify(baseConfig, null, 2)}`;
|
102
|
-
}
|
@@ -1,251 +0,0 @@
|
|
1
|
-
import { NextResponse } from 'next/server';
|
2
|
-
import { mkdir } from 'node:fs/promises';
|
3
|
-
import { join } from 'node:path';
|
4
|
-
import { createReactTS } from '../../../../../packages/scripts/frontend/reactts';
|
5
|
-
import { createReactJS } from '../../../../../packages/scripts/frontend/reactjs';
|
6
|
-
import { createExpressTS } from '../../../../../packages/scripts/backend/expressts';
|
7
|
-
import { createExpressJS } from '../../../../../packages/scripts/backend/expressjs';
|
8
|
-
import { setupPrisma } from '../../../../../packages/scripts/orms/prismaSetup';
|
9
|
-
import { createVueJS } from '../../../../../packages/scripts/frontend/vuejs';
|
10
|
-
// import { createNextJS } from '../../../../../packages/scripts/frontend/nextjs'
|
11
|
-
import { createVueTS } from '../../../../../packages/scripts/frontend/vuets';
|
12
|
-
import { jwtAuthts, jwtAuthdjango } from '../../../../../packages/scripts/Auth/jwt';
|
13
|
-
import path from 'path';
|
14
|
-
import fs from 'fs/promises';
|
15
|
-
import { installDjangoDependencies } from '../../../../../packages/scripts/backend/django';
|
16
|
-
import createAngularTS from '../../../../../packages/scripts/frontend/angularts';
|
17
|
-
import { setupNextAuth } from '../../../../../packages/scripts/Auth/nextAuth';
|
18
|
-
import { setupPassport } from '../../../../../packages/scripts/Auth/passport';
|
19
|
-
import { setupMongoose } from '../../../../../packages/scripts/orms/mongoSetup';
|
20
|
-
import { setupDrizzle } from '../../../../../packages/scripts/orms/drizzleSetup';
|
21
|
-
import { setupTailwindCSS } from '../../../../../packages/scripts/ui/tailwindcss';
|
22
|
-
import { setupShadcn } from '../../../../../packages/scripts/ui/shadcn';
|
23
|
-
import simpleGit from 'simple-git';
|
24
|
-
const encoder = new TextEncoder();
|
25
|
-
export async function POST(req) {
|
26
|
-
try {
|
27
|
-
const config = await req.json();
|
28
|
-
console.log(config);
|
29
|
-
const projectDir = join(config.projectPath, config.projectName);
|
30
|
-
await mkdir(projectDir, { recursive: true });
|
31
|
-
const git = simpleGit(projectDir);
|
32
|
-
git.init()
|
33
|
-
.then(() => console.log('Initialized a new Git repository'))
|
34
|
-
.catch(err => console.error('Error:', err));
|
35
|
-
if (config.giturl) {
|
36
|
-
await git.remote(['add', 'origin', config.giturl]).then(() => console.log('Remote added')).catch(err => console.error('Error:', err));
|
37
|
-
}
|
38
|
-
const emitLog = (message) => {
|
39
|
-
console.log(`[Emit Logs]: ${message}`);
|
40
|
-
global.logs = global.logs || [];
|
41
|
-
global.logs.push(message);
|
42
|
-
};
|
43
|
-
switch (config.frontend) {
|
44
|
-
case 'react-ts':
|
45
|
-
await createReactTS(config, projectDir, emitLog);
|
46
|
-
break;
|
47
|
-
case 'react':
|
48
|
-
await createReactJS(config, projectDir, emitLog);
|
49
|
-
break;
|
50
|
-
// case 'nextjs':
|
51
|
-
// await createNextJS(config, projectDir, emitLog);
|
52
|
-
// break;
|
53
|
-
case 'django':
|
54
|
-
await installDjangoDependencies(projectDir);
|
55
|
-
break;
|
56
|
-
case 'vue':
|
57
|
-
await createVueJS(config, projectDir, emitLog);
|
58
|
-
break;
|
59
|
-
case 'vue-ts':
|
60
|
-
await createVueTS(config, projectDir, emitLog);
|
61
|
-
break;
|
62
|
-
case 'angularts':
|
63
|
-
await createAngularTS(config, projectDir);
|
64
|
-
break;
|
65
|
-
default:
|
66
|
-
throw new Error(`Unsupported frontend`);
|
67
|
-
}
|
68
|
-
switch (config.backend) {
|
69
|
-
case 'express-ts':
|
70
|
-
await createExpressTS(config, projectDir, emitLog);
|
71
|
-
break;
|
72
|
-
case 'express':
|
73
|
-
console.log("Creating the backend");
|
74
|
-
await createExpressJS(config, projectDir, emitLog);
|
75
|
-
break;
|
76
|
-
case 'django':
|
77
|
-
await installDjangoDependencies(projectDir);
|
78
|
-
break;
|
79
|
-
// case 'nextjs':
|
80
|
-
// await createNextJS(config, projectDir, emitLog);
|
81
|
-
// break;
|
82
|
-
default:
|
83
|
-
throw new Error(`Unsupported backend`);
|
84
|
-
}
|
85
|
-
switch (config.auth) {
|
86
|
-
case 'jwt':
|
87
|
-
await jwtAuthts(config, projectDir, emitLog);
|
88
|
-
break;
|
89
|
-
case 'nextauth':
|
90
|
-
await setupNextAuth(config, projectDir, emitLog);
|
91
|
-
break;
|
92
|
-
case 'passport':
|
93
|
-
await setupPassport(config, projectDir, emitLog);
|
94
|
-
break;
|
95
|
-
default:
|
96
|
-
throw new Error(`Unsupported auth`);
|
97
|
-
}
|
98
|
-
switch (config.orm) {
|
99
|
-
case 'drizzle':
|
100
|
-
await setupDrizzle(config, projectDir, emitLog);
|
101
|
-
break;
|
102
|
-
case 'prisma':
|
103
|
-
await setupPrisma(config, projectDir, emitLog);
|
104
|
-
break;
|
105
|
-
case 'mongoose':
|
106
|
-
await setupMongoose(config, projectDir, emitLog);
|
107
|
-
break;
|
108
|
-
default:
|
109
|
-
throw new Error(`Unsupported orm`);
|
110
|
-
}
|
111
|
-
const gitignore = `
|
112
|
-
# Dependencies
|
113
|
-
node_modules
|
114
|
-
.pnp
|
115
|
-
.pnp.js
|
116
|
-
|
117
|
-
# Production
|
118
|
-
dist
|
119
|
-
build
|
120
|
-
|
121
|
-
# Environment
|
122
|
-
.env
|
123
|
-
.env.local
|
124
|
-
.env.development.local
|
125
|
-
.env.test.local
|
126
|
-
.env.production.local
|
127
|
-
|
128
|
-
# Logs
|
129
|
-
npm-debug.log*
|
130
|
-
yarn-debug.log*
|
131
|
-
yarn-error.log*
|
132
|
-
|
133
|
-
# Editor
|
134
|
-
.vscode
|
135
|
-
.idea
|
136
|
-
*.swp
|
137
|
-
*.swo
|
138
|
-
|
139
|
-
# OS
|
140
|
-
.DS_Store
|
141
|
-
Thumbs.db
|
142
|
-
`;
|
143
|
-
switch (config.backend) {
|
144
|
-
case 'express-ts':
|
145
|
-
await jwtAuthts(config, projectDir, emitLog);
|
146
|
-
break;
|
147
|
-
case 'express':
|
148
|
-
await jwtAuthts(config, projectDir, emitLog);
|
149
|
-
break;
|
150
|
-
case 'django':
|
151
|
-
await jwtAuthdjango(config, projectDir, emitLog);
|
152
|
-
break;
|
153
|
-
default:
|
154
|
-
break;
|
155
|
-
}
|
156
|
-
switch (config.ui) {
|
157
|
-
case 'tailwind':
|
158
|
-
await setupTailwindCSS(config, projectDir, emitLog);
|
159
|
-
break;
|
160
|
-
case 'shadcn':
|
161
|
-
await setupTailwindCSS(config, projectDir, emitLog);
|
162
|
-
await setupShadcn(config, projectDir, emitLog);
|
163
|
-
break;
|
164
|
-
default:
|
165
|
-
break;
|
166
|
-
}
|
167
|
-
return NextResponse.json({
|
168
|
-
success: true,
|
169
|
-
projectPath: projectDir,
|
170
|
-
instructions: {
|
171
|
-
setup: [
|
172
|
-
`cd ${projectDir}`,
|
173
|
-
'npm install',
|
174
|
-
'npm run install:all',
|
175
|
-
'npm run dev'
|
176
|
-
]
|
177
|
-
}
|
178
|
-
});
|
179
|
-
}
|
180
|
-
catch (error) {
|
181
|
-
console.error('Error:', error);
|
182
|
-
return NextResponse.json({
|
183
|
-
error: 'Failed to generate project',
|
184
|
-
details: error instanceof Error ? error.message : 'Unknown error'
|
185
|
-
}, { status: 500 });
|
186
|
-
}
|
187
|
-
}
|
188
|
-
export async function GET() {
|
189
|
-
const stream = new ReadableStream({
|
190
|
-
start(controller) {
|
191
|
-
const interval = setInterval(() => {
|
192
|
-
if (global.logs?.length) {
|
193
|
-
const log = global.logs.shift();
|
194
|
-
const data = `data: ${log}\n\n`;
|
195
|
-
controller.enqueue(encoder.encode(data));
|
196
|
-
}
|
197
|
-
}, 100);
|
198
|
-
return () => clearInterval(interval);
|
199
|
-
},
|
200
|
-
});
|
201
|
-
return new Response(stream, {
|
202
|
-
headers: {
|
203
|
-
'Content-Type': 'text/event-stream',
|
204
|
-
'Cache-Control': 'no-cache',
|
205
|
-
'Connection': 'keep-alive',
|
206
|
-
},
|
207
|
-
});
|
208
|
-
}
|
209
|
-
async function configureDjangoFiles(projectPath) {
|
210
|
-
const settingsPath = path.join(projectPath, 'core', 'settings.py');
|
211
|
-
const urlsPath = path.join(projectPath, 'core', 'urls.py');
|
212
|
-
try {
|
213
|
-
let settingsContent = await fs.readFile(settingsPath, 'utf8');
|
214
|
-
const restFrameworkSettings = `
|
215
|
-
|
216
|
-
REST_FRAMEWORK = {
|
217
|
-
'DEFAULT_AUTHENTICATION_CLASSES': [
|
218
|
-
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
219
|
-
],
|
220
|
-
}
|
221
|
-
`;
|
222
|
-
const installedAppsIndex = settingsContent.indexOf('INSTALLED_APPS');
|
223
|
-
const insertPosition = settingsContent.indexOf(']', installedAppsIndex) + 1;
|
224
|
-
settingsContent =
|
225
|
-
settingsContent.slice(0, insertPosition) +
|
226
|
-
restFrameworkSettings +
|
227
|
-
settingsContent.slice(insertPosition);
|
228
|
-
await fs.writeFile(settingsPath, settingsContent, 'utf8');
|
229
|
-
let urlsContent = await fs.readFile(urlsPath, 'utf8');
|
230
|
-
const newUrlsContent = `from django.contrib import admin
|
231
|
-
from django.urls import path, include
|
232
|
-
from rest_framework_simplejwt import views as jwt_views
|
233
|
-
|
234
|
-
urlpatterns = [
|
235
|
-
path('admin/', admin.site.urls),
|
236
|
-
path('api/token/',
|
237
|
-
jwt_views.TokenObtainPairView.as_view(),
|
238
|
-
name='token_obtain_pair'),
|
239
|
-
path('api/token/refresh/',
|
240
|
-
jwt_views.TokenRefreshView.as_view(),
|
241
|
-
name='token_refresh'),
|
242
|
-
path('', include('main.urls')),
|
243
|
-
]
|
244
|
-
`;
|
245
|
-
await fs.writeFile(urlsPath, newUrlsContent, 'utf8');
|
246
|
-
}
|
247
|
-
catch (error) {
|
248
|
-
console.error('Error configuring Django files:', error);
|
249
|
-
throw error;
|
250
|
-
}
|
251
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Button } from "@/components/ui/button";
|
2
|
-
import Link from "next/link";
|
3
|
-
import { ArrowRight } from "lucide-react";
|
4
|
-
export default function Home() {
|
5
|
-
return (<main className="flex min-h-screen flex-col items-center justify-center p-24">
|
6
|
-
<div className="text-center">
|
7
|
-
<h1 className="text-4xl font-bold mb-4">Project Scaffolder</h1>
|
8
|
-
<p className="text-xl text-muted-foreground mb-8">
|
9
|
-
Create your full-stack application in minutes
|
10
|
-
</p>
|
11
|
-
<Link href="/scaffold">
|
12
|
-
<Button size="lg">
|
13
|
-
Get Started
|
14
|
-
<ArrowRight className="ml-2 h-4 w-4"/>
|
15
|
-
</Button>
|
16
|
-
</Link>
|
17
|
-
</div>
|
18
|
-
</main>);
|
19
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Inter } from "next/font/google";
|
2
|
-
import "./globals.css";
|
3
|
-
import { ThemeProvider } from "@/components/theme-provider";
|
4
|
-
import { Toaster } from "@/components/ui/sonner";
|
5
|
-
const inter = Inter({ subsets: ["latin"] });
|
6
|
-
export const metadata = {
|
7
|
-
title: "Stack'd - Full Stack Project Generator",
|
8
|
-
description: "Generate full-stack applications with ease",
|
9
|
-
};
|
10
|
-
export default function RootLayout({ children, }) {
|
11
|
-
return (<html lang="en" suppressHydrationWarning>
|
12
|
-
<body className={inter.className}>
|
13
|
-
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
14
|
-
<main>{children}</main>
|
15
|
-
<Toaster />
|
16
|
-
</ThemeProvider>
|
17
|
-
</body>
|
18
|
-
</html>);
|
19
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './scaffold/page';
|