@aneuhold/core-ts-lib 2.2.9 → 2.2.11

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.
Files changed (89) hide show
  1. package/lib/index.d.ts +5 -3
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +3 -2
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.ts +5 -2
  6. package/lib/services/ChangelogService/ChangelogFileService.d.ts +42 -0
  7. package/lib/services/ChangelogService/ChangelogFileService.d.ts.map +1 -0
  8. package/lib/services/ChangelogService/ChangelogFileService.js +65 -0
  9. package/lib/services/ChangelogService/ChangelogFileService.js.map +1 -0
  10. package/lib/services/ChangelogService/ChangelogFileService.ts +68 -0
  11. package/lib/services/ChangelogService/ChangelogGenerator.d.ts +58 -0
  12. package/lib/services/ChangelogService/ChangelogGenerator.d.ts.map +1 -0
  13. package/lib/services/ChangelogService/ChangelogGenerator.js +145 -0
  14. package/lib/services/ChangelogService/ChangelogGenerator.js.map +1 -0
  15. package/lib/services/ChangelogService/ChangelogGenerator.ts +188 -0
  16. package/lib/services/ChangelogService/ChangelogParser.d.ts +21 -0
  17. package/lib/services/ChangelogService/ChangelogParser.d.ts.map +1 -0
  18. package/lib/services/ChangelogService/ChangelogParser.js +76 -0
  19. package/lib/services/ChangelogService/ChangelogParser.js.map +1 -0
  20. package/lib/services/ChangelogService/ChangelogParser.ts +94 -0
  21. package/lib/services/ChangelogService/ChangelogService.d.ts +54 -0
  22. package/lib/services/ChangelogService/ChangelogService.d.ts.map +1 -0
  23. package/lib/services/ChangelogService/ChangelogService.js +201 -0
  24. package/lib/services/ChangelogService/ChangelogService.js.map +1 -0
  25. package/lib/services/ChangelogService/ChangelogService.ts +293 -0
  26. package/lib/services/ChangelogService/ChangelogValidator.d.ts +15 -0
  27. package/lib/services/ChangelogService/ChangelogValidator.d.ts.map +1 -0
  28. package/lib/services/ChangelogService/ChangelogValidator.js +44 -0
  29. package/lib/services/ChangelogService/ChangelogValidator.js.map +1 -0
  30. package/lib/services/ChangelogService/ChangelogValidator.ts +55 -0
  31. package/lib/services/ChangelogService/GitTagService.d.ts +29 -0
  32. package/lib/services/ChangelogService/GitTagService.d.ts.map +1 -0
  33. package/lib/services/ChangelogService/GitTagService.js +57 -0
  34. package/lib/services/ChangelogService/GitTagService.js.map +1 -0
  35. package/lib/services/ChangelogService/GitTagService.ts +60 -0
  36. package/lib/services/ChangelogService/RepositoryInfoService.d.ts +14 -0
  37. package/lib/services/ChangelogService/RepositoryInfoService.d.ts.map +1 -0
  38. package/lib/services/ChangelogService/RepositoryInfoService.js +55 -0
  39. package/lib/services/ChangelogService/RepositoryInfoService.js.map +1 -0
  40. package/lib/services/ChangelogService/RepositoryInfoService.ts +64 -0
  41. package/lib/services/ChangelogService/index.d.ts +2 -0
  42. package/lib/services/ChangelogService/index.d.ts.map +1 -0
  43. package/lib/services/ChangelogService/index.js +2 -0
  44. package/lib/services/ChangelogService/index.js.map +1 -0
  45. package/lib/services/ChangelogService/index.ts +1 -0
  46. package/lib/services/ChangelogService/types.d.ts +27 -0
  47. package/lib/services/ChangelogService/types.d.ts.map +1 -0
  48. package/lib/services/ChangelogService/types.js +3 -0
  49. package/lib/services/ChangelogService/types.js.map +1 -0
  50. package/lib/services/ChangelogService/types.ts +30 -0
  51. package/lib/services/DependencyService.d.ts +2 -9
  52. package/lib/services/DependencyService.d.ts.map +1 -1
  53. package/lib/services/DependencyService.js +2 -11
  54. package/lib/services/DependencyService.js.map +1 -1
  55. package/lib/services/DependencyService.ts +2 -11
  56. package/lib/services/PackageService/JsrPackageService.d.ts +81 -0
  57. package/lib/services/PackageService/JsrPackageService.d.ts.map +1 -0
  58. package/lib/services/{PackageService.js → PackageService/JsrPackageService.js} +70 -312
  59. package/lib/services/PackageService/JsrPackageService.js.map +1 -0
  60. package/lib/services/{PackageService.ts → PackageService/JsrPackageService.ts} +79 -372
  61. package/lib/services/PackageService/NpmPackageService.d.ts +45 -0
  62. package/lib/services/PackageService/NpmPackageService.d.ts.map +1 -0
  63. package/lib/services/PackageService/NpmPackageService.js +146 -0
  64. package/lib/services/PackageService/NpmPackageService.js.map +1 -0
  65. package/lib/services/PackageService/NpmPackageService.ts +178 -0
  66. package/lib/services/PackageService/PackageService.d.ts +77 -0
  67. package/lib/services/PackageService/PackageService.d.ts.map +1 -0
  68. package/lib/services/PackageService/PackageService.js +96 -0
  69. package/lib/services/PackageService/PackageService.js.map +1 -0
  70. package/lib/services/PackageService/PackageService.ts +108 -0
  71. package/lib/services/PackageService/PackageServiceUtils.d.ts +69 -0
  72. package/lib/services/PackageService/PackageServiceUtils.d.ts.map +1 -0
  73. package/lib/services/PackageService/PackageServiceUtils.js +185 -0
  74. package/lib/services/PackageService/PackageServiceUtils.js.map +1 -0
  75. package/lib/services/PackageService/PackageServiceUtils.ts +239 -0
  76. package/lib/services/StringService.d.ts +12 -0
  77. package/lib/services/StringService.d.ts.map +1 -1
  78. package/lib/services/StringService.js +56 -0
  79. package/lib/services/StringService.js.map +1 -1
  80. package/lib/services/StringService.ts +72 -0
  81. package/lib/types/VersionType.d.ts +9 -0
  82. package/lib/types/VersionType.d.ts.map +1 -0
  83. package/lib/types/VersionType.js +10 -0
  84. package/lib/types/VersionType.js.map +1 -0
  85. package/lib/types/VersionType.ts +8 -0
  86. package/package.json +7 -6
  87. package/lib/services/PackageService.d.ts +0 -159
  88. package/lib/services/PackageService.d.ts.map +0 -1
  89. package/lib/services/PackageService.js.map +0 -1
