@intecoag/inteco-cli 1.1.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intecoag/inteco-cli",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "CLI-Tools for Inteco",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
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'}
@@ -89,6 +90,9 @@ switch (cli.input[0]) {
89
90
  case "bundle_product":
90
91
  bundleProduct(cli);
91
92
  break;
93
+ case "changelog":
94
+ showChangelog();
95
+ break;
92
96
  default:
93
97
  cli.showHelp()
94
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;
@@ -43,5 +43,8 @@
43
43
  },
44
44
  "graphql_schema_export": {
45
45
  "desc": "Dump the Graph-QL-Schema from an Endpoint"
46
+ },
47
+ "changelog": {
48
+ "desc": "Shows the changelog history"
46
49
  }
47
50
  }