create-zen 1.5.2 → 1.6.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/index.js +145 -78
- package/package.json +6 -2
package/index.js
CHANGED
|
@@ -1,83 +1,98 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
import boxen from 'boxen';
|
|
7
10
|
|
|
8
|
-
//
|
|
11
|
+
// Color palette inspired by the ZEN website
|
|
9
12
|
const colors = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
blue: '\x1b[38;2;33;150;243m', // Blue diamond
|
|
18
|
-
white: '\x1b[37m', // Pure white
|
|
19
|
-
grey: '\x1b[38;2;158;158;158m', // Medium grey
|
|
20
|
-
lightGrey: '\x1b[38;2;189;189;189m' // Light grey for descriptions
|
|
13
|
+
green: '#00FF88', // Bright neon green
|
|
14
|
+
lightGreen: '#00CC6A', // Darker green
|
|
15
|
+
purple: '#8B5CF6', // Purple accent
|
|
16
|
+
white: '#FFFFFF', // Pure white
|
|
17
|
+
lightGrey: '#9CA3AF', // Light grey
|
|
18
|
+
darkGrey: '#374151', // Dark grey
|
|
19
|
+
bgDark: '#1F2937' // Background dark
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const error = (text) =>
|
|
30
|
-
const success = (text) =>
|
|
22
|
+
// Enhanced text styling with chalk
|
|
23
|
+
const zen = (text) => chalk.hex(colors.green).bold(text);
|
|
24
|
+
const accent = (text) => chalk.hex(colors.purple).bold(text);
|
|
25
|
+
const title = (text) => chalk.hex(colors.white).bold(text);
|
|
26
|
+
const subtitle = (text) => chalk.hex(colors.lightGrey)(text);
|
|
27
|
+
const highlight = (text) => chalk.hex(colors.lightGreen)(text);
|
|
28
|
+
const error = (text) => chalk.red.bold(text);
|
|
29
|
+
const success = (text) => chalk.green.bold(text);
|
|
30
|
+
const info = (text) => chalk.blue(text);
|
|
31
31
|
|
|
32
|
-
// Display
|
|
32
|
+
// Display stunning header with boxen
|
|
33
33
|
const displayHeader = () => {
|
|
34
34
|
console.clear();
|
|
35
35
|
console.log();
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
const headerBox = boxen(
|
|
38
|
+
`${zen('ZEN')} - ${title('The Professional Web Development Starter')}\n${subtitle('v1.6.0 • Professional Starter Kit • MIT License')}`,
|
|
39
|
+
{
|
|
40
|
+
padding: 1,
|
|
41
|
+
margin: 1,
|
|
42
|
+
borderStyle: 'round',
|
|
43
|
+
borderColor: colors.green,
|
|
44
|
+
backgroundColor: colors.bgDark,
|
|
45
|
+
textAlignment: 'center'
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
console.log(headerBox);
|
|
37
50
|
console.log();
|
|
38
51
|
};
|
|
39
52
|
|
|
40
|
-
// Get project name with
|
|
53
|
+
// Get project name with enhanced styling
|
|
41
54
|
const getProjectName = async () => {
|
|
42
|
-
const { projectName } = await
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
const { projectName } = await prompts({
|
|
56
|
+
type: 'text',
|
|
57
|
+
name: 'projectName',
|
|
58
|
+
message: 'Project name:',
|
|
59
|
+
initial: 'zen-starter-app',
|
|
60
|
+
validate: (value) => {
|
|
61
|
+
if (!value.trim()) return 'Project name is required';
|
|
62
|
+
if (fs.existsSync(value.trim())) return 'Directory already exists';
|
|
63
|
+
return true;
|
|
49
64
|
}
|
|
50
|
-
|
|
65
|
+
});
|
|
51
66
|
|
|
52
|
-
console.log('
|
|
67
|
+
console.log(` ${chalk.hex(colors.green)('◇')} ${title('Project name:')} ${highlight(projectName)}`);
|
|
53
68
|
return projectName;
|
|
54
69
|
};
|
|
55
70
|
|
|
56
|
-
// Get project version
|
|
71
|
+
// Get project version with beautiful selection
|
|
57
72
|
const getProjectVersion = async () => {
|
|
58
73
|
console.log();
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(
|
|
74
|
+
console.log(` ${chalk.hex(colors.green)('◇')} ${title('Select ZEN starter version:')}`);
|
|
75
|
+
console.log();
|
|
61
76
|
|
|
62
|
-
const { version } = await
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const { version } = await prompts({
|
|
78
|
+
type: 'select',
|
|
79
|
+
name: 'version',
|
|
80
|
+
message: '',
|
|
81
|
+
choices: [
|
|
82
|
+
{
|
|
83
|
+
title: `${chalk.hex(colors.white)('Standard Version')} ${chalk.hex(colors.lightGrey)('(Full-featured with all components)')}`,
|
|
84
|
+
value: 'standard'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: `${chalk.hex(colors.purple)('Lite Version')} ${chalk.hex(colors.lightGrey)('(Essential features only)')}`,
|
|
88
|
+
value: 'lite'
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
initial: 0
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const selectedText = version === 'lite' ? 'Lite Version' : 'Standard Version';
|
|
95
|
+
console.log(` ${chalk.hex(colors.green)('◇')} ${title('Selected:')} ${highlight(selectedText)}`);
|
|
81
96
|
|
|
82
97
|
return version === 'lite';
|
|
83
98
|
};
|
|
@@ -93,12 +108,35 @@ const getRepositoryUrl = (isLite) => {
|
|
|
93
108
|
// Get version description
|
|
94
109
|
const getVersionDescription = (isLite) => {
|
|
95
110
|
if (isLite) {
|
|
96
|
-
return 'Lite Version -
|
|
111
|
+
return 'Lite Version - Essential features only';
|
|
97
112
|
}
|
|
98
113
|
return 'Standard Version - Full-featured with all components';
|
|
99
114
|
};
|
|
100
115
|
|
|
101
|
-
//
|
|
116
|
+
// Display project summary in a beautiful box
|
|
117
|
+
const displaySummary = (projectName, versionDesc, repoUrl) => {
|
|
118
|
+
console.log();
|
|
119
|
+
|
|
120
|
+
const summaryBox = boxen(
|
|
121
|
+
`${chalk.hex(colors.green)('📋')} ${title('Project Summary')}\n\n` +
|
|
122
|
+
`${chalk.hex(colors.purple)('🏷️')} ${title('Project Name:')} ${highlight(projectName)}\n` +
|
|
123
|
+
`${chalk.hex(colors.purple)('🎯')} ${title('Version:')} ${highlight(versionDesc)}\n` +
|
|
124
|
+
`${chalk.hex(colors.purple)('🔗')} ${title('Repository:')} ${subtitle(repoUrl)}`,
|
|
125
|
+
{
|
|
126
|
+
padding: 1,
|
|
127
|
+
margin: 1,
|
|
128
|
+
borderStyle: 'round',
|
|
129
|
+
borderColor: colors.purple,
|
|
130
|
+
backgroundColor: colors.bgDark,
|
|
131
|
+
textAlignment: 'left'
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
console.log(summaryBox);
|
|
136
|
+
console.log();
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Main function with enhanced UX
|
|
102
140
|
const main = async () => {
|
|
103
141
|
try {
|
|
104
142
|
displayHeader();
|
|
@@ -108,39 +146,68 @@ const main = async () => {
|
|
|
108
146
|
const REPO_URL = getRepositoryUrl(isLite);
|
|
109
147
|
const VERSION_DESC = getVersionDescription(isLite);
|
|
110
148
|
|
|
111
|
-
|
|
112
|
-
console.log();
|
|
113
|
-
console.log(' ' + error('⛔ Directory "' + PROJECT_NAME + '" already exists!'));
|
|
114
|
-
console.log(' 💡 ' + description('Please choose a different name or remove the existing directory.'));
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
149
|
+
displaySummary(PROJECT_NAME, VERSION_DESC, REPO_URL);
|
|
117
150
|
|
|
118
|
-
|
|
119
|
-
|
|
151
|
+
// Cloning with spinner
|
|
152
|
+
const spinner = ora({
|
|
153
|
+
text: `${chalk.hex(colors.green)('◇')} ${title('Cloning repository...')}`,
|
|
154
|
+
color: 'green'
|
|
155
|
+
}).start();
|
|
120
156
|
|
|
121
157
|
try {
|
|
122
|
-
execSync(`git clone --depth=1 "${REPO_URL}" "${PROJECT_NAME}"`, { stdio: '
|
|
158
|
+
execSync(`git clone --depth=1 "${REPO_URL}" "${PROJECT_NAME}"`, { stdio: 'pipe' });
|
|
159
|
+
spinner.succeed(`${chalk.hex(colors.green)('◇')} ${success('Repository cloned successfully!')}`);
|
|
123
160
|
} catch (err) {
|
|
124
|
-
|
|
161
|
+
spinner.fail(`${chalk.hex(colors.green)('◇')} ${error('Clone failed!')}`);
|
|
162
|
+
console.log(` ${subtitle('Please check your internet connection or permissions.')}`);
|
|
125
163
|
process.exit(1);
|
|
126
164
|
}
|
|
127
165
|
|
|
128
|
-
// Remove .git
|
|
166
|
+
// Remove .git
|
|
129
167
|
fs.rmSync(path.join(PROJECT_NAME, '.git'), { recursive: true, force: true });
|
|
130
168
|
|
|
169
|
+
// Success message with beautiful box
|
|
131
170
|
console.log();
|
|
132
|
-
|
|
171
|
+
const successBox = boxen(
|
|
172
|
+
`${chalk.hex(colors.green)('✅')} ${success('SUCCESS! Your project is ready to go!')} ${chalk.hex(colors.purple)('🎉')}`,
|
|
173
|
+
{
|
|
174
|
+
padding: 1,
|
|
175
|
+
margin: 1,
|
|
176
|
+
borderStyle: 'round',
|
|
177
|
+
borderColor: colors.green,
|
|
178
|
+
backgroundColor: colors.bgDark,
|
|
179
|
+
textAlignment: 'center'
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
console.log(successBox);
|
|
133
184
|
console.log();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log('
|
|
137
|
-
console.log(
|
|
185
|
+
|
|
186
|
+
// Next steps
|
|
187
|
+
console.log(` ${chalk.hex(colors.green)('◇')} ${title('Next steps:')}`);
|
|
188
|
+
console.log(` ${chalk.hex(colors.purple)('📁')} ${highlight(`cd ${PROJECT_NAME}`)}`);
|
|
189
|
+
console.log(` ${chalk.hex(colors.purple)('📦')} ${highlight('npm install')}`);
|
|
190
|
+
console.log(` ${chalk.hex(colors.purple)('🧑💻')} ${highlight('npm run dev')}`);
|
|
138
191
|
console.log();
|
|
139
|
-
|
|
192
|
+
|
|
193
|
+
// Final message
|
|
194
|
+
const finalBox = boxen(
|
|
195
|
+
`${zen('Happy coding with ZEN!')} ${chalk.hex(colors.purple)('✨')}`,
|
|
196
|
+
{
|
|
197
|
+
padding: 1,
|
|
198
|
+
margin: 1,
|
|
199
|
+
borderStyle: 'round',
|
|
200
|
+
borderColor: colors.purple,
|
|
201
|
+
backgroundColor: colors.bgDark,
|
|
202
|
+
textAlignment: 'center'
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
console.log(finalBox);
|
|
140
207
|
console.log();
|
|
141
208
|
|
|
142
209
|
} catch (err) {
|
|
143
|
-
console.log(
|
|
210
|
+
console.log(` ${error('❌ An error occurred:')} ${err.message}`);
|
|
144
211
|
process.exit(1);
|
|
145
212
|
}
|
|
146
213
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "✨ Create a new web development project with modern setup powered by Vite 🚀",
|
|
5
6
|
"bin": {
|
|
6
7
|
"create-zen": "./index.js"
|
|
7
8
|
},
|
|
8
9
|
"dependencies": {
|
|
9
10
|
"fs-extra": "^11.1.1",
|
|
10
|
-
"
|
|
11
|
+
"prompts": "^2.4.2",
|
|
12
|
+
"chalk": "^5.3.0",
|
|
13
|
+
"ora": "^7.0.1",
|
|
14
|
+
"boxen": "^7.1.1"
|
|
11
15
|
}
|
|
12
16
|
}
|