@oinone/cli 7.2.1 → 7.2.2

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/bin/cli.js +33 -32
  2. package/package.json +7 -3
package/bin/cli.js CHANGED
@@ -33,7 +33,7 @@ const downloadAndExtractZip = (url, targetDir) => {
33
33
  const cachedZipPath = path.join(cacheDir, `static-resources-${etag}.zip`);
34
34
 
35
35
  if (fs.existsSync(cachedZipPath)) {
36
- console.log(chalk.cyan('Using cached static resources...'));
36
+ console.log(chalk.cyan('⚔ Zap! Using cached static resources...'));
37
37
  try {
38
38
  const zip = new AdmZip(cachedZipPath);
39
39
  zip.extractAllTo(targetDir, true);
@@ -70,7 +70,7 @@ const downloadAndExtractZip = (url, targetDir) => {
70
70
  let startTime = Date.now();
71
71
 
72
72
  const progressBar = new cliProgress.SingleBar({
73
- format: chalk.cyan('Downloading ') + `[{bar}] {percentage}% | ETA: {eta}s | {value}/{total} ${unit} | Speed: {speed} {speedUnit}/s`,
73
+ format: chalk.cyan('šŸš€ Fetching awesomeness ') + `[{bar}] {percentage}% | ā³ {eta}s left | šŸ“¦ {value}/{total} ${unit} | šŸ’Ø {speed} {speedUnit}/s`,
74
74
  barCompleteChar: '\u2588',
75
75
  barIncompleteChar: '\u2591',
76
76
  hideCursor: true,
@@ -155,9 +155,9 @@ cacheCmd
155
155
  const cacheDir = path.join(os.tmpdir(), 'oinone-cli-cache');
156
156
  if (fs.existsSync(cacheDir)) {
157
157
  fs.removeSync(cacheDir);
158
- console.log(chalk.green(`āœ” Cache cleaned successfully at ${cacheDir}`));
158
+ console.log(chalk.green(`✨ Whoosh! Cache swept clean at ${cacheDir}`));
159
159
  } else {
160
- console.log(chalk.yellow(`Cache directory does not exist: ${cacheDir}`));
160
+ console.log(chalk.yellow(`🤷 Cache directory already vanished (or never existed): ${cacheDir}`));
161
161
  }
162
162
  });
163
163
 
@@ -166,13 +166,13 @@ cacheCmd
166
166
  .description('Print cache directory information')
167
167
  .action(async () => {
168
168
  const cacheDir = path.join(os.tmpdir(), 'oinone-cli-cache');
169
- console.log(chalk.cyan('Cache Directory: ') + cacheDir);
169
+ console.log(chalk.cyan('šŸ“‚ Cache Directory: ') + cacheDir);
170
170
 
171
171
  if (fs.existsSync(cacheDir)) {
172
172
  const files = await fs.readdir(cacheDir);
173
173
  let totalSize = 0;
174
174
 
175
- console.log(chalk.cyan('Cached Files:'));
175
+ console.log(chalk.cyan('šŸ“¦ Cached Files:'));
176
176
  for (const file of files) {
177
177
  const filePath = path.join(cacheDir, file);
178
178
  const stat = await fs.stat(filePath);
@@ -185,7 +185,7 @@ cacheCmd
185
185
  displaySize = `${Math.round(stat.size / 1024)} KB`;
186
186
  }
187
187
 
188
- console.log(` - ${file} (${displaySize})`);
188
+ console.log(` - šŸ“„ ${file} (${displaySize})`);
189
189
  }
190
190
 
191
191
  let totalDisplaySize = '';
@@ -195,9 +195,9 @@ cacheCmd
195
195
  totalDisplaySize = `${Math.round(totalSize / 1024)} KB`;
196
196
  }
197
197
 
198
- console.log(chalk.cyan(`Total Cache Size: `) + totalDisplaySize);
198
+ console.log(chalk.cyan(`\nšŸ“Š Total Cache Size: `) + totalDisplaySize);
199
199
  } else {
200
- console.log(chalk.yellow('Cache is currently empty.'));
200
+ console.log(chalk.yellow('šŸƒ Cache is currently as empty as space.'));
201
201
  }
202
202
  });
203
203
 
@@ -238,47 +238,47 @@ program
238
238
  {
239
239
  type: 'input',
240
240
  name: 'companyName',
241
- message: 'Please enter the company name (e.g. ss):',
241
+ message: 'šŸ¢ What is your awesome company/org name? (e.g. ss):',
242
242
  default: 'ss',
243
243
  validate: (input) => {
244
- if (input.trim() === '') return 'Company name cannot be empty.';
244
+ if (input.trim() === '') return 'Oops! Company name cannot be empty šŸ™ˆ';
245
245
  return true;
246
246
  },
247
247
  },
248
248
  {
249
249
  type: 'input',
250
250
  name: 'projectName',
251
- message: 'Please enter the project name (e.g. oms):',
251
+ message: 'šŸš€ Name your epic project (e.g. oms):',
252
252
  default: 'oms',
253
253
  validate: (input) => {
254
- if (input.trim() === '') return 'Project name cannot be empty.';
254
+ if (input.trim() === '') return 'Hold on! Project name cannot be empty šŸ›‘';
255
255
  return true;
256
256
  },
257
257
  },
258
258
  {
259
259
  type: 'list',
260
260
  name: 'edition',
261
- message: 'Please select the Oinone edition:',
261
+ message: 'šŸ’Ž Choose your Oinone flavor:',
262
262
  choices: [
263
- { name: 'Community Edition (Default)', value: 'community' },
264
- { name: 'Enterprise Edition', value: 'enterprise' }
263
+ { name: '🌱 Community Edition (Default)', value: 'community' },
264
+ { name: 'šŸ‘‘ Enterprise Edition', value: 'enterprise' }
265
265
  ],
266
266
  default: 'community'
267
267
  },
268
268
  {
269
269
  type: 'list',
270
270
  name: 'oinoneVersion',
271
- message: 'Please select the Oinone version:',
271
+ message: 'šŸ“¦ Which Oinone version are we rocking today?',
272
272
  choices: [
273
- { name: '7.2.0 (Default)', value: '~7.2.0' },
274
- { name: '6.4.0', value: '~6.4.0' }
273
+ { name: '✨ 7.2.0 (Default)', value: '~7.2.0' },
274
+ { name: 'šŸ•°ļø 6.4.0', value: '~6.4.0' }
275
275
  ],
276
276
  default: '~7.2.0'
277
277
  },
278
278
  {
279
279
  type: 'confirm',
280
280
  name: 'downloadStaticResources',
281
- message: 'Do you want to download the latest static resources?',
281
+ message: 'šŸ“„ Shall we fetch the latest static resources for you? (Highly recommended! 🌟)',
282
282
  default: true
283
283
  }
284
284
  ]);
