@shivasankaran18/stackd 1.2.2 → 1.2.4
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
CHANGED
@@ -15,6 +15,7 @@ export interface ProjectConfig {
|
|
15
15
|
orm: string;
|
16
16
|
auth: string;
|
17
17
|
dbUrl: string;
|
18
|
+
ui: string;
|
18
19
|
}
|
19
20
|
|
20
21
|
interface Answers {
|
@@ -27,7 +28,8 @@ interface Answers {
|
|
27
28
|
orm: string;
|
28
29
|
auth: string;
|
29
30
|
dbUrl: string;
|
30
|
-
projectName:string;
|
31
|
+
projectName: string;
|
32
|
+
ui: string;
|
31
33
|
}
|
32
34
|
|
33
35
|
const showBanner = () => {
|
@@ -67,7 +69,9 @@ const CHOICES = {
|
|
67
69
|
MONGOOSE: 'Mongoose',
|
68
70
|
JWT: 'JWT',
|
69
71
|
NEXTAUTH: 'NextAuth',
|
70
|
-
PASSPORT: 'Passport'
|
72
|
+
PASSPORT: 'Passport',
|
73
|
+
TAILWIND: 'Tailwind CSS',
|
74
|
+
SHADCN: 'shadcn/ui + Tailwind'
|
71
75
|
};
|
72
76
|
|
73
77
|
program
|
@@ -124,6 +128,27 @@ program
|
|
124
128
|
}
|
125
129
|
]);
|
126
130
|
|
131
|
+
// Add UI framework selection after frontend
|
132
|
+
let uiChoice = { ui: CHOICES.NONE };
|
133
|
+
if (frontendChoice.frontend !== chalk.green(CHOICES.DJANGO_TEMPLATES) &&
|
134
|
+
frontendChoice.frontend !== CHOICES.SKIP) {
|
135
|
+
uiChoice = await inquirer.prompt([
|
136
|
+
{
|
137
|
+
type: 'list',
|
138
|
+
name: 'ui',
|
139
|
+
message: chalk.magenta.bold('🎨 Choose a UI framework:'),
|
140
|
+
choices: (answers) => {
|
141
|
+
const isReact = frontendChoice.frontend.includes('React');
|
142
|
+
return [
|
143
|
+
chalk.blue(CHOICES.TAILWIND),
|
144
|
+
...(isReact ? [chalk.cyan(CHOICES.SHADCN)] : []),
|
145
|
+
CHOICES.NONE
|
146
|
+
];
|
147
|
+
},
|
148
|
+
default: CHOICES.NONE,
|
149
|
+
}
|
150
|
+
]);
|
151
|
+
}
|
127
152
|
|
128
153
|
const backendChoice = await inquirer.prompt([
|
129
154
|
{
|
@@ -210,6 +235,7 @@ program
|
|
210
235
|
const answers = {
|
211
236
|
...projectSettings,
|
212
237
|
...frontendChoice,
|
238
|
+
...uiChoice,
|
213
239
|
...backendChoice,
|
214
240
|
...databaseChoice,
|
215
241
|
...ormChoice,
|
@@ -16,6 +16,8 @@ import chalk from 'chalk';
|
|
16
16
|
import ora from 'ora';
|
17
17
|
import { mkdir } from 'fs/promises';
|
18
18
|
import { ProjectConfig } from '../cli.js';
|
19
|
+
import { setupShadcn } from '../scripts/ui/shadcn.js';
|
20
|
+
import { setupTailwindCSS } from '../scripts/ui/tailwindcss.js';
|
19
21
|
|
20
22
|
const emitLog = (message: string): void => {
|
21
23
|
console.log(`[Emit Logs]: ${message}`);
|
@@ -64,6 +66,24 @@ export async function createProject(projectName: string, options: ProjectConfig)
|
|
64
66
|
break;
|
65
67
|
}
|
66
68
|
|
69
|
+
// UI Framework setup
|
70
|
+
if (options.ui !== 'None' && options.frontend !== 'Django Templates' && options.frontend !== 'Skip') {
|
71
|
+
spinner.text = 'Setting up UI framework...';
|
72
|
+
switch(options.ui) {
|
73
|
+
case 'Tailwind CSS':
|
74
|
+
await setupTailwindCSS(config, projectDir, emitLog);
|
75
|
+
break;
|
76
|
+
case 'shadcn/ui + Tailwind':
|
77
|
+
await setupTailwindCSS(config, projectDir, emitLog);
|
78
|
+
// @ts-ignore
|
79
|
+
await setupShadcn(config, projectDir, emitLog);
|
80
|
+
break;
|
81
|
+
default:
|
82
|
+
emitLog('Unknown UI framework choice');
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
67
87
|
// Backend setup
|
68
88
|
spinner.text = 'Setting up backend...';
|
69
89
|
switch(options.backend) {
|
@@ -143,6 +163,16 @@ export async function createProject(projectName: string, options: ProjectConfig)
|
|
143
163
|
}
|
144
164
|
}
|
145
165
|
|
166
|
+
// Add UI-specific instructions
|
167
|
+
if (options.ui !== 'None') {
|
168
|
+
console.log(chalk.yellow('\nUI Framework Setup:'));
|
169
|
+
if (options.ui === 'Tailwind CSS') {
|
170
|
+
console.log(chalk.cyan(' Tailwind CSS is ready to use'));
|
171
|
+
} else if (options.ui === 'shadcn/ui + Tailwind') {
|
172
|
+
console.log(chalk.cyan(' Run `npx shadcn-ui@latest init` to complete shadcn/ui setup'));
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
146
176
|
// Add database specific instructions
|
147
177
|
if (options.database !== 'Skip') {
|
148
178
|
console.log(chalk.yellow('\nDatabase Setup:'));
|
@@ -2,12 +2,9 @@ import { writeFile, mkdir } from 'fs/promises';
|
|
2
2
|
import { join } from 'path';
|
3
3
|
import { execSync } from 'child_process';
|
4
4
|
import { existsSync } from 'fs';
|
5
|
+
import { ProjectConfig } from '../../cli.js';
|
5
6
|
|
6
|
-
export async function setupShadcn(
|
7
|
-
config: any,
|
8
|
-
projectDir: string,
|
9
|
-
emitLog: (log: string) => void
|
10
|
-
) {
|
7
|
+
export async function setupShadcn(config: ProjectConfig, projectDir: string, emitLog: (message: string) => void) {
|
11
8
|
try {
|
12
9
|
const frontendDir = join(projectDir, 'frontend');
|
13
10
|
emitLog('📦 Setting up shadcn/ui...');
|
@@ -17,10 +14,7 @@ export async function setupShadcn(
|
|
17
14
|
|
18
15
|
// Install shadcn/ui dependencies
|
19
16
|
emitLog('Installing shadcn/ui dependencies...');
|
20
|
-
execSync('npm install @shadcn/ui
|
21
|
-
cwd: frontendDir,
|
22
|
-
stdio: 'inherit'
|
23
|
-
});
|
17
|
+
execSync('npm install @shadcn/ui', { cwd: projectDir });
|
24
18
|
|
25
19
|
// Create components.json configuration
|
26
20
|
const componentsConfig = {
|
@@ -66,7 +60,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
66
60
|
|
67
61
|
emitLog('✅ shadcn/ui setup completed successfully!');
|
68
62
|
} catch (error) {
|
69
|
-
emitLog(
|
63
|
+
emitLog('Failed to setup shadcn/ui');
|
70
64
|
throw error;
|
71
65
|
}
|
72
66
|
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { execSync } from 'child_process';
|
2
|
+
import { writeFile } from 'fs/promises';
|
3
|
+
import { join } from 'path';
|
4
|
+
import { ProjectConfig } from '../../cli.js';
|
5
|
+
|
6
|
+
export async function setupTailwind(config: ProjectConfig, projectDir: string, emitLog: (message: string) => void) {
|
7
|
+
try {
|
8
|
+
emitLog('Installing Tailwind CSS...');
|
9
|
+
execSync('npm install -D tailwindcss postcss autoprefixer', { cwd: projectDir });
|
10
|
+
execSync('npx tailwindcss init -p', { cwd: projectDir });
|
11
|
+
|
12
|
+
// Add Tailwind configuration
|
13
|
+
const tailwindConfig = `
|
14
|
+
module.exports = {
|
15
|
+
content: [
|
16
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
17
|
+
],
|
18
|
+
theme: {
|
19
|
+
extend: {},
|
20
|
+
},
|
21
|
+
plugins: [],
|
22
|
+
}`;
|
23
|
+
|
24
|
+
await writeFile(join(projectDir, 'tailwind.config.js'), tailwindConfig);
|
25
|
+
|
26
|
+
// Add Tailwind directives to CSS
|
27
|
+
const cssContent = `
|
28
|
+
@tailwind base;
|
29
|
+
@tailwind components;
|
30
|
+
@tailwind utilities;`;
|
31
|
+
|
32
|
+
await writeFile(join(projectDir, 'src/index.css'), cssContent);
|
33
|
+
|
34
|
+
emitLog('Tailwind CSS setup completed');
|
35
|
+
} catch (error) {
|
36
|
+
emitLog('Failed to setup Tailwind CSS');
|
37
|
+
throw error;
|
38
|
+
}
|
39
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@shivasankaran18/stackd",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.4",
|
4
4
|
"bin": {
|
5
5
|
"stackd": "stackd.ts",
|
6
6
|
"pre-install": "npm install"
|
@@ -52,6 +52,7 @@
|
|
52
52
|
"@types/chalk": "^2.2.4",
|
53
53
|
"@types/commander": "^2.12.5",
|
54
54
|
"@types/node": "^22.13.5",
|
55
|
+
"@types/react": "^19.0.10",
|
55
56
|
"axios": "^1.7.9",
|
56
57
|
"chalk": "^4.1.2",
|
57
58
|
"class-variance-authority": "^0.7.1",
|