forged-cli 0.8.0 → 0.8.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/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  npm install -g forged-cli
20
20
  ```
21
21
 
22
- Requires Node.js 18 or newer. Published from GitHub Actions with [npm provenance](https://docs.npmjs.com/generating-provenance-statements), so every release is traceable to the commit that built it.
22
+ Requires Node.js 20.12 or newer. Published from GitHub Actions with [npm provenance](https://docs.npmjs.com/generating-provenance-statements), so every release is traceable to the commit that built it.
23
23
 
24
24
  ---
25
25
 
package/bin/forged.js CHANGED
@@ -59,8 +59,8 @@ if (command === 'version') {
59
59
 
60
60
  if (command === 'readme') {
61
61
  const { readmeCommand } = await import('../src/commands/readme.js');
62
- await readmeCommand(args[0] || 'README.md');
63
- process.exit(0);
62
+ const written = await readmeCommand(args[0] || 'README.md');
63
+ process.exit(written === false ? 130 : 0); // 130 = cancelled with Ctrl+C
64
64
  }
65
65
 
66
66
  if (command === 'init') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forged-cli",
3
- "version": "0.8.0",
4
- "description": "A complete dev environment toolkit — shell, workflows, and project scaffolding in one install.",
3
+ "version": "0.8.1",
4
+ "description": "A complete dev environment toolkit \u2014 shell, workflows, and project scaffolding in one install.",
5
5
  "keywords": [
6
6
  "cli",
7
7
  "devtools",
@@ -25,7 +25,7 @@
25
25
  "forged": "bin/forged.js"
26
26
  },
27
27
  "engines": {
28
- "node": ">=18"
28
+ "node": ">=20.12"
29
29
  },
30
30
  "scripts": {
31
31
  "start": "node bin/forged.js",
@@ -1,12 +1,9 @@
1
- import { createRequire } from 'module';
1
+ import inquirer from 'inquirer';
2
2
  import { writeFile } from 'fs/promises';
3
3
  import { resolve } from 'path';
4
4
  import { detectProjectInfo } from '../utils/detectProject.js';
5
5
  import { generateMarkdown } from '../utils/generateMarkdown.js';
6
6
 
7
- const require = createRequire(import.meta.url);
8
- const { prompt } = require('inquirer');
9
-
10
7
  const green = '\x1b[32m';
11
8
  const purple = '\x1b[35m';
12
9
  const reset = '\x1b[0m';
@@ -18,65 +15,75 @@ export async function readmeCommand(outputPath = 'README.md') {
18
15
  if (detected.github) console.log(` Detected GitHub user: ${detected.github}`);
19
16
  console.log(' Press Enter to accept defaults.\n');
20
17
 
21
- const answers = await prompt([
22
- {
23
- type: 'input',
24
- name: 'title',
25
- message: `${green}Project name:${reset}`,
26
- default: detected.title,
27
- },
28
- {
29
- type: 'input',
30
- name: 'description',
31
- message: `${green}Short description:${reset}`,
32
- },
33
- {
34
- type: 'input',
35
- name: 'toDo',
36
- message: `${green}To-do items (leave blank to skip section):${reset}`,
37
- },
38
- {
39
- type: 'list',
40
- name: 'license',
41
- message: `${green}License:${reset}`,
42
- choices: ['MIT', 'APACHE 2.0', 'GPL 3.0', 'BSD 3', 'None'],
43
- },
44
- {
45
- type: 'input',
46
- name: 'installation',
47
- message: `${green}Install command:${reset}`,
48
- default: detected.installCommand,
49
- },
50
- {
51
- type: 'input',
52
- name: 'test',
53
- message: `${green}Test command:${reset}`,
54
- default: detected.testCommand,
55
- },
56
- {
57
- type: 'input',
58
- name: 'usage',
59
- message: `${green}Usage instructions:${reset}`,
60
- },
61
- {
62
- type: 'input',
63
- name: 'contributing',
64
- message: `${green}Contributing guidelines:${reset}`,
65
- default: 'Fork the project and open a pull request with your changes',
66
- },
67
- {
68
- type: 'input',
69
- name: 'github',
70
- message: `${green}GitHub username:${reset}`,
71
- default: detected.github,
72
- },
73
- {
74
- type: 'input',
75
- name: 'email',
76
- message: `${green}Email address:${reset}`,
77
- default: detected.email,
78
- },
79
- ]);
18
+ let answers;
19
+ try {
20
+ answers = await inquirer.prompt([
21
+ {
22
+ type: 'input',
23
+ name: 'title',
24
+ message: `${green}Project name:${reset}`,
25
+ default: detected.title,
26
+ },
27
+ {
28
+ type: 'input',
29
+ name: 'description',
30
+ message: `${green}Short description:${reset}`,
31
+ },
32
+ {
33
+ type: 'input',
34
+ name: 'toDo',
35
+ message: `${green}To-do items (leave blank to skip section):${reset}`,
36
+ },
37
+ {
38
+ type: 'list',
39
+ name: 'license',
40
+ message: `${green}License:${reset}`,
41
+ choices: ['MIT', 'APACHE 2.0', 'GPL 3.0', 'BSD 3', 'None'],
42
+ },
43
+ {
44
+ type: 'input',
45
+ name: 'installation',
46
+ message: `${green}Install command:${reset}`,
47
+ default: detected.installCommand,
48
+ },
49
+ {
50
+ type: 'input',
51
+ name: 'test',
52
+ message: `${green}Test command:${reset}`,
53
+ default: detected.testCommand,
54
+ },
55
+ {
56
+ type: 'input',
57
+ name: 'usage',
58
+ message: `${green}Usage instructions:${reset}`,
59
+ },
60
+ {
61
+ type: 'input',
62
+ name: 'contributing',
63
+ message: `${green}Contributing guidelines:${reset}`,
64
+ default: 'Fork the project and open a pull request with your changes',
65
+ },
66
+ {
67
+ type: 'input',
68
+ name: 'github',
69
+ message: `${green}GitHub username:${reset}`,
70
+ default: detected.github,
71
+ },
72
+ {
73
+ type: 'input',
74
+ name: 'email',
75
+ message: `${green}Email address:${reset}`,
76
+ default: detected.email,
77
+ },
78
+ ]);
79
+ } catch (err) {
80
+ // Ctrl+C makes Inquirer throw ExitPromptError; without this it crashed
81
+ if (err?.name === 'ExitPromptError') {
82
+ console.log(`\n${purple}Cancelled. Nothing was written.${reset}\n`);
83
+ return false;
84
+ }
85
+ throw err;
86
+ }
80
87
 
81
88
  const markdown = generateMarkdown(answers);
82
89
  await writeFile(resolve(outputPath), markdown, 'utf8');