Skip to content

Commit 9f7148e

Browse files
committed
chore: code review changes
1 parent 3a70577 commit 9f7148e

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

.github/workflows/generate.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ jobs:
7979
-t ${{ matrix.target }} \
8080
-i "${{ matrix.input }}" \
8181
-o "out/${{ matrix.target }}" \
82-
--index ./node/doc/api/index.md
82+
-c ./node/CHANGELOG.md \
83+
--index ./node/doc/api/index.md \
84+
--log-level debug
8385
8486
- name: Upload ${{ matrix.target }} artifacts
8587
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0

bin/cli.mjs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,17 @@ import { Command, Option } from 'commander';
66

77
import commands from './commands/index.mjs';
88
import { errorWrap } from './utils.mjs';
9-
import logger from '../src/logger/index.mjs';
9+
import logger, { LogLevel } from '../src/logger/index.mjs';
10+
11+
const logLevelOption = new Option('--log-level <level>', 'Log level')
12+
.choices(Object.keys(LogLevel))
13+
.default('info');
1014

1115
const program = new Command()
1216
.name('@nodejs/doc-kit')
13-
.description('CLI tool to generate the Node.js API documentation');
14-
15-
// Add global log level option
16-
program.addOption(
17-
new Option('--log-level <level>', 'Log level')
18-
.choices(['debug', 'info', 'warn', 'error', 'fatal'])
19-
.default('info')
20-
);
21-
22-
// Set log level before any command runs
23-
program.hook('preAction', thisCommand => {
24-
const { logLevel } = thisCommand.opts();
25-
26-
logger.setLogLevel(logLevel);
27-
});
17+
.description('CLI tool to generate the Node.js API documentation')
18+
.addOption(logLevelOption)
19+
.hook('preAction', cmd => logger.setLogLevel(cmd.opts().logLevel));
2820

2921
// Registering commands
3022
commands.forEach(({ name, description, options, action }) => {

0 commit comments

Comments
 (0)