-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·35 lines (29 loc) · 875 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
import { marked } from 'marked';
import TerminalRenderer from 'marked-terminal';
import { program } from 'commander';
import getChangelog from './utils/getChangelog.js';
marked.setOptions({
// Define custom renderer
renderer: new TerminalRenderer(),
mangle: false,
headerIds: false
});
// CLI flags
program
.option('-t, --tag [ver]', 'Get changelog for the particular release')
.option('-l, --list', 'List available Node.js releases')
.parse(process.argv);
const options = program.opts();
if (options.tag) {
// Release with a specific tag
getChangelog(options.tag);
} else if (options.list) {
// List all available releases
import('./utils/getList.js').then((mod) => mod.default());
} else {
// Detect local Node version
const localVer = process.version.substring(1);
// Local Node.js version
getChangelog(localVer);
}