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.
Files changed (2) hide show
  1. package/index.js +145 -78
  2. package/package.json +6 -2
package/index.js CHANGED
@@ -1,83 +1,98 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require('child_process');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const inquirer = require('inquirer');
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
- // Vue CLI exact color palette from the photo
11
+ // Color palette inspired by the ZEN website
9
12
  const colors = {
10
- reset: '\x1b[0m',
11
- bright: '\x1b[1m',
12
- dim: '\x1b[2m',
13
-
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
- 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
- // Vue CLI exact text styling
24
- const vue = (text) => `${colors.bright}${colors.green}${text}${colors.reset}`;
25
- const subtitle = (text) => `${colors.lightBlue}${text}${colors.reset}`;
26
- const prompt = (text) => `${colors.white}${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}`;
30
- const success = (text) => `${colors.green}${text}${colors.reset}`;
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 Vue CLI exact header
32
+ // Display stunning header with boxen
33
33
  const displayHeader = () => {
34
34
  console.clear();
35
35
  console.log();
36
- console.log(' ' + vue('ZEN') + ' - ' + subtitle('The Professional Web Development Starter'));
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 Vue CLI exact styling
53
+ // Get project name with enhanced styling
41
54
  const getProjectName = async () => {
42
- const { projectName } = await inquirer.default.prompt([
43
- {
44
- type: 'input',
45
- name: 'projectName',
46
- message: 'Project name (target directory):',
47
- default: 'zen-starter-app',
48
- prefix: ''
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(' ' + option(projectName));
67
+ console.log(` ${chalk.hex(colors.green)('')} ${title('Project name:')} ${highlight(projectName)}`);
53
68
  return projectName;
54
69
  };
55
70
 
56
- // Get project version choice with Vue CLI exact styling and arrow navigation
71
+ // Get project version with beautiful selection
57
72
  const getProjectVersion = async () => {
58
73
  console.log();
59
- console.log(' ' + '◇' + ' ' + prompt('Select ZEN starter version:'));
60
- console.log(' ' + description('(↑/↓ to navigate, space to select, enter to confirm)'));
74
+ console.log(` ${chalk.hex(colors.green)('◇')} ${title('Select ZEN starter version:')}`);
75
+ console.log();
61
76
 
62
- const { version } = await inquirer.default.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
- ]);
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 - Lightweight for static sites';
111
+ return 'Lite Version - Essential features only';
97
112
  }
98
113
  return 'Standard Version - Full-featured with all components';
99
114
  };
100
115
 
101
- // Main function
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
- if (fs.existsSync(PROJECT_NAME)) {
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
- console.log();
119
- console.log(' ' + '◇' + ' ' + prompt('Cloning repository...'));
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: 'inherit' });
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
- console.log(' ' + error('Clone failed. Please check your internet connection or permissions.'));
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 so the created project is not a git repo
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
- console.log(' ' + success('✅ Project created successfully!'));
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
- console.log(' ' + '◇' + ' ' + prompt('Next steps:'));
135
- console.log(' ' + option(`cd ${PROJECT_NAME}`));
136
- console.log(' ' + option('npm install'));
137
- console.log(' ' + option('npm run dev'));
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
- console.log(' ' + vue('Happy coding with ZEN!') + ' ✨');
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(' ' + error('❌ An error occurred:'), err.message);
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.5.2",
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
- "inquirer": "^9.2.12"
11
+ "prompts": "^2.4.2",
12
+ "chalk": "^5.3.0",
13
+ "ora": "^7.0.1",
14
+ "boxen": "^7.1.1"
11
15
  }
12
16
  }