create-zen 1.4.0 → 1.5.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/index.js +43 -35
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
8
|
// Vue CLI exact color palette from the photo
|
|
9
9
|
const colors = {
|
|
@@ -29,12 +29,6 @@ const description = (text) => `${colors.lightGrey}${text}${colors.reset}`;
|
|
|
29
29
|
const error = (text) => `\x1b[31m${text}${colors.reset}`;
|
|
30
30
|
const success = (text) => `${colors.green}${text}${colors.reset}`;
|
|
31
31
|
|
|
32
|
-
// Create readline interface
|
|
33
|
-
const rl = readline.createInterface({
|
|
34
|
-
input: process.stdin,
|
|
35
|
-
output: process.stdout
|
|
36
|
-
});
|
|
37
|
-
|
|
38
32
|
// Display Vue CLI exact header
|
|
39
33
|
const displayHeader = () => {
|
|
40
34
|
console.clear();
|
|
@@ -44,32 +38,48 @@ const displayHeader = () => {
|
|
|
44
38
|
};
|
|
45
39
|
|
|
46
40
|
// Get project name with Vue CLI exact styling
|
|
47
|
-
const getProjectName = () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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;
|
|
56
54
|
};
|
|
57
55
|
|
|
58
|
-
// Get project version choice with Vue CLI exact styling
|
|
59
|
-
const getProjectVersion = () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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';
|
|
73
83
|
};
|
|
74
84
|
|
|
75
85
|
// Get repository URL based on choice
|
|
@@ -129,11 +139,9 @@ const main = async () => {
|
|
|
129
139
|
console.log(' ' + vue('Happy coding with ZEN!') + ' ✨');
|
|
130
140
|
console.log();
|
|
131
141
|
|
|
132
|
-
} catch (
|
|
133
|
-
console.log(' ' + error('❌ An error occurred:'),
|
|
142
|
+
} catch (err) {
|
|
143
|
+
console.log(' ' + error('❌ An error occurred:'), err.message);
|
|
134
144
|
process.exit(1);
|
|
135
|
-
} finally {
|
|
136
|
-
rl.close();
|
|
137
145
|
}
|
|
138
146
|
};
|
|
139
147
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
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
|
}
|