create-zen 1.7.2 → 1.8.0
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/.claude/settings.local.json +7 -0
- package/index.js +177 -140
- package/package.json +15 -15
package/index.js
CHANGED
|
@@ -1,140 +1,177 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import prompts from 'prompts';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
import ora from 'ora';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
white: '#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const getRepositoryUrl = (variant) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import prompts from 'prompts';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import ora from 'ora';
|
|
9
|
+
|
|
10
|
+
const c = {
|
|
11
|
+
teal: (t) => chalk.hex('#2DD4BF').bold(t),
|
|
12
|
+
tealDim: (t) => chalk.hex('#2DD4BF')(t),
|
|
13
|
+
violet: (t) => chalk.hex('#A78BFA').bold(t),
|
|
14
|
+
violetDim: (t) => chalk.hex('#A78BFA')(t),
|
|
15
|
+
amber: (t) => chalk.hex('#FCD34D').bold(t),
|
|
16
|
+
amberDim: (t) => chalk.hex('#FCD34D')(t),
|
|
17
|
+
white: (t) => chalk.hex('#F9FAFB').bold(t),
|
|
18
|
+
muted: (t) => chalk.hex('#6B7280')(t),
|
|
19
|
+
dim: (t) => chalk.hex('#374151')(t),
|
|
20
|
+
green: (t) => chalk.hex('#34D399')(t),
|
|
21
|
+
red: (t) => chalk.hex('#F87171')(t),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const line = () => c.dim(' ' + '─'.repeat(44));
|
|
25
|
+
|
|
26
|
+
const displayHeader = () => {
|
|
27
|
+
console.clear();
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(` ${c.teal('ZEN')} ${c.muted('·')} ${c.white('Web Development Starters')}`);
|
|
30
|
+
console.log(line());
|
|
31
|
+
console.log();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getProjectName = async () => {
|
|
35
|
+
const { projectName } = await prompts({
|
|
36
|
+
type: 'text',
|
|
37
|
+
name: 'projectName',
|
|
38
|
+
message: c.white('Project name'),
|
|
39
|
+
initial: 'my-project',
|
|
40
|
+
validate: (value) => {
|
|
41
|
+
if (!value.trim()) return 'Project name is required';
|
|
42
|
+
if (fs.existsSync(value.trim())) return `"${value.trim()}" already exists`;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (!projectName) process.exit(0);
|
|
48
|
+
return projectName;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getStarterVariant = async () => {
|
|
52
|
+
console.log();
|
|
53
|
+
const { variant } = await prompts({
|
|
54
|
+
type: 'select',
|
|
55
|
+
name: 'variant',
|
|
56
|
+
message: c.white('Choose a starter'),
|
|
57
|
+
choices: [
|
|
58
|
+
{
|
|
59
|
+
title: `${c.teal('Express')} ${c.muted('Tailwind CSS + Alpine.js')}`,
|
|
60
|
+
description: 'Fast, utility-first setup for modern projects',
|
|
61
|
+
value: 'express'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: `${c.violet('AI')} ${c.muted('Tailwind CSS + Alpine.js + Claude Code')}`,
|
|
65
|
+
description: 'AI-powered automatic site builder using Claude Code',
|
|
66
|
+
value: 'ai'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: `${c.muted('Standard')} ${c.muted('BEM + SCSS + TypeScript')}`,
|
|
70
|
+
description: 'Classic setup · not actively maintained',
|
|
71
|
+
value: 'standard'
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
initial: 0,
|
|
75
|
+
hint: ' '
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!variant) process.exit(0);
|
|
79
|
+
console.log();
|
|
80
|
+
return variant;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const getRepositoryUrl = (variant) => {
|
|
84
|
+
const repos = {
|
|
85
|
+
express: 'https://github.com/dmitry-conquer/zen-express.git',
|
|
86
|
+
ai: 'https://github.com/dmitry-conquer/zen-ai.git',
|
|
87
|
+
standard: 'https://github.com/dmitry-conquer/zen-starter.git',
|
|
88
|
+
};
|
|
89
|
+
return repos[variant];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const getNextSteps = (variant, name) => {
|
|
93
|
+
const steps = [
|
|
94
|
+
{ cmd: `cd ${name}`, label: 'enter project' },
|
|
95
|
+
{ cmd: 'npm install', label: 'install deps' },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
if (variant === 'ai') {
|
|
99
|
+
steps.push({ cmd: 'claude', label: 'open claude code' });
|
|
100
|
+
steps.push({ cmd: 'npm run dev', label: 'start dev server' });
|
|
101
|
+
} else {
|
|
102
|
+
steps.push({ cmd: 'npm run dev', label: 'start dev server' });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return steps;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const main = async () => {
|
|
109
|
+
try {
|
|
110
|
+
displayHeader();
|
|
111
|
+
|
|
112
|
+
const PROJECT_NAME = await getProjectName();
|
|
113
|
+
const variant = await getStarterVariant();
|
|
114
|
+
const REPO_URL = getRepositoryUrl(variant);
|
|
115
|
+
|
|
116
|
+
const spinner = ora({
|
|
117
|
+
text: ` ${c.muted('Cloning repository...')}`,
|
|
118
|
+
spinner: 'dots',
|
|
119
|
+
color: 'cyan'
|
|
120
|
+
}).start();
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
execSync(`git clone --depth=1 "${REPO_URL}" "${PROJECT_NAME}"`, { stdio: 'pipe' });
|
|
124
|
+
spinner.stop();
|
|
125
|
+
} catch (err) {
|
|
126
|
+
spinner.stop();
|
|
127
|
+
console.log();
|
|
128
|
+
console.log(` ${c.red('✗')} ${c.white('Clone failed.')} ${c.muted('Check your connection and try again.')}`);
|
|
129
|
+
console.log();
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
fs.rmSync(path.join(PROJECT_NAME, '.git'), { recursive: true, force: true });
|
|
134
|
+
|
|
135
|
+
// Success
|
|
136
|
+
console.log(` ${c.green('✓')} ${c.white('Project ready')} ${c.tealDim(PROJECT_NAME)}`);
|
|
137
|
+
console.log();
|
|
138
|
+
console.log(line());
|
|
139
|
+
console.log();
|
|
140
|
+
|
|
141
|
+
// Next steps
|
|
142
|
+
const steps = getNextSteps(variant, PROJECT_NAME);
|
|
143
|
+
console.log(` ${c.muted('Next steps')}`);
|
|
144
|
+
console.log();
|
|
145
|
+
steps.forEach(({ cmd, label }, i) => {
|
|
146
|
+
const num = c.dim(`${i + 1}.`);
|
|
147
|
+
console.log(` ${num} ${c.tealDim(cmd)} ${c.muted(label)}`);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
if (variant === 'ai') {
|
|
151
|
+
console.log();
|
|
152
|
+
console.log(` ${c.muted('─'.repeat(44))}`);
|
|
153
|
+
console.log(` ${c.violetDim('tip')} ${c.muted('Open Claude Code and let the AI build your site')}`);
|
|
154
|
+
console.log(` ${c.muted('automatically from your project description.')}`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (variant === 'standard') {
|
|
158
|
+
console.log();
|
|
159
|
+
console.log(` ${c.muted('note')} ${c.muted('Standard starter is not actively maintained.')}`);
|
|
160
|
+
console.log(` ${c.muted('Consider using Express for new projects.')}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
console.log();
|
|
164
|
+
console.log(line());
|
|
165
|
+
console.log();
|
|
166
|
+
console.log(` ${c.teal('ZEN')} ${c.muted('Happy building.')}`);
|
|
167
|
+
console.log();
|
|
168
|
+
|
|
169
|
+
} catch (err) {
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(` ${c.red('✗')} ${err.message}`);
|
|
172
|
+
console.log();
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-zen",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "✨ Create a new web development project with modern setup powered by Vite 🚀",
|
|
6
|
-
"bin": {
|
|
7
|
-
"create-zen": "index.js"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"fs-extra": "^11.1.1",
|
|
11
|
-
"prompts": "^2.4.2",
|
|
12
|
-
"chalk": "^5.3.0",
|
|
13
|
-
"ora": "^7.0.1"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "create-zen",
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "✨ Create a new web development project with modern setup powered by Vite 🚀",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-zen": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"fs-extra": "^11.1.1",
|
|
11
|
+
"prompts": "^2.4.2",
|
|
12
|
+
"chalk": "^5.3.0",
|
|
13
|
+
"ora": "^7.0.1"
|
|
14
|
+
}
|
|
15
|
+
}
|