blux-start 1.1.0 → 1.3.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/bin/index.js +40 -6
  2. package/package.json +4 -2
package/bin/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { Command } from 'commander';
4
+ import { input } from '@inquirer/prompts'
5
+
4
6
  import chalk from 'chalk';
5
7
  import fs from 'fs-extra';
6
8
  import path from 'path';
9
+ import { spawn } from 'child_process'
7
10
 
8
11
  const program = new Command();
9
12
 
@@ -12,6 +15,7 @@ program
12
15
  .description('A simple CLI to scaffold a TypeScript boilerplate project for blu projects')
13
16
  .version('1.0.0');
14
17
 
18
+
15
19
  program
16
20
  .command('init')
17
21
  .argument('<project-name>', 'Name of the project directory')
@@ -280,14 +284,44 @@ export async function DbConnect(){
280
284
 
281
285
  // 5. Success Message
282
286
  console.log(chalk.green(`✨ Successfully scaffolded ${chalk.bold(projectName)}!`));
283
- console.log('\nNext steps:');
284
- console.log(chalk.cyan(` cd ${projectName}`));
285
- console.log(chalk.cyan(' npm install'));
286
- console.log(chalk.cyan(' npm run dev\n'));
287
287
 
288
+ // Vite ?
289
+
290
+ const vite = await input({
291
+ message:'Would you like create a client-side application ?: (y/n)',
292
+ required:false
293
+ })
294
+
295
+ if(vite === 'y'){
296
+ console.log(chalk.blue('\nšŸš€ Kicking off Vite process...\n'));
297
+ const viteProcess = spawn('npm', ['create', 'vite@latest'], {
298
+ cwd: process.cwd(),
299
+ stdio: 'inherit',
300
+ shell: true
301
+ });
302
+
303
+ viteProcess.on('close', (code) => {
304
+ if (code === 0) {
305
+ console.log(chalk.green('\n✨ Client application successfully scaffolded with Vite!'));
306
+ } else {
307
+ console.log(chalk.red(`\nVite scaffolding exited with code ${code}`));
308
+ }
309
+ });
310
+ }
311
+ else {
312
+ console.log('\nNext steps:');
313
+ console.log(chalk.cyan(` cd ${projectName}`));
314
+ console.log(chalk.cyan(' npm install'));
315
+ console.log(chalk.cyan(' npm run start\n'));
316
+ }
288
317
  } catch (err) {
289
- console.error(chalk.red('āŒ Something went wrong during generation:'), err);
318
+ if(err.message){
319
+ console.error(chalk.red(err.message))
320
+ }{
321
+ console.error(chalk.red('āŒ Something went wrong during generation:'), err);
322
+ }
290
323
  }
291
- });
324
+ })
325
+
292
326
 
293
327
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blux-start",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Xavier",
@@ -13,9 +13,11 @@
13
13
  "test": "echo \"Error: no test specified\" && exit 1"
14
14
  },
15
15
  "dependencies": {
16
+ "@inquirer/prompts": "^8.5.2",
16
17
  "chalk": "^5.6.2",
17
18
  "commander": "^15.0.0",
18
19
  "fs-extra": "^11.3.5",
19
- "prompts": "^2.4.2"
20
+ "prompts": "^2.4.2",
21
+ "vite": "^8.0.16"
20
22
  }
21
23
  }