@@ -293,17 +293,17 @@ program
293
293
  const targetPath = path.resolve(process.cwd(), fullProjectName);
294
294
 
295
295
  if (fs.existsSync(targetPath)) {
296
- console.log(chalk.red(`\nError: Directory ${fullProjectName} already exists.\n`));
296
+ console.log(chalk.red(`\n🚫 Yikes! The directory ${fullProjectName} already exists. Try a different name or clear the path.\n`));
297
297
  process.exit(1);
298
298
  }
299
299
 
300
- const spinner = ora('Creating project...').start();
300
+ const spinner = ora('✨ Weaving magic to create your project...').start();
301
301
 
302
302
  const versionDir = oinoneVersion.replace(/[^0-9.]/g, ''); // Extract '7.2.0' or '6.4.0'
303
303
  const templatePath = path.resolve(__dirname, `../template-${versionDir}-${edition}`);
304
304
 
305
305
  if (!fs.existsSync(templatePath)) {
306
- spinner.fail(chalk.red(`Template for version ${oinoneVersion} (${edition} edition) not found.`));
306
+ spinner.fail(chalk.red(`😢 Uh-oh! Template for version ${oinoneVersion} (${edition} edition) went missing in action.`));
307
307
  process.exit(1);
308
308
  }
309
309
 
