@daiyam/artifact-npm 0.8.14 → 0.8.15

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.
@@ -1,8 +1,13 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ /* eslint-disable no-console */
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const EXIT_SUCCESS = 0;
7
+ const EXIT_FAILURE = 1;
3
8
 
4
9
  // Get version from command line argument (with 'v' prefix)
5
- const version = process.argv[2];
10
+ const [,, version] = process.argv;
6
11
 
7
12
  try {
8
13
  const changelog = fs.readFileSync(path.join(process.cwd(), 'CHANGELOG.md'), 'utf8');
@@ -14,17 +19,20 @@ try {
14
19
  const match = changelog.match(versionRegex);
15
20
 
16
21
  if(match) {
22
+ const [header] = match;
23
+
17
24
  // Remove the version header and trim whitespace
18
- const notes = match[0].replace(/^## v\d+\.\d+\.\d+ \| \d{4}-\d{2}-\d{2}\n/, '').trim();
25
+ const notes = header.replace(/^## v\d+\.\d+\.\d+ \| \d{4}-\d{2}-\d{2}\n/, '').trim();
26
+
19
27
  console.log(notes);
20
- process.exit(0);
28
+ process.exit(EXIT_SUCCESS);
21
29
  }
22
30
  else {
23
31
  console.error(`No changelog entry found for version ${version}`);
24
- process.exit(1);
32
+ process.exit(EXIT_FAILURE);
25
33
  }
26
34
  }
27
35
  catch(error) {
28
36
  console.error('Error reading CHANGELOG.md:', error);
29
- process.exit(1);
37
+ process.exit(EXIT_FAILURE);
30
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daiyam/artifact-npm",
3
- "version": "0.8.14",
3
+ "version": "0.8.15",
4
4
  "description": "The configuration to create node modules and publish them on npm.",
5
5
  "author": {
6
6
  "name": "Baptiste Augrain",
@@ -31,5 +31,5 @@
31
31
  "project-template",
32
32
  "scaffold"
33
33
  ],
34
- "gitHead": "9ee29fc847758072bd4880ff4f5ce00f8daa6b19"
34
+ "gitHead": "fb1b7074a84dc6a7463644eba968e11b17ae91af"
35
35
  }