create-zen 1.3.2 → 1.5.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 +61 -72
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -3,81 +3,83 @@
|
|
|
3
3
|
const { execSync } = require('child_process');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const
|
|
6
|
+
const inquirer = require('inquirer');
|
|
7
7
|
|
|
8
|
-
// Vue CLI
|
|
8
|
+
// Vue CLI exact color palette from the photo
|
|
9
9
|
const colors = {
|
|
10
10
|
reset: '\x1b[0m',
|
|
11
11
|
bright: '\x1b[1m',
|
|
12
12
|
dim: '\x1b[2m',
|
|
13
13
|
|
|
14
|
-
// Vue CLI
|
|
15
|
-
green: '\x1b[38;2;76;175;80m', //
|
|
16
|
-
|
|
17
|
-
blue: '\x1b[38;2;33;150;243m', //
|
|
14
|
+
// Exact colors from Vue CLI photo
|
|
15
|
+
green: '\x1b[38;2;76;175;80m', // Vue.js green
|
|
16
|
+
lightBlue: '\x1b[38;2;129;199;132m', // Light blue for subtitle
|
|
17
|
+
blue: '\x1b[38;2;33;150;243m', // Blue diamond
|
|
18
18
|
white: '\x1b[37m', // Pure white
|
|
19
19
|
grey: '\x1b[38;2;158;158;158m', // Medium grey
|
|
20
|
-
lightGrey: '\x1b[38;2;189;189;189m'
|
|
21
|
-
|
|
22
|
-
// Additional colors
|
|
23
|
-
red: '\x1b[31m',
|
|
24
|
-
yellow: '\x1b[33m'
|
|
20
|
+
lightGrey: '\x1b[38;2;189;189;189m' // Light grey for descriptions
|
|
25
21
|
};
|
|
26
22
|
|
|
27
|
-
// Vue CLI
|
|
23
|
+
// Vue CLI exact text styling
|
|
28
24
|
const vue = (text) => `${colors.bright}${colors.green}${text}${colors.reset}`;
|
|
29
|
-
const
|
|
30
|
-
const framework = (text) => `${colors.blue}${text}${colors.reset}`;
|
|
25
|
+
const subtitle = (text) => `${colors.lightBlue}${text}${colors.reset}`;
|
|
31
26
|
const prompt = (text) => `${colors.white}${text}${colors.reset}`;
|
|
32
|
-
const option = (text) => `${colors.
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const error = (text) => `${colors.red}${text}${colors.reset}`;
|
|
27
|
+
const option = (text) => `${colors.white}${text}${colors.reset}`;
|
|
28
|
+
const description = (text) => `${colors.lightGrey}${text}${colors.reset}`;
|
|
29
|
+
const error = (text) => `\x1b[31m${text}${colors.reset}`;
|
|
36
30
|
const success = (text) => `${colors.green}${text}${colors.reset}`;
|
|
37
31
|
|
|
38
|
-
//
|
|
39
|
-
const rl = readline.createInterface({
|
|
40
|
-
input: process.stdin,
|
|
41
|
-
output: process.stdout
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Display Vue CLI inspired header
|
|
32
|
+
// Display Vue CLI exact header
|
|
45
33
|
const displayHeader = () => {
|
|
46
34
|
console.clear();
|
|
47
35
|
console.log();
|
|
48
|
-
console.log(' ' + vue('ZEN') + ' - ' +
|
|
36
|
+
console.log(' ' + vue('ZEN') + ' - ' + subtitle('The Professional Web Development Starter'));
|
|
49
37
|
console.log();
|
|
50
38
|
};
|
|
51
39
|
|
|
52
|
-
// Get project name with Vue CLI styling
|
|
53
|
-
const getProjectName = () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
// Get project name with Vue CLI exact styling
|
|
41
|
+
const getProjectName = async () => {
|
|
42
|
+
const { projectName } = await inquirer.prompt([
|
|
43
|
+
{
|
|
44
|
+
type: 'input',
|
|
45
|
+
name: 'projectName',
|
|
46
|
+
message: 'Project name (target directory):',
|
|
47
|
+
default: 'zen-starter-app',
|
|
48
|
+
prefix: '◇'
|
|
49
|
+
}
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
console.log(' ' + option(projectName));
|
|
53
|
+
return projectName;
|
|
62
54
|
};
|
|
63
55
|
|
|
64
|
-
// Get project version choice with Vue CLI styling
|
|
65
|
-
const getProjectVersion = () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
// Get project version choice with Vue CLI exact styling and arrow navigation
|
|
57
|
+
const getProjectVersion = async () => {
|
|
58
|
+
console.log();
|
|
59
|
+
console.log(' ' + '◇' + ' ' + prompt('Select ZEN starter version:'));
|
|
60
|
+
console.log(' ' + description('(↑/↓ to navigate, space to select, enter to confirm)'));
|
|
61
|
+
|
|
62
|
+
const { version } = await inquirer.prompt([
|
|
63
|
+
{
|
|
64
|
+
type: 'list',
|
|
65
|
+
name: 'version',
|
|
66
|
+
message: '',
|
|
67
|
+
choices: [
|
|
68
|
+
{
|
|
69
|
+
name: '□ Standard Version (Full-featured with all components)',
|
|
70
|
+
value: 'standard'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: '□ Lite Version (Lightweight for static sites)',
|
|
74
|
+
value: 'lite'
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
prefix: ' ',
|
|
78
|
+
pageSize: 2
|
|
79
|
+
}
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
return version === 'lite';
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
// Get repository URL based on choice
|
|
@@ -96,16 +98,6 @@ const getVersionDescription = (isLite) => {
|
|
|
96
98
|
return 'Standard Version - Full-featured with all components';
|
|
97
99
|
};
|
|
98
100
|
|
|
99
|
-
// Display project summary
|
|
100
|
-
const displaySummary = (projectName, versionDesc, repoUrl) => {
|
|
101
|
-
console.log();
|
|
102
|
-
console.log(' ' + '◇' + ' ' + prompt('Project Summary:'));
|
|
103
|
-
console.log(' ' + option('Name:') + ' ' + selected(projectName));
|
|
104
|
-
console.log(' ' + option('Version:') + ' ' + selected(versionDesc));
|
|
105
|
-
console.log(' ' + option('Repository:') + ' ' + muted(repoUrl));
|
|
106
|
-
console.log();
|
|
107
|
-
};
|
|
108
|
-
|
|
109
101
|
// Main function
|
|
110
102
|
const main = async () => {
|
|
111
103
|
try {
|
|
@@ -116,16 +108,15 @@ const main = async () => {
|
|
|
116
108
|
const REPO_URL = getRepositoryUrl(isLite);
|
|
117
109
|
const VERSION_DESC = getVersionDescription(isLite);
|
|
118
110
|
|
|
119
|
-
displaySummary(PROJECT_NAME, VERSION_DESC, REPO_URL);
|
|
120
|
-
|
|
121
111
|
if (fs.existsSync(PROJECT_NAME)) {
|
|
112
|
+
console.log();
|
|
122
113
|
console.log(' ' + error('⛔ Directory "' + PROJECT_NAME + '" already exists!'));
|
|
123
|
-
console.log(' 💡 ' +
|
|
114
|
+
console.log(' 💡 ' + description('Please choose a different name or remove the existing directory.'));
|
|
124
115
|
process.exit(1);
|
|
125
116
|
}
|
|
126
117
|
|
|
127
|
-
console.log(' ' + '◇' + ' ' + prompt('Cloning repository...'));
|
|
128
118
|
console.log();
|
|
119
|
+
console.log(' ' + '◇' + ' ' + prompt('Cloning repository...'));
|
|
129
120
|
|
|
130
121
|
try {
|
|
131
122
|
execSync(`git clone --depth=1 "${REPO_URL}" "${PROJECT_NAME}"`, { stdio: 'inherit' });
|
|
@@ -141,9 +132,9 @@ const main = async () => {
|
|
|
141
132
|
console.log(' ' + success('✅ Project created successfully!'));
|
|
142
133
|
console.log();
|
|
143
134
|
console.log(' ' + '◇' + ' ' + prompt('Next steps:'));
|
|
144
|
-
console.log(' ' +
|
|
145
|
-
console.log(' ' +
|
|
146
|
-
console.log(' ' +
|
|
135
|
+
console.log(' ' + option(`cd ${PROJECT_NAME}`));
|
|
136
|
+
console.log(' ' + option('npm install'));
|
|
137
|
+
console.log(' ' + option('npm run dev'));
|
|
147
138
|
console.log();
|
|
148
139
|
console.log(' ' + vue('Happy coding with ZEN!') + ' ✨');
|
|
149
140
|
console.log();
|
|
@@ -151,8 +142,6 @@ const main = async () => {
|
|
|
151
142
|
} catch (error) {
|
|
152
143
|
console.log(' ' + error('❌ An error occurred:'), error.message);
|
|
153
144
|
process.exit(1);
|
|
154
|
-
} finally {
|
|
155
|
-
rl.close();
|
|
156
145
|
}
|
|
157
146
|
};
|
|
158
147
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "✨ Create a new web development project with modern setup powered by Vite 🚀",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-zen": "./index.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"fs-extra": "^11.1.1"
|
|
9
|
+
"fs-extra": "^11.1.1",
|
|
10
|
+
"inquirer": "^9.2.12"
|
|
10
11
|
}
|
|
11
12
|
}
|