@intecoag/inteco-cli 1.1.1 ā 1.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.
- package/package.json +1 -1
- package/src/index.js +6 -1
- package/src/modules/changelog.js +60 -0
- package/src/ressources/cmds.json +3 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import graphqlSchemaExport from './modules/graphqlSchemaExport.js';
|
|
|
12
12
|
import csvMerge from './modules/csvMerger.js';
|
|
13
13
|
import {dumpDBMand, dumpDB } from './modules/dumpDB.js';
|
|
14
14
|
import deleteDBMand from './modules/deleteDB.js';
|
|
15
|
+
import showChangelog from './modules/changelog.js';
|
|
15
16
|
|
|
16
17
|
import commands from "./ressources/cmds.json" with {type: 'json'};
|
|
17
18
|
import packageJson from "../package.json" with {type: 'json'}
|
|
@@ -26,7 +27,8 @@ updateNotifier({
|
|
|
26
27
|
name: packageJson.name,
|
|
27
28
|
version: packageJson.version
|
|
28
29
|
},
|
|
29
|
-
updateCheckInterval:
|
|
30
|
+
updateCheckInterval: 1000 * 60 * 60 * 24 // 24h
|
|
31
|
+
}).notify();
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
const helpText = cliMeowHelp({
|
|
@@ -88,6 +90,9 @@ switch (cli.input[0]) {
|
|
|
88
90
|
case "bundle_product":
|
|
89
91
|
bundleProduct(cli);
|
|
90
92
|
break;
|
|
93
|
+
case "changelog":
|
|
94
|
+
showChangelog();
|
|
95
|
+
break;
|
|
91
96
|
default:
|
|
92
97
|
cli.showHelp()
|
|
93
98
|
break;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
|
|
3
|
+
const OWNER = 'intecoag';
|
|
4
|
+
const REPO = 'IntecoCLI';
|
|
5
|
+
|
|
6
|
+
async function showChangelog() {
|
|
7
|
+
const res = await fetch(
|
|
8
|
+
`https://api.github.com/repos/${OWNER}/${REPO}/releases`,
|
|
9
|
+
{
|
|
10
|
+
headers: {
|
|
11
|
+
'Accept': 'application/vnd.github+json',
|
|
12
|
+
'User-Agent': `${REPO}-cli`
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (!res.ok) {
|
|
18
|
+
console.error(chalk.red('Failed to fetch changelog'));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const releases = await res.json();
|
|
23
|
+
|
|
24
|
+
// Reverse: oldest ā newest
|
|
25
|
+
releases.reverse();
|
|
26
|
+
|
|
27
|
+
console.log(
|
|
28
|
+
chalk.bold.cyan(`\nš¦ Changelog for ${OWNER}/${REPO}\n`)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
for (const r of releases) {
|
|
32
|
+
const title = r.name || r.tag_name;
|
|
33
|
+
|
|
34
|
+
console.log(
|
|
35
|
+
chalk.bold.yellow(`\nā¶ ${title}`)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!r.body) {
|
|
39
|
+
console.log(chalk.gray(' No changelog provided'));
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Light formatting for Markdown-like content
|
|
44
|
+
const lines = r.body.split('\n');
|
|
45
|
+
|
|
46
|
+
for (const line of lines) {
|
|
47
|
+
if (line.startsWith('- ') || line.startsWith('* ')) {
|
|
48
|
+
console.log(chalk.green(` ⢠${line.slice(2)}`));
|
|
49
|
+
} else if (line.startsWith('### ')) {
|
|
50
|
+
console.log(chalk.bold.magenta(`\n ${line.slice(4)}`));
|
|
51
|
+
} else if (line.startsWith('## ')) {
|
|
52
|
+
console.log(chalk.bold.blue(`\n${line.slice(3)}`));
|
|
53
|
+
} else {
|
|
54
|
+
console.log(chalk.gray(` ${line}`));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default showChangelog;
|