@@ -394,34 +394,35 @@ program
394
394
  }
395
395
 
396
396
  if (downloadStaticResources) {
397
- spinner.succeed(chalk.green('Project structure created successfully!'));
398
- console.log(chalk.cyan('Downloading static resources...'));
397
+ spinner.succeed(chalk.green('šŸŽ‰ Boom! Project structure is ready!'));
398
+ console.log(chalk.cyan('🚚 Hauling in the static resources...'));
399
399
  try {
400
400
  const ossDir = path.join(targetPath, 'packages', `${prefix}-boot`, 'public', 'oss');
401
401
  await fs.ensureDir(ossDir);
402
402
  await downloadAndExtractZip('https://pamirs.oss-cn-hangzhou.aliyuncs.com/oinone/installer/static-resources.zip', ossDir);
403
- console.log(chalk.green('āœ” Static resources downloaded successfully!'));
403
+ console.log(chalk.green('šŸŽÆ Bullseye! Static resources downloaded and ready to roll!'));
404
404
  } catch (err) {
405
- console.log(chalk.yellow(`āš ļø Project created, but failed to download static resources: ${err.message}`));
405
+ console.log(chalk.yellow(`āš ļø Project is ready, but the static resources had a hiccup: ${err.message}`));
406
406
  }
407
407
  } else {
408
- spinner.succeed(chalk.green('Project created successfully!'));
408
+ spinner.succeed(chalk.green('šŸŽ‰ Boom! Project created successfully!'));
409
409
  const relativeOssDir = `packages/${prefix}-boot/public/oss`;
410
- console.log(chalk.yellow(`\nāš ļø You chose not to download static resources automatically.`));
411
- console.log(chalk.yellow(`Please download and extract them manually before running the project:`));
410
+ console.log(chalk.yellow(`\nāš ļø You chose to skip the static resources download.`));
411
+ console.log(chalk.yellow(`Don't forget to grab them manually before you fire up the project:`));
412
412
  console.log(chalk.cyan(` mkdir -p ${fullProjectName}/${relativeOssDir}`));
413
413
  console.log(chalk.cyan(` curl -L https://pamirs.oss-cn-hangzhou.aliyuncs.com/oinone/installer/static-resources.zip -o static-resources.zip`));
414
414
  console.log(chalk.cyan(` unzip static-resources.zip -d ${fullProjectName}/${relativeOssDir}`));
415
415
  console.log(chalk.cyan(` rm static-resources.zip`));
416
416
  }
417
417
 
418
- console.log(`\nTo get started:\n`);
418
+ console.log(`\nšŸš€ Let's get this party started:\n`);
419
419
  console.log(chalk.cyan(` cd ${fullProjectName}`));
420
420
  console.log(chalk.cyan(` pnpm install`));
421
421
  console.log(chalk.cyan(` pnpm run dev\n`));
422
+ console.log(chalk.magenta(`Happy coding! šŸ’»ā˜•\n`));
422
423
 
423
424
  } catch (error) {
424
- console.error(chalk.red(`\nAn error occurred: ${error.message}\n`));
425
+ console.error(chalk.red(`\nšŸ’„ Oops! Something broke: ${error.message}\n`));
425
426
  process.exit(1);
426
427
  }
427
428
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oinone/cli",
3
- "version": "7.2.1",
3
+ "version": "7.2.2",
4
4
  "description": "CLI tool to generate Oinone Frontend Template",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -9,8 +9,12 @@
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1"
11
11
  },
12
- "keywords": [],
13
- "author": "",
12
+ "keywords": [
13
+ "oinone",
14
+ "oinone-frontend",
15
+ "cli"
16
+ ],
17
+ "author": "oinone",
14
18
  "license": "ISC",
15
19
  "dependencies": {
16
20
  "adm-zip": "^0.5.17",