@aneuhold/core-ts-lib 2.2.9 → 2.2.10
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/lib/index.d.ts +5 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/index.ts +5 -2
- package/lib/services/ChangelogService/ChangelogFileService.d.ts +42 -0
- package/lib/services/ChangelogService/ChangelogFileService.d.ts.map +1 -0
- package/lib/services/ChangelogService/ChangelogFileService.js +65 -0
- package/lib/services/ChangelogService/ChangelogFileService.js.map +1 -0
- package/lib/services/ChangelogService/ChangelogFileService.ts +68 -0
- package/lib/services/ChangelogService/ChangelogGenerator.d.ts +58 -0
- package/lib/services/ChangelogService/ChangelogGenerator.d.ts.map +1 -0
- package/lib/services/ChangelogService/ChangelogGenerator.js +145 -0
- package/lib/services/ChangelogService/ChangelogGenerator.js.map +1 -0
- package/lib/services/ChangelogService/ChangelogGenerator.ts +188 -0
- package/lib/services/ChangelogService/ChangelogParser.d.ts +21 -0
- package/lib/services/ChangelogService/ChangelogParser.d.ts.map +1 -0
- package/lib/services/ChangelogService/ChangelogParser.js +59 -0
- package/lib/services/ChangelogService/ChangelogParser.js.map +1 -0
- package/lib/services/ChangelogService/ChangelogParser.ts +71 -0
- package/lib/services/ChangelogService/ChangelogService.d.ts +54 -0
- package/lib/services/ChangelogService/ChangelogService.d.ts.map +1 -0
- package/lib/services/ChangelogService/ChangelogService.js +201 -0
- package/lib/services/ChangelogService/ChangelogService.js.map +1 -0
- package/lib/services/ChangelogService/ChangelogService.ts +293 -0
- package/lib/services/ChangelogService/ChangelogValidator.d.ts +15 -0
- package/lib/services/ChangelogService/ChangelogValidator.d.ts.map +1 -0
- package/lib/services/ChangelogService/ChangelogValidator.js +44 -0
- package/lib/services/ChangelogService/ChangelogValidator.js.map +1 -0
- package/lib/services/ChangelogService/ChangelogValidator.ts +55 -0
- package/lib/services/ChangelogService/GitTagService.d.ts +29 -0
- package/lib/services/ChangelogService/GitTagService.d.ts.map +1 -0
- package/lib/services/ChangelogService/GitTagService.js +57 -0
- package/lib/services/ChangelogService/GitTagService.js.map +1 -0
- package/lib/services/ChangelogService/GitTagService.ts +60 -0
- package/lib/services/ChangelogService/RepositoryInfoService.d.ts +14 -0
- package/lib/services/ChangelogService/RepositoryInfoService.d.ts.map +1 -0
- package/lib/services/ChangelogService/RepositoryInfoService.js +55 -0
- package/lib/services/ChangelogService/RepositoryInfoService.js.map +1 -0
- package/lib/services/ChangelogService/RepositoryInfoService.ts +64 -0
- package/lib/services/ChangelogService/index.d.ts +2 -0
- package/lib/services/ChangelogService/index.d.ts.map +1 -0
- package/lib/services/ChangelogService/index.js +2 -0
- package/lib/services/ChangelogService/index.js.map +1 -0
- package/lib/services/ChangelogService/index.ts +1 -0
- package/lib/services/ChangelogService/types.d.ts +27 -0
- package/lib/services/ChangelogService/types.d.ts.map +1 -0
- package/lib/services/ChangelogService/types.js +3 -0
- package/lib/services/ChangelogService/types.js.map +1 -0
- package/lib/services/ChangelogService/types.ts +30 -0
- package/lib/services/DependencyService.d.ts +2 -9
- package/lib/services/DependencyService.d.ts.map +1 -1
- package/lib/services/DependencyService.js +2 -11
- package/lib/services/DependencyService.js.map +1 -1
- package/lib/services/DependencyService.ts +2 -11
- package/lib/services/PackageService/JsrPackageService.d.ts +81 -0
- package/lib/services/PackageService/JsrPackageService.d.ts.map +1 -0
- package/lib/services/{PackageService.js → PackageService/JsrPackageService.js} +70 -312
- package/lib/services/PackageService/JsrPackageService.js.map +1 -0
- package/lib/services/{PackageService.ts → PackageService/JsrPackageService.ts} +79 -372
- package/lib/services/PackageService/NpmPackageService.d.ts +45 -0
- package/lib/services/PackageService/NpmPackageService.d.ts.map +1 -0
- package/lib/services/PackageService/NpmPackageService.js +146 -0
- package/lib/services/PackageService/NpmPackageService.js.map +1 -0
- package/lib/services/PackageService/NpmPackageService.ts +178 -0
- package/lib/services/PackageService/PackageService.d.ts +77 -0
- package/lib/services/PackageService/PackageService.d.ts.map +1 -0
- package/lib/services/PackageService/PackageService.js +96 -0
- package/lib/services/PackageService/PackageService.js.map +1 -0
- package/lib/services/PackageService/PackageService.ts +108 -0
- package/lib/services/PackageService/PackageServiceUtils.d.ts +69 -0
- package/lib/services/PackageService/PackageServiceUtils.d.ts.map +1 -0
- package/lib/services/PackageService/PackageServiceUtils.js +185 -0
- package/lib/services/PackageService/PackageServiceUtils.js.map +1 -0
- package/lib/services/PackageService/PackageServiceUtils.ts +239 -0
- package/lib/services/StringService.d.ts +12 -0
- package/lib/services/StringService.d.ts.map +1 -1
- package/lib/services/StringService.js +56 -0
- package/lib/services/StringService.js.map +1 -1
- package/lib/services/StringService.ts +72 -0
- package/lib/types/VersionType.d.ts +9 -0
- package/lib/types/VersionType.d.ts.map +1 -0
- package/lib/types/VersionType.js +10 -0
- package/lib/types/VersionType.js.map +1 -0
- package/lib/types/VersionType.ts +8 -0
- package/package.json +6 -5
- package/lib/services/PackageService.d.ts +0 -159
- package/lib/services/PackageService.d.ts.map +0 -1
- package/lib/services/PackageService.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { RepositoryInfo } from './types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Service for extracting repository information from package.json files.
|
|
7
|
+
*/
|
|
8
|
+
export default class RepositoryInfoService {
|
|
9
|
+
/**
|
|
10
|
+
* Extracts repository information from package.json
|
|
11
|
+
*
|
|
12
|
+
* @param packagePath Path to the package directory
|
|
13
|
+
* @returns Repository information or null if not found/invalid
|
|
14
|
+
*/
|
|
15
|
+
static async getRepositoryInfo(packagePath?: string): Promise<RepositoryInfo | null> {
|
|
16
|
+
const workingDir = packagePath || process.cwd();
|
|
17
|
+
const packageJsonPath = path.join(workingDir, 'package.json');
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const packageJsonContent = await readFile(packageJsonPath, 'utf-8');
|
|
21
|
+
const packageJson = JSON.parse(packageJsonContent) as unknown;
|
|
22
|
+
|
|
23
|
+
// Type guard to check if packageJson has the expected structure
|
|
24
|
+
if (
|
|
25
|
+
typeof packageJson !== 'object' ||
|
|
26
|
+
packageJson === null ||
|
|
27
|
+
!('repository' in packageJson) ||
|
|
28
|
+
typeof packageJson.repository !== 'object' ||
|
|
29
|
+
packageJson.repository === null ||
|
|
30
|
+
!('url' in packageJson.repository) ||
|
|
31
|
+
typeof packageJson.repository.url !== 'string'
|
|
32
|
+
) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const url = packageJson.repository.url;
|
|
37
|
+
|
|
38
|
+
// Handle different URL formats
|
|
39
|
+
let gitUrl = url;
|
|
40
|
+
if (gitUrl.startsWith('git+')) {
|
|
41
|
+
gitUrl = gitUrl.substring(4);
|
|
42
|
+
}
|
|
43
|
+
if (gitUrl.endsWith('.git')) {
|
|
44
|
+
gitUrl = gitUrl.substring(0, gitUrl.length - 4);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Extract owner and repo from GitHub URL
|
|
48
|
+
const match = gitUrl.match(/github\.com[/:]([\w-]+)\/([\w-]+)/);
|
|
49
|
+
if (!match) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const [, owner, repo] = match;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
owner,
|
|
57
|
+
repo,
|
|
58
|
+
url: `https://github.com/${owner}/${repo}`
|
|
59
|
+
};
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/ChangelogService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/ChangelogService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ChangelogService.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CHANGELOG_FILENAME = "CHANGELOG.md";
|
|
2
|
+
export declare const REQUIRED_SECTION_TYPES: readonly ["✅ Added", "🏗️ Changed", "🩹 Fixed", "🔥 Removed"];
|
|
3
|
+
export type ChangelogSectionType = (typeof REQUIRED_SECTION_TYPES)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Repository information for generating version links.
|
|
6
|
+
*/
|
|
7
|
+
export interface RepositoryInfo {
|
|
8
|
+
owner: string;
|
|
9
|
+
repo: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents a section within a changelog version entry.
|
|
14
|
+
*/
|
|
15
|
+
export interface ChangelogSection {
|
|
16
|
+
type: ChangelogSectionType;
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents a version entry in a changelog.
|
|
21
|
+
*/
|
|
22
|
+
export interface ChangelogVersionEntry {
|
|
23
|
+
version: string;
|
|
24
|
+
date: string;
|
|
25
|
+
sections: ChangelogSection[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/ChangelogService/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,sBAAsB,+DAAgE,CAAC;AAEpG,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/ChangelogService/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,CAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const CHANGELOG_FILENAME = 'CHANGELOG.md';
|
|
2
|
+
export const REQUIRED_SECTION_TYPES = ['✅ Added', '🏗️ Changed', '🩹 Fixed', '🔥 Removed'] as const;
|
|
3
|
+
|
|
4
|
+
export type ChangelogSectionType = (typeof REQUIRED_SECTION_TYPES)[number];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Repository information for generating version links.
|
|
8
|
+
*/
|
|
9
|
+
export interface RepositoryInfo {
|
|
10
|
+
owner: string;
|
|
11
|
+
repo: string;
|
|
12
|
+
url: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents a section within a changelog version entry.
|
|
17
|
+
*/
|
|
18
|
+
export interface ChangelogSection {
|
|
19
|
+
type: ChangelogSectionType;
|
|
20
|
+
content: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents a version entry in a changelog.
|
|
25
|
+
*/
|
|
26
|
+
export interface ChangelogVersionEntry {
|
|
27
|
+
version: string;
|
|
28
|
+
date: string;
|
|
29
|
+
sections: ChangelogSection[];
|
|
30
|
+
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { PackageJsonMap } from '../types/PackageJsonMap.js';
|
|
2
|
-
|
|
3
|
-
* Standard Semantic Versioning bump types.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum VersionType {
|
|
6
|
-
Patch = "patch",
|
|
7
|
-
Minor = "minor",
|
|
8
|
-
Major = "major"
|
|
9
|
-
}
|
|
2
|
+
import { VersionType } from '../types/VersionType.js';
|
|
10
3
|
/**
|
|
11
4
|
* A service which can be used to manage dependencies in the current project
|
|
12
5
|
* in various ways.
|
|
@@ -19,7 +12,7 @@ export default class DependencyService {
|
|
|
19
12
|
*/
|
|
20
13
|
static updateChildPackageJsons(): Promise<void>;
|
|
21
14
|
/**
|
|
22
|
-
* Bumps the version of the package.json
|
|
15
|
+
* Bumps the version of the package.json file in the current
|
|
23
16
|
* working directory.
|
|
24
17
|
*
|
|
25
18
|
* @param versionType The type of version bump (patch, minor, major).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;WACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmDrD;;;;;OAKG;WACU,WAAW,CAAC,WAAW,GAAE,WAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCrF;;;;;;OAMG;WACU,oBAAoB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAuCrF"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { access, readFile, writeFile } from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { VersionType } from '../types/VersionType.js';
|
|
3
4
|
import ErrorUtils from '../utils/ErrorUtils.js';
|
|
4
5
|
import { DR } from './DependencyRegistry.js';
|
|
5
6
|
import FileSystemService from './FileSystemService/FileSystemService.js';
|
|
6
|
-
/**
|
|
7
|
-
* Standard Semantic Versioning bump types.
|
|
8
|
-
*/
|
|
9
|
-
export var VersionType;
|
|
10
|
-
(function (VersionType) {
|
|
11
|
-
VersionType["Patch"] = "patch";
|
|
12
|
-
VersionType["Minor"] = "minor";
|
|
13
|
-
VersionType["Major"] = "major";
|
|
14
|
-
})(VersionType || (VersionType = {}));
|
|
15
7
|
/**
|
|
16
8
|
* A service which can be used to manage dependencies in the current project
|
|
17
9
|
* in various ways.
|
|
@@ -63,7 +55,7 @@ export default class DependencyService {
|
|
|
63
55
|
}));
|
|
64
56
|
}
|
|
65
57
|
/**
|
|
66
|
-
* Bumps the version of the package.json
|
|
58
|
+
* Bumps the version of the package.json file in the current
|
|
67
59
|
* working directory.
|
|
68
60
|
*
|
|
69
61
|
* @param versionType The type of version bump (patch, minor, major).
|
|
@@ -104,7 +96,6 @@ export default class DependencyService {
|
|
|
104
96
|
};
|
|
105
97
|
const rootDir = process.cwd();
|
|
106
98
|
await updateVersion(path.join(rootDir, 'package.json'));
|
|
107
|
-
await updateVersion(path.join(rootDir, 'jsr.json'));
|
|
108
99
|
}
|
|
109
100
|
/**
|
|
110
101
|
* Retrieves all package.json files from subdirectories, excluding specified folders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyService.js","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAAA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,CAAC,OAAO,CAAC,CAC9B,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CACf,wBAAwB,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;YAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAClD,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACvD,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAgB,CAAC;gBAChE,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;oBACzB,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG;wBACpC,mBAAmB,EAAE,eAAe;wBACpC,eAAe,EAAE,QAAQ;qBAC1B,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,EAAE,CAAC,MAAM,CAAC,IAAI,CACZ,mBAAmB,QAAQ,kEAAkE,CAC9F,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBACrD,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,QAAQ,KAAK,WAAW,EAAE,CAAC,CAAC;YACzF,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -3,19 +3,11 @@ import path from 'path';
|
|
|
3
3
|
import { JsonWithVersionProperty } from '../types/JsonWithVersionProperty.js';
|
|
4
4
|
import { PackageJson } from '../types/PackageJson.js';
|
|
5
5
|
import { PackageJsonMap } from '../types/PackageJsonMap.js';
|
|
6
|
+
import { VersionType } from '../types/VersionType.js';
|
|
6
7
|
import ErrorUtils from '../utils/ErrorUtils.js';
|
|
7
8
|
import { DR } from './DependencyRegistry.js';
|
|
8
9
|
import FileSystemService from './FileSystemService/FileSystemService.js';
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Standard Semantic Versioning bump types.
|
|
12
|
-
*/
|
|
13
|
-
export enum VersionType {
|
|
14
|
-
Patch = 'patch',
|
|
15
|
-
Minor = 'minor',
|
|
16
|
-
Major = 'major'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
11
|
/**
|
|
20
12
|
* A service which can be used to manage dependencies in the current project
|
|
21
13
|
* in various ways.
|
|
@@ -78,7 +70,7 @@ export default class DependencyService {
|
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
/**
|
|
81
|
-
* Bumps the version of the package.json
|
|
73
|
+
* Bumps the version of the package.json file in the current
|
|
82
74
|
* working directory.
|
|
83
75
|
*
|
|
84
76
|
* @param versionType The type of version bump (patch, minor, major).
|
|
@@ -120,7 +112,6 @@ export default class DependencyService {
|
|
|
120
112
|
|
|
121
113
|
const rootDir = process.cwd();
|
|
122
114
|
await updateVersion(path.join(rootDir, 'package.json'));
|
|
123
|
-
await updateVersion(path.join(rootDir, 'jsr.json'));
|
|
124
115
|
}
|
|
125
116
|
|
|
126
117
|
/**
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for handling JSR-specific package operations including validation and publishing.
|
|
3
|
+
*/
|
|
4
|
+
export default class JsrPackageService {
|
|
5
|
+
/**
|
|
6
|
+
* Validates the current project for publishing to JSR. This will check if the
|
|
7
|
+
* project has any pending changes first, then update the version of the
|
|
8
|
+
* jsr.json to match the package.json file, then run the
|
|
9
|
+
* `jsr publish --dry-run` command, and finally cleanup the changes made.
|
|
10
|
+
*
|
|
11
|
+
* @param alternativePackageNames Optional array of alternative package names to validate publishing under
|
|
12
|
+
*
|
|
13
|
+
* **Warning:** This method uses simple string replacement for package names, which may have unintended effects
|
|
14
|
+
* if the package name appears in unexpected places. Use with caution.
|
|
15
|
+
*/
|
|
16
|
+
static validatePublish(alternativePackageNames?: string[]): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Publishes the current project to JSR.
|
|
19
|
+
*
|
|
20
|
+
* @param alternativePackageNames Optional array of alternative package names to publish under
|
|
21
|
+
*
|
|
22
|
+
* **Warning:** This method uses simple string replacement for package names, which may have unintended effects
|
|
23
|
+
* if the package name appears in unexpected places. Use with caution.
|
|
24
|
+
*/
|
|
25
|
+
static publish(alternativePackageNames?: string[]): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the jsr.json file from the package.json file and resolves wildcard
|
|
28
|
+
* dependencies in package.json for JSR compatibility.
|
|
29
|
+
*
|
|
30
|
+
* @returns An object containing the package name and version from jsr.json and package.json
|
|
31
|
+
*/
|
|
32
|
+
private static updateJsrFromPackageJson;
|
|
33
|
+
/**
|
|
34
|
+
* Executes a dry run of JSR publishing. Returns true if the dry run was
|
|
35
|
+
* successful, false otherwise. Also checks for existing versions on JSR
|
|
36
|
+
* and throws an error if the current version already exists or if a higher
|
|
37
|
+
* version is already published.
|
|
38
|
+
*
|
|
39
|
+
* @param packageName The package name from jsr.json
|
|
40
|
+
* @param currentVersion The current version from package.json
|
|
41
|
+
*/
|
|
42
|
+
private static publishDryRun;
|
|
43
|
+
/**
|
|
44
|
+
* Publishes the current project to JSR.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if the publish was successful, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
private static publishToJsr;
|
|
49
|
+
/**
|
|
50
|
+
* Checks for version conflicts on JSR by looking up the current package
|
|
51
|
+
* and comparing versions. Throws an error if the current version already
|
|
52
|
+
* exists or if a higher version is already published.
|
|
53
|
+
*
|
|
54
|
+
* @param packageName The package name from jsr.json
|
|
55
|
+
* @param currentVersion The current version from package.json
|
|
56
|
+
*/
|
|
57
|
+
private static checkVersionConflicts;
|
|
58
|
+
/**
|
|
59
|
+
* Replaces imports of monorepo dependencies with npm: specifiers in all TypeScript files.
|
|
60
|
+
* This is needed for JSR compatibility when publishing packages that depend on other packages in the monorepo.
|
|
61
|
+
*
|
|
62
|
+
* This helps prevent the following error that comes up as of 5/26/2025:
|
|
63
|
+
*
|
|
64
|
+
* ```sh
|
|
65
|
+
* error: Failed to publish @aneuhold/be-ts-lib@2.0.67
|
|
66
|
+
* Caused by: Failed to publish @aneuhold/be-ts-lib at 2.0.67: failed to build module graph: Module not found "file:///src/services/@aneuhold/core-ts-lib".
|
|
67
|
+
* at file:///src/services/GitHubService.ts:1:20
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
private static replaceMonorepoImportsWithNpmSpecifiers;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves wildcard dependencies in package.json by replacing them with actual
|
|
73
|
+
* version constraints (e.g., "*1.2.3") for JSR compatibility. This will
|
|
74
|
+
* write the modified package.json back to disk.
|
|
75
|
+
*
|
|
76
|
+
* @param packageJsonData The package.json data to modify
|
|
77
|
+
* @param packageJsonPath The path to the package.json file
|
|
78
|
+
*/
|
|
79
|
+
private static resolveWildcardDependenciesInPackageJson;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=JsrPackageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsrPackageService.d.ts","sourceRoot":"","sources":["../../../src/services/PackageService/JsrPackageService.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;;;;OAUG;WACU,eAAe,CAAC,uBAAuB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B/E;;;;;;;OAOG;WACU,OAAO,CAAC,uBAAuB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCvE;;;;;OAKG;mBACkB,wBAAwB;IAyC7C;;;;;;;;OAQG;mBACkB,aAAa;IAqBlC;;;;OAIG;mBACkB,YAAY;IAkBjC;;;;;;;OAOG;mBACkB,qBAAqB;IAmC1C;;;;;;;;;;;OAWG;mBACkB,uCAAuC;IAwG5D;;;;;;;OAOG;mBACkB,wCAAwC;CAoC9D"}
|