generateproj 2.0.0 → 2.2.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 (3) hide show
  1. package/cli.js +6 -5
  2. package/package.json +3 -2
  3. package/welcome.js +20 -0
package/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  const fs = require('fs');
3
4
  const path = require('path');
4
5
  const args = process.argv.slice(2);
@@ -8,7 +9,7 @@ const args = process.argv.slice(2);
8
9
  */
9
10
  if (args.includes('--version') || args.includes('-v')) {
10
11
  try {
11
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
12
+ const packageJsonPath = path.join(__dirname, '.', 'package.json');
12
13
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
14
  console.log(`Version: ${packageJson.version}`);
14
15
  } catch (e) {
@@ -24,7 +25,7 @@ if (args.includes('--help') || args.includes('-h')) {
24
25
  try {
25
26
  const projects = ['Java', 'Nodejs', 'HTML', 'C++', 'Astro', 'Python', 'React', 'NextJs'];
26
27
  console.log(`Available projects: ${projects.join(', ')}`);
27
- console.log('\nUsage: generateproj <project-type>');
28
+ console.log('\nUsage: generateproj <project-type> or gpj <project-type>');
28
29
  } catch (e) {
29
30
  console.error('Unable to display available project types.');
30
31
  }
@@ -35,11 +36,11 @@ if (args.includes('--help') || args.includes('-h')) {
35
36
  * Argument check
36
37
  */
37
38
  if (args.length === 0) {
38
- console.log('Usage: generateproj [nodejs|java|html|cpp|astro|python|react|nextjs]');
39
+ console.log('Usage: generateproj or gpj [nodejs|java|html|cpp|astro|python|react|nextjs]');
39
40
  process.exit(1);
40
41
  }
41
42
 
42
- const projectType = args[1].toLowerCase();
43
+ const projectType = args[0].toLowerCase();
43
44
 
44
45
  switch (projectType) {
45
46
  case 'nodejs':
@@ -70,6 +71,6 @@ switch (projectType) {
70
71
  break;
71
72
  default:
72
73
  console.log(`Unsupported project type: ${projectType}`);
73
- console.log('Run "generateproj --help" to see all options.');
74
+ console.log('Run "generateproj --help" or "gpj --help" to see all options.');
74
75
  process.exit(1);
75
76
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "generateproj",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "main": "cli.js",
5
5
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "postinstall": "node welcome.js"
7
8
  },
8
9
  "author": "Strazzullo Ciro Andrea",
9
10
  "license": "ISC",
package/welcome.js ADDED
@@ -0,0 +1,20 @@
1
+ const reset = "\x1b[0m";
2
+ const bright = "\x1b[1m";
3
+ const cyan = "\x1b[36m";
4
+ const green = "\x1b[32m";
5
+ const yellow = "\x1b[33m";
6
+
7
+ const line = cyan + "━".repeat(50) + reset;
8
+
9
+ console.log("\n" + line);
10
+ console.log(`${bright}🚀 GENERATEPROJ ${reset}${green}installato con successo!${reset}`);
11
+ console.log(line);
12
+
13
+ console.log(`\nPuoi velocizzare il tuo workflow con i seguenti comandi:`);
14
+ console.log(`\n ${cyan}generateproj${reset} Lancia il tool completo`);
15
+ console.log(` ${cyan}gpj${reset} Scorciatoia rapida (consigliata)`);
16
+
17
+ console.log(`\n${yellow}📖 Esempio d'uso:${reset}`);
18
+ console.log(` $ gpj --help`);
19
+
20
+ console.log("\n" + line + "\n");