@tmlmobilidade/repo-version 20251006.1135.22 → 20251006.1702.1
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/dist/index.js +9 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,16 +14,18 @@ import fs from 'node:fs';
|
|
|
14
14
|
const suffix = suffixArg ? suffixArg.split('=')[1] : '';
|
|
15
15
|
const formatArg = args.find(arg => arg.startsWith('--format='));
|
|
16
16
|
const format = formatArg ? formatArg.split('=')[1] : '';
|
|
17
|
+
const limitArg = args.find(arg => arg.startsWith('--limit='));
|
|
18
|
+
const limit = limitArg ? limitArg.split('=')[1] : '';
|
|
17
19
|
const outputArg = args.find(arg => arg.startsWith('--output='));
|
|
18
20
|
const output = outputArg ? outputArg.split('=')[1] : '';
|
|
19
21
|
//
|
|
20
22
|
// Generate the new version based on the current date and time
|
|
21
23
|
const dateValue = Dates.now('Europe/Lisbon');
|
|
24
|
+
let futurePackageVersion = '';
|
|
22
25
|
//
|
|
23
26
|
// Format the version string.
|
|
24
27
|
// For "default" format: [prefix]YYYYMMDD.HHMM.SS
|
|
25
28
|
// For "code" format: YYYYMMDDHHMMSS (as a single number, no prefix)
|
|
26
|
-
let futurePackageVersion = '';
|
|
27
29
|
if (!format || format === 'default') {
|
|
28
30
|
futurePackageVersion = `${prefix}${dateValue.toFormat('yyyyMMdd.HHmm.ss')}${suffix}`;
|
|
29
31
|
}
|
|
@@ -31,6 +33,12 @@ import fs from 'node:fs';
|
|
|
31
33
|
futurePackageVersion = String(Number(dateValue.toFormat('yyyyMMddHHmmss')));
|
|
32
34
|
}
|
|
33
35
|
//
|
|
36
|
+
// Check if the version exceeds the limit, if provided.
|
|
37
|
+
// Cut the version string if it exceeds the limit.
|
|
38
|
+
if (limit && Number(limit) > 0) {
|
|
39
|
+
futurePackageVersion = futurePackageVersion.slice(0, Number(limit));
|
|
40
|
+
}
|
|
41
|
+
//
|
|
34
42
|
// If the ouput is set to "console",
|
|
35
43
|
// just print the version to the console and exit.
|
|
36
44
|
if (output === 'console') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/repo-version",
|
|
3
3
|
"description": "A CLI tool to bump the version of a NodeJS package.",
|
|
4
|
-
"version": "20251006.
|
|
4
|
+
"version": "20251006.1702.01",
|
|
5
5
|
"author": "João de Vasconcelos & Jusi Monteiro",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"type": "module",
|