package/lib/index.d.ts CHANGED
@@ -2,16 +2,18 @@ import sleep from './helperFunctions/sleep.js';
2
2
  import { ILogger } from './interfaces/ILogger.js';
3
3
  import { ISpan, ITracer } from './interfaces/ITracer.js';
4
4
  import ArrayService from './services/ArrayService.js';
5
+ import ChangelogService from './services/ChangelogService/index.js';
5
6
  import DateService from './services/DateService/DateService.js';
6
7
  import { DependencyRegistry, DR } from './services/DependencyRegistry.js';
7
- import DependencyService, { VersionType } from './services/DependencyService.js';
8
+ import DependencyService from './services/DependencyService.js';
8
9
  import FileSystemService, { type ReplaceInFilesOptions } from './services/FileSystemService/FileSystemService.js';
9
10
  import GlobMatchingService from './services/FileSystemService/GlobMatchingService.js';
10
- import PackageService from './services/PackageService.js';
11
+ import PackageService from './services/PackageService/PackageService.js';
11
12
  import StringService from './services/StringService.js';
12
13
  import { PackageJson } from './types/PackageJson.js';
14
+ import { VersionType } from './types/VersionType.js';
13
15
  import ErrorUtils from './utils/ErrorUtils.js';
14
16
  import TestUtils from './utils/TestUtils.js';
15
- export { ArrayService, DateService, DependencyRegistry, DependencyService, DR, ErrorUtils, FileSystemService, GlobMatchingService, PackageService, sleep, StringService, TestUtils };
17
+ export { ArrayService, ChangelogService, DateService, DependencyRegistry, DependencyService, DR, ErrorUtils, FileSystemService, GlobMatchingService, PackageService, sleep, StringService, TestUtils };
16
18
  export type { ILogger, ISpan, ITracer, PackageJson, ReplaceInFilesOptions, VersionType };
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,iBAAiB,EAAE,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,iBAAiB,EAAE,EACxB,KAAK,qBAAqB,EAC3B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,mBAAmB,MAAM,qDAAqD,CAAC;AACtF,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,aAAa,MAAM,6BAA6B,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O,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,EAAE,EACF,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,KAAK,EACL,aAAa,EACb,SAAS,EACV,CAAC;AAGF,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC"}
package/lib/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import sleep from './helperFunctions/sleep.js';
2
2
  import ArrayService from './services/ArrayService.js';
3
+ import ChangelogService from './services/ChangelogService/index.js';
3
4
  import DateService from './services/DateService/DateService.js';
4
5
  import { DependencyRegistry, DR } from './services/DependencyRegistry.js';
5
6
  import DependencyService from './services/DependencyService.js';
6
7
  import FileSystemService from './services/FileSystemService/FileSystemService.js';
7
8
  import GlobMatchingService from './services/FileSystemService/GlobMatchingService.js';
8
- import PackageService from './services/PackageService.js';
9
+ import PackageService from './services/PackageService/PackageService.js';
9
10
  import StringService from './services/StringService.js';
10
11
  import ErrorUtils from './utils/ErrorUtils.js';
11
12
  import TestUtils from './utils/TestUtils.js';
12
13
  // Export all the functions and classes from this library
13
- export { ArrayService, DateService, DependencyRegistry, DependencyService, DR, ErrorUtils, FileSystemService, GlobMatchingService, PackageService, sleep, StringService, TestUtils };
14
+ export { ArrayService, ChangelogService, DateService, DependencyRegistry, DependencyService, DR, ErrorUtils, FileSystemService, GlobMatchingService, PackageService, sleep, StringService, TestUtils };
14
15
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAG/C,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,MA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AAS,EACV,CAAC"}
package/lib/index.ts CHANGED
@@ -2,22 +2,25 @@ import sleep from './helperFunctions/sleep.js';
2
2
  import { ILogger } from './interfaces/ILogger.js';
3
3
  import { ISpan, ITracer } from './interfaces/ITracer.js';
4
4
  import ArrayService from './services/ArrayService.js';
5
+ import ChangelogService from './services/ChangelogService/index.js';
5
6
  import DateService from './services/DateService/DateService.js';
6
7
  import { DependencyRegistry, DR } from './services/DependencyRegistry.js';
7
- import DependencyService, { VersionType } from './services/DependencyService.js';
8
+ import DependencyService from './services/DependencyService.js';
8
9
  import FileSystemService, {
9
10
  type ReplaceInFilesOptions
10
11
  } from './services/FileSystemService/FileSystemService.js';
11
12
  import GlobMatchingService from './services/FileSystemService/GlobMatchingService.js';
12
- import PackageService from './services/PackageService.js';
13
+ import PackageService from './services/PackageService/PackageService.js';
13
14
  import StringService from './services/StringService.js';
14
15
  import { PackageJson } from './types/PackageJson.js';
16
+ import { VersionType } from './types/VersionType.js';
15
17
  import ErrorUtils from './utils/ErrorUtils.js';
16
18
  import TestUtils from './utils/TestUtils.js';
17
19
 
18
20
  // Export all the functions and classes from this library
19
21
  export {
20
22
  ArrayService,
23
+ ChangelogService,
21
24
  DateService,
22
25
  DependencyRegistry,
23
26
  DependencyService,
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Service for handling changelog file operations.
3
+ */
4
+ export default class ChangelogFileService {
5
+ /**
6
+ * Gets the changelog file path for a given directory.
7
+ *
8
+ * @param packagePath Optional path to the package directory
9
+ * @returns Full path to the changelog file
10
+ */
11
+ static getChangelogPath(packagePath?: string): string;
12
+ /**
13
+ * Checks if a changelog file exists.
14
+ *
15
+ * @param packagePath Optional path to the package directory
16
+ * @returns True if changelog exists, false otherwise
17
+ */
18
+ static changelogExists(packagePath?: string): Promise<boolean>;
19
+ /**
20
+ * Reads the changelog file content.
21
+ *
22
+ * @param packagePath Optional path to the package directory
23
+ * @returns Changelog content as string
24
+ * @throws Error if file doesn't exist or can't be read
25
+ */
26
+ static readChangelog(packagePath?: string): Promise<string>;
27
+ /**
28
+ * Writes content to the changelog file.
29
+ *
30
+ * @param content The content to write
31
+ * @param packagePath Optional path to the package directory
32
+ */
33
+ static writeChangelog(content: string, packagePath?: string): Promise<void>;
34
+ /**
35
+ * Creates a new changelog file with the given content.
36
+ *
37
+ * @param content The initial content
38
+ * @param packagePath Optional path to the package directory
39
+ */
40
+ static createChangelog(content: string, packagePath?: string): Promise<void>;
41
+ }
42
+ //# sourceMappingURL=ChangelogFileService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangelogFileService.d.ts","sourceRoot":"","sources":["../../../src/services/ChangelogService/ChangelogFileService.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;IAKrD;;;;;OAKG;WACU,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUpE;;;;;;OAMG;WACU,aAAa,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKjE;;;;;OAKG;WACU,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjF;;;;;OAKG;WACU,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnF"}
@@ -0,0 +1,65 @@
1
+ import { access, readFile, writeFile } from 'fs/promises';
2
+ import path from 'path';
3
+ import { CHANGELOG_FILENAME } from './types.js';
4
+ /**
5
+ * Service for handling changelog file operations.
6
+ */
7
+ export default class ChangelogFileService {
8
+ /**
9
+ * Gets the changelog file path for a given directory.
10
+ *
11
+ * @param packagePath Optional path to the package directory
12
+ * @returns Full path to the changelog file
13
+ */
14
+ static getChangelogPath(packagePath) {
15
+ const workingDir = packagePath || process.cwd();
16
+ return path.join(workingDir, CHANGELOG_FILENAME);
17
+ }
18
+ /**
19
+ * Checks if a changelog file exists.
20
+ *
21
+ * @param packagePath Optional path to the package directory
22
+ * @returns True if changelog exists, false otherwise
23
+ */
24
+ static async changelogExists(packagePath) {
25
+ const changelogPath = this.getChangelogPath(packagePath);
26
+ try {
27
+ await access(changelogPath);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
34
+ /**
35
+ * Reads the changelog file content.
36
+ *
37
+ * @param packagePath Optional path to the package directory
38
+ * @returns Changelog content as string
39
+ * @throws Error if file doesn't exist or can't be read
40
+ */
41
+ static async readChangelog(packagePath) {
42
+ const changelogPath = this.getChangelogPath(packagePath);
43
+ return await readFile(changelogPath, 'utf-8');
44
+ }
45
+ /**
46
+ * Writes content to the changelog file.
47
+ *
48
+ * @param content The content to write
49
+ * @param packagePath Optional path to the package directory
50
+ */
51
+ static async writeChangelog(content, packagePath) {
52
+ const changelogPath = this.getChangelogPath(packagePath);
53
+ await writeFile(changelogPath, content);
54
+ }
55
+ /**
56
+ * Creates a new changelog file with the given content.
57
+ *
58
+ * @param content The initial content
59
+ * @param packagePath Optional path to the package directory
60
+ */
61
+ static async createChangelog(content, packagePath) {
62
+ await this.writeChangelog(content, packagePath);
63
+ }
64
+ }
65
+ //# sourceMappingURL=ChangelogFileService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangelogFileService.js","sourceRoot":"","sources":["../../../src/services/ChangelogService/ChangelogFileService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAoB;QAC1C,MAAM,UAAU,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,WAAoB;QAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,WAAoB;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACzD,OAAO,MAAM,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,WAAoB;QAC/D,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,WAAoB;QAChE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -0,0 +1,68 @@
1
+ import { access, readFile, writeFile } from 'fs/promises';
2
+ import path from 'path';
3
+ import { CHANGELOG_FILENAME } from './types.js';
4
+
5
+ /**
6
+ * Service for handling changelog file operations.
7
+ */
8
+ export default class ChangelogFileService {
9
+ /**
10
+ * Gets the changelog file path for a given directory.
11
+ *
12
+ * @param packagePath Optional path to the package directory
13
+ * @returns Full path to the changelog file
14
+ */
15
+ static getChangelogPath(packagePath?: string): string {
16
+ const workingDir = packagePath || process.cwd();
17
+ return path.join(workingDir, CHANGELOG_FILENAME);
18
+ }
19
+
20
+ /**
21
+ * Checks if a changelog file exists.
22
+ *
23
+ * @param packagePath Optional path to the package directory
24
+ * @returns True if changelog exists, false otherwise
25
+ */
26
+ static async changelogExists(packagePath?: string): Promise<boolean> {
27
+ const changelogPath = this.getChangelogPath(packagePath);
28
+ try {
29
+ await access(changelogPath);
30
+ return true;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Reads the changelog file content.
38
+ *
39
+ * @param packagePath Optional path to the package directory
40
+ * @returns Changelog content as string
41
+ * @throws Error if file doesn't exist or can't be read
42
+ */
43
+ static async readChangelog(packagePath?: string): Promise<string> {
44
+ const changelogPath = this.getChangelogPath(packagePath);
45
+ return await readFile(changelogPath, 'utf-8');
46
+ }
47
+
48
+ /**
49
+ * Writes content to the changelog file.
50
+ *
51
+ * @param content The content to write
52
+ * @param packagePath Optional path to the package directory
53
+ */
54
+ static async writeChangelog(content: string, packagePath?: string): Promise<void> {
55
+ const changelogPath = this.getChangelogPath(packagePath);
56
+ await writeFile(changelogPath, content);
57
+ }
58
+
59
+ /**
60
+ * Creates a new changelog file with the given content.
61
+ *
62
+ * @param content The initial content
63
+ * @param packagePath Optional path to the package directory
64
+ */
65
+ static async createChangelog(content: string, packagePath?: string): Promise<void> {
66
+ await this.writeChangelog(content, packagePath);
67
+ }
68
+ }
@@ -0,0 +1,58 @@
1
+ import type { ChangelogVersionEntry, RepositoryInfo } from './types.js';
2
+ /**
3
+ * Service for generating changelog content and version links.
4
+ */
5
+ export default class ChangelogGenerator {
6
+ /**
7
+ * Creates the content for a version entry.
8
+ *
9
+ * @param version The version number
10
+ * @param date The date in YYYY-MM-DD format
11
+ * @returns The version entry content
12
+ */
13
+ static createVersionEntryContent(version: string, date: string): string;
14
+ /**
15
+ * Creates the initial changelog content with header and first version entry.
16
+ *
17
+ * @param version The initial version
18
+ * @param packageName The package name for generating version links
19
+ * @param repositoryInfo Optional repository information for version links
20
+ * @returns The complete changelog content
21
+ */
22
+ static createInitialChangelogContent(version: string, packageName: string, repositoryInfo?: RepositoryInfo | null): string;
23
+ /**
24
+ * Generates a GitHub compare URL for version links in monorepo changelog
25
+ *
26
+ * @param repositoryInfo Repository information
27
+ * @param packageName Name of the package (used for tag prefix)
28
+ * @param currentVersion Current version
29
+ * @param previousVersion Previous version (optional)
30
+ * @returns The version link URL
31
+ */
32
+ static generateVersionLink(repositoryInfo: RepositoryInfo, packageName: string, currentVersion: string, previousVersion?: string): string;
33
+ /**
34
+ * Updates changelog content to include version links at the bottom
35
+ *
36
+ * @param content Original changelog content
37
+ * @param repositoryInfo Repository information
38
+ * @param packageName Package name for generating tags
39
+ * @returns Updated changelog content with version links
40
+ */
41
+ static addVersionLinksToChangelog(content: string, repositoryInfo: RepositoryInfo, packageName: string): string;
42
+ /**
43
+ * Regenerates changelog content from a list of version entries.
44
+ *
45
+ * @param versionEntries The version entries to include
46
+ * @param packageName The package name for generating version links
47
+ * @param repositoryInfo Optional repository information for version links
48
+ * @returns The regenerated changelog content
49
+ */
50
+ static regenerateChangelogContent(versionEntries: ChangelogVersionEntry[], packageName: string, repositoryInfo?: RepositoryInfo | null): string;
51
+ /**
52
+ * Gets current date in YYYY-MM-DD format.
53
+ *
54
+ * @returns Current date string
55
+ */
56
+ static getCurrentDate(): string;
57
+ }
58
+ //# sourceMappingURL=ChangelogGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangelogGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/ChangelogService/ChangelogGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAYvE;;;;;;;OAOG;IACH,MAAM,CAAC,6BAA6B,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,GACrC,MAAM;IAqBT;;;;;;;;OAQG;IACH,MAAM,CAAC,mBAAmB,CACxB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM;IAYT;;;;;;;OAOG;IACH,MAAM,CAAC,0BAA0B,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,MAAM,GAClB,MAAM;IAsCT;;;;;;;OAOG;IACH,MAAM,CAAC,0BAA0B,CAC/B,cAAc,EAAE,qBAAqB,EAAE,EACvC,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,GACrC,MAAM;IA+BT;;;;OAIG;IACH,MAAM,CAAC,cAAc,IAAI,MAAM;CAGhC"}
@@ -0,0 +1,145 @@
1
+ import ChangelogParser from './ChangelogParser.js';
2
+ import GitTagService from './GitTagService.js';
3
+ /**
4
+ * Service for generating changelog content and version links.
5
+ */
6
+ export default class ChangelogGenerator {
7
+ /**
8
+ * Creates the content for a version entry.
9
+ *
10
+ * @param version The version number
11
+ * @param date The date in YYYY-MM-DD format
12
+ * @returns The version entry content
13
+ */
14
+ static createVersionEntryContent(version, date) {
15
+ return `## 🔖 [${version}] (${date})
16
+
17
+ ### ✅ Added
18
+
19
+ ### 🏗️ Changed
20
+
21
+ ### 🩹 Fixed
22
+
23
+ ### 🔥 Removed`;
24
+ }
25
+ /**
26
+ * Creates the initial changelog content with header and first version entry.
27
+ *
28
+ * @param version The initial version
29
+ * @param packageName The package name for generating version links
30
+ * @param repositoryInfo Optional repository information for version links
31
+ * @returns The complete changelog content
32
+ */
33
+ static createInitialChangelogContent(version, packageName, repositoryInfo) {
34
+ const currentDate = new Date().toISOString().split('T')[0]; // YYYY-MM-DD format
35
+ let content = `# Changelog
36
+
37
+ All notable changes to this project will be documented in this file.
38
+
39
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
40
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
41
+
42
+ ${this.createVersionEntryContent(version, currentDate)}
43
+ `;
44
+ // Add version links if repository info is available
45
+ if (repositoryInfo) {
46
+ content = this.addVersionLinksToChangelog(content, repositoryInfo, packageName);
47
+ }
48
+ return content;
49
+ }
50
+ /**
51
+ * Generates a GitHub compare URL for version links in monorepo changelog
52
+ *
53
+ * @param repositoryInfo Repository information
54
+ * @param packageName Name of the package (used for tag prefix)
55
+ * @param currentVersion Current version
56
+ * @param previousVersion Previous version (optional)
57
+ * @returns The version link URL
58
+ */
59
+ static generateVersionLink(repositoryInfo, packageName, currentVersion, previousVersion) {
60
+ const currentTag = GitTagService.getTagName(packageName, currentVersion);
61
+ if (!previousVersion) {
62
+ // For first version, link to the tag itself
63
+ return `${repositoryInfo.url}/releases/tag/${currentTag}`;
64
+ }
65
+ const previousTag = GitTagService.getTagName(packageName, previousVersion);
66
+ return `${repositoryInfo.url}/compare/${previousTag}...${currentTag}`;
67
+ }
68
+ /**
69
+ * Updates changelog content to include version links at the bottom
70
+ *
71
+ * @param content Original changelog content
72
+ * @param repositoryInfo Repository information
73
+ * @param packageName Package name for generating tags
74
+ * @returns Updated changelog content with version links
75
+ */
76
+ static addVersionLinksToChangelog(content, repositoryInfo, packageName) {
77
+ const versionEntries = ChangelogParser.parseChangelog(content);
78
+ if (versionEntries.length === 0) {
79
+ return content;
80
+ }
81
+ // Generate link references
82
+ const linkReferences = [];
83
+ for (let i = 0; i < versionEntries.length; i++) {
84
+ const currentEntry = versionEntries[i];
85
+ const previousEntry = i + 1 < versionEntries.length ? versionEntries[i + 1] : undefined;
86
+ const versionLink = this.generateVersionLink(repositoryInfo, packageName, currentEntry.version, previousEntry?.version);
87
+ linkReferences.push(`[${currentEntry.version}]: ${versionLink}`);
88
+ }
89
+ // Check if content already has link references section
90
+ const linkSectionMatch = content.match(/\n\n<!-- Link References -->\n([\s\S]*?)$/);
91
+ if (linkSectionMatch) {
92
+ // Replace existing link references
93
+ const newLinkSection = `\n\n<!-- Link References -->\n${linkReferences.join('\n')}\n`;
94
+ return content.replace(linkSectionMatch[0], newLinkSection);
95
+ }
96
+ else {
97
+ // Add new link references section
98
+ const newLinkSection = `\n\n<!-- Link References -->\n${linkReferences.join('\n')}\n`;
99
+ return content + newLinkSection;
100
+ }
101
+ }
102
+ /**
103
+ * Regenerates changelog content from a list of version entries.
104
+ *
105
+ * @param versionEntries The version entries to include
106
+ * @param packageName The package name for generating version links
107
+ * @param repositoryInfo Optional repository information for version links
108
+ * @returns The regenerated changelog content
109
+ */
110
+ static regenerateChangelogContent(versionEntries, packageName, repositoryInfo) {
111
+ // Start with the header
112
+ let content = `# Changelog
113
+
114
+ All notable changes to this project will be documented in this file.
115
+
116
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
117
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
118
+
119
+ `;
120
+ // Add each version entry
121
+ for (const entry of versionEntries) {
122
+ content += `## 🔖 [${entry.version}] (${entry.date})\n\n`;
123
+ for (const section of entry.sections) {
124
+ content += `### ${section.type}\n\n`;
125
+ if (section.content.trim()) {
126
+ content += `${section.content}\n\n`;
127
+ }
128
+ }
129
+ }
130
+ // Add version links if repository info is available
131
+ if (repositoryInfo) {
132
+ content = this.addVersionLinksToChangelog(content, repositoryInfo, packageName);
133
+ }
134
+ return content;
135
+ }
136
+ /**
137
+ * Gets current date in YYYY-MM-DD format.
138
+ *
139
+ * @returns Current date string
140
+ */
141
+ static getCurrentDate() {
142
+ return new Date().toISOString().split('T')[0];
143
+ }
144
+ }
145
+ //# sourceMappingURL=ChangelogGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangelogGenerator.js","sourceRoot":"","sources":["../../../src/services/ChangelogService/ChangelogGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAG/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,yBAAyB,CAAC,OAAe,EAAE,IAAY;QAC5D,OAAO,UAAU,OAAO,MAAM,IAAI;;;;;;;;eAQvB,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,6BAA6B,CAClC,OAAe,EACf,WAAmB,EACnB,cAAsC;QAEtC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;QAEhF,IAAI,OAAO,GAAG;;;;;;;EAOhB,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,WAAW,CAAC;CACrD,CAAC;QAEE,oDAAoD;QACpD,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAClF,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,mBAAmB,CACxB,cAA8B,EAC9B,WAAmB,EACnB,cAAsB,EACtB,eAAwB;QAExB,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAEzE,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,4CAA4C;YAC5C,OAAO,GAAG,cAAc,CAAC,GAAG,iBAAiB,UAAU,EAAE,CAAC;QAC5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