@codluv/versionguard 0.2.0 → 0.4.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/dist/calver.d.ts +65 -22
- package/dist/calver.d.ts.map +1 -1
- package/dist/chunks/{index-BwE_OaV3.js → index-B3R60bYJ.js} +913 -138
- package/dist/chunks/index-B3R60bYJ.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +258 -22
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/fix/index.d.ts +7 -2
- package/dist/fix/index.d.ts.map +1 -1
- package/dist/guard.d.ts +45 -1
- package/dist/guard.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -23
- package/dist/init-wizard.d.ts +49 -0
- package/dist/init-wizard.d.ts.map +1 -0
- package/dist/project.d.ts +54 -10
- package/dist/project.d.ts.map +1 -1
- package/dist/sources/git-tag.d.ts +52 -0
- package/dist/sources/git-tag.d.ts.map +1 -0
- package/dist/sources/index.d.ts +15 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/json.d.ts +53 -0
- package/dist/sources/json.d.ts.map +1 -0
- package/dist/sources/provider.d.ts +25 -0
- package/dist/sources/provider.d.ts.map +1 -0
- package/dist/sources/regex.d.ts +56 -0
- package/dist/sources/regex.d.ts.map +1 -0
- package/dist/sources/resolve.d.ts +54 -0
- package/dist/sources/resolve.d.ts.map +1 -0
- package/dist/sources/toml.d.ts +60 -0
- package/dist/sources/toml.d.ts.map +1 -0
- package/dist/sources/utils.d.ts +73 -0
- package/dist/sources/utils.d.ts.map +1 -0
- package/dist/sources/version-file.d.ts +51 -0
- package/dist/sources/version-file.d.ts.map +1 -0
- package/dist/sources/yaml.d.ts +53 -0
- package/dist/sources/yaml.d.ts.map +1 -0
- package/dist/tag/index.d.ts.map +1 -1
- package/dist/types.d.ts +138 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/dist/chunks/index-BwE_OaV3.js.map +0 -1
package/dist/guard.d.ts
CHANGED
|
@@ -12,7 +12,11 @@ export interface GuardWarning {
|
|
|
12
12
|
severity: 'error' | 'warning';
|
|
13
13
|
/** Human-readable description of the issue. */
|
|
14
14
|
message: string;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Suggested remediation command when available.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue `undefined`
|
|
19
|
+
*/
|
|
16
20
|
fix?: string;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
@@ -37,6 +41,14 @@ export interface GuardReport {
|
|
|
37
41
|
* @param cwd - Repository directory to inspect.
|
|
38
42
|
* @returns A guard warning when a hooksPath override is detected.
|
|
39
43
|
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { checkHooksPathOverride } from './guard';
|
|
47
|
+
*
|
|
48
|
+
* const warning = checkHooksPathOverride(process.cwd());
|
|
49
|
+
* if (warning) console.warn(warning.message);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
40
52
|
* @public
|
|
41
53
|
* @since 0.2.0
|
|
42
54
|
*/
|
|
@@ -51,6 +63,14 @@ export declare function checkHooksPathOverride(cwd: string): GuardWarning | null
|
|
|
51
63
|
*
|
|
52
64
|
* @returns A guard warning when the HUSKY bypass is detected.
|
|
53
65
|
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { checkHuskyBypass } from './guard';
|
|
69
|
+
*
|
|
70
|
+
* const warning = checkHuskyBypass();
|
|
71
|
+
* if (warning) console.warn(warning.message);
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
54
74
|
* @public
|
|
55
75
|
* @since 0.2.0
|
|
56
76
|
*/
|
|
@@ -67,6 +87,14 @@ export declare function checkHuskyBypass(): GuardWarning | null;
|
|
|
67
87
|
* @param cwd - Repository directory to inspect.
|
|
68
88
|
* @returns Guard warnings for each hook that has been tampered with.
|
|
69
89
|
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* import { checkHookIntegrity } from './guard';
|
|
93
|
+
*
|
|
94
|
+
* const warnings = checkHookIntegrity(config, process.cwd());
|
|
95
|
+
* for (const w of warnings) console.warn(w.code, w.message);
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
70
98
|
* @public
|
|
71
99
|
* @since 0.2.0
|
|
72
100
|
*/
|
|
@@ -81,6 +109,14 @@ export declare function checkHookIntegrity(config: VersionGuardConfig, cwd: stri
|
|
|
81
109
|
* @param config - VersionGuard configuration to inspect.
|
|
82
110
|
* @returns A guard warning when hooks are enabled but not enforced.
|
|
83
111
|
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* import { checkEnforceHooksPolicy } from './guard';
|
|
115
|
+
*
|
|
116
|
+
* const warning = checkEnforceHooksPolicy(config);
|
|
117
|
+
* if (warning) console.warn(warning.message);
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
84
120
|
* @public
|
|
85
121
|
* @since 0.2.0
|
|
86
122
|
*/
|
|
@@ -97,6 +133,14 @@ export declare function checkEnforceHooksPolicy(config: VersionGuardConfig): Gua
|
|
|
97
133
|
* @param cwd - Repository directory to inspect.
|
|
98
134
|
* @returns A guard report with all findings.
|
|
99
135
|
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* import { runGuardChecks } from './guard';
|
|
139
|
+
*
|
|
140
|
+
* const report = runGuardChecks(config, process.cwd());
|
|
141
|
+
* if (!report.safe) console.error('Guard check failed:', report.warnings);
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
100
144
|
* @public
|
|
101
145
|
* @since 0.2.0
|
|
102
146
|
*/
|
package/dist/guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIlD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIlD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,IAAI,EAAE,OAAO,CAAC;IACd,yCAAyC;IACzC,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAkCvE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,GAAG,IAAI,CAWtD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CAkD1F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI,CAcvF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CA2BnF"}
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,UAAU,iDAAkD,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,GAAE,MAAsB,GAAG,IAAI,CAejF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,IAAI,CAahE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAerD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAUtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,UAAU,iDAAkD,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,GAAE,MAAsB,GAAG,IAAI,CAejF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,IAAI,CAahE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAerD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAUtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAahF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type DoctorReport, type FullValidationResult, type ValidationResult, type VersionGuardConfig } from './types';
|
|
8
8
|
export * as calver from './calver';
|
|
9
9
|
export { validateChangelog } from './changelog';
|
|
10
10
|
export { getConfig, initConfig } from './config';
|
|
@@ -12,8 +12,9 @@ export * from './feedback';
|
|
|
12
12
|
export * from './fix';
|
|
13
13
|
export * from './guard';
|
|
14
14
|
export { areHooksInstalled, installHooks, uninstallHooks } from './hooks';
|
|
15
|
-
export { getPackageVersion } from './project';
|
|
15
|
+
export { getPackageVersion, getVersionSource } from './project';
|
|
16
16
|
export * as semver from './semver';
|
|
17
|
+
export * from './sources';
|
|
17
18
|
export { checkHardcodedVersions, syncVersion } from './sync';
|
|
18
19
|
export * from './tag';
|
|
19
20
|
export * from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7D,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAY7F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,kBAAkB,EAC1B,GAAG,GAAE,MAAsB,GAC1B,oBAAoB,CAwDtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAsB,GAAG,YAAY,CA0B5F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAsB,GAAG,IAAI,CAGlF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CACrB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,kBAAkB,GACzB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqCtC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import "node:child_process";
|
|
2
2
|
import "node:path";
|
|
3
|
-
import { n, o, p, q, t, w, x, y,
|
|
3
|
+
import { G, J, R, T, V, Y, n, o, p, q, t, w, x, y, m, z, f, j, A, B, k, C, D, e, g, E, b, d, F, c, H, h, I, a, K, r, L, s, M, N, O, u, v, P, Q, S } from "./chunks/index-B3R60bYJ.js";
|
|
4
4
|
export {
|
|
5
|
+
G as GitTagSource,
|
|
6
|
+
J as JsonVersionSource,
|
|
7
|
+
R as RegexVersionSource,
|
|
8
|
+
T as TomlVersionSource,
|
|
9
|
+
V as VersionFileSource,
|
|
10
|
+
Y as YamlVersionSource,
|
|
5
11
|
n as areHooksInstalled,
|
|
6
12
|
o as calver,
|
|
7
13
|
p as canBump,
|
|
@@ -10,33 +16,37 @@ export {
|
|
|
10
16
|
w as checkHookIntegrity,
|
|
11
17
|
x as checkHooksPathOverride,
|
|
12
18
|
y as checkHuskyBypass,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
f as
|
|
16
|
-
|
|
17
|
-
A as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
m as createTag,
|
|
20
|
+
z as detectManifests,
|
|
21
|
+
f as doctor,
|
|
22
|
+
j as fixAll,
|
|
23
|
+
A as fixChangelog,
|
|
24
|
+
B as fixPackageVersion,
|
|
25
|
+
k as fixSyncIssues,
|
|
26
|
+
C as getAllTags,
|
|
27
|
+
D as getCalVerConfig,
|
|
28
|
+
e as getChangelogFeedback,
|
|
21
29
|
g as getConfig,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
E as getLatestTag,
|
|
31
|
+
b as getPackageVersion,
|
|
32
|
+
d as getSyncFeedback,
|
|
33
|
+
F as getTagFeedback,
|
|
34
|
+
c as getVersionFeedback,
|
|
35
|
+
H as getVersionSource,
|
|
27
36
|
h as handlePostTag,
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
I as initConfig,
|
|
38
|
+
a as installHooks,
|
|
39
|
+
K as resolveVersionSource,
|
|
30
40
|
r as runGuardChecks,
|
|
31
|
-
|
|
41
|
+
L as semver,
|
|
32
42
|
s as suggestNextVersion,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
M as suggestTagMessage,
|
|
44
|
+
N as sync,
|
|
45
|
+
O as syncVersion,
|
|
36
46
|
u as uninstallHooks,
|
|
37
47
|
v as validate,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
P as validateChangelog,
|
|
49
|
+
Q as validateTagForPush,
|
|
50
|
+
S as validateVersion
|
|
41
51
|
};
|
|
42
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive setup wizard and headless init for VersionGuard.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Options for headless (non-interactive) initialization.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @since 0.3.0
|
|
11
|
+
*/
|
|
12
|
+
export interface InitOptions {
|
|
13
|
+
cwd: string;
|
|
14
|
+
type?: 'semver' | 'calver';
|
|
15
|
+
format?: string;
|
|
16
|
+
manifest?: string;
|
|
17
|
+
hooks?: boolean;
|
|
18
|
+
changelog?: boolean;
|
|
19
|
+
yes?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Runs the interactive setup wizard.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Walks the user through versioning type, CalVer format, manifest source,
|
|
26
|
+
* git hooks, and changelog configuration. Writes `.versionguard.yml` when done.
|
|
27
|
+
*
|
|
28
|
+
* @param cwd - Project directory to initialize.
|
|
29
|
+
* @returns The path to the created config file, or `null` if cancelled.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
* @since 0.3.0
|
|
33
|
+
*/
|
|
34
|
+
export declare function runWizard(cwd: string): Promise<string | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Initializes VersionGuard non-interactively using CLI flags.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* When `--yes` is passed, all defaults are used without prompting.
|
|
40
|
+
* Individual flags override specific defaults.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Headless initialization options.
|
|
43
|
+
* @returns The path to the created config file.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
* @since 0.3.0
|
|
47
|
+
*/
|
|
48
|
+
export declare function runHeadless(options: InitOptions): string;
|
|
49
|
+
//# sourceMappingURL=init-wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-wizard.d.ts","sourceRoot":"","sources":["../src/init-wizard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+EnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAexD"}
|
package/dist/project.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { VersionSourceProvider } from './sources/provider';
|
|
2
|
+
import type { ManifestConfig } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* JSON-compatible scalar, array, or object value used by package metadata.
|
|
3
5
|
*
|
|
@@ -104,41 +106,83 @@ export declare function readPackageJson(cwd?: string): PackageJson;
|
|
|
104
106
|
*/
|
|
105
107
|
export declare function writePackageJson(pkg: PackageJson, cwd?: string): void;
|
|
106
108
|
/**
|
|
107
|
-
* Gets the version string from
|
|
109
|
+
* Gets the version string from the project manifest.
|
|
110
|
+
*
|
|
111
|
+
* When a `manifest` config is provided, uses the configured version source
|
|
112
|
+
* provider (auto-detection or explicit). Falls back to `package.json` for
|
|
113
|
+
* backwards compatibility when no config is provided.
|
|
108
114
|
*
|
|
109
115
|
* @public
|
|
110
116
|
* @since 0.1.0
|
|
111
117
|
* @remarks
|
|
112
|
-
* This throws when the file
|
|
113
|
-
* field.
|
|
118
|
+
* This throws when the manifest file does not exist or does not contain
|
|
119
|
+
* a version field.
|
|
114
120
|
*
|
|
115
|
-
* @param cwd - Project directory containing
|
|
116
|
-
* @
|
|
121
|
+
* @param cwd - Project directory containing the manifest.
|
|
122
|
+
* @param manifest - Optional manifest configuration for language-agnostic support.
|
|
123
|
+
* @returns The project version string.
|
|
117
124
|
* @example
|
|
118
125
|
* ```ts
|
|
119
126
|
* import { getPackageVersion } from 'versionguard';
|
|
120
127
|
*
|
|
128
|
+
* // Read from package.json (legacy fallback)
|
|
121
129
|
* const version = getPackageVersion(process.cwd());
|
|
130
|
+
*
|
|
131
|
+
* // Read from a configured manifest source
|
|
132
|
+
* const versionAlt = getPackageVersion(process.cwd(), { source: 'Cargo.toml' });
|
|
122
133
|
* ```
|
|
123
134
|
*/
|
|
124
|
-
export declare function getPackageVersion(cwd?: string): string;
|
|
135
|
+
export declare function getPackageVersion(cwd?: string, manifest?: ManifestConfig): string;
|
|
125
136
|
/**
|
|
126
|
-
* Sets the version field in
|
|
137
|
+
* Sets the version field in the project manifest.
|
|
138
|
+
*
|
|
139
|
+
* When a `manifest` config is provided, uses the configured version source
|
|
140
|
+
* provider. Falls back to `package.json` for backwards compatibility when
|
|
141
|
+
* no config is provided.
|
|
127
142
|
*
|
|
128
143
|
* @public
|
|
129
144
|
* @since 0.1.0
|
|
130
145
|
* @remarks
|
|
131
|
-
* The existing document is read, the
|
|
146
|
+
* The existing document is read, the version field is replaced, and the
|
|
132
147
|
* file is written back to disk.
|
|
133
148
|
*
|
|
134
149
|
* @param version - Version string to persist.
|
|
135
|
-
* @param cwd - Project directory containing
|
|
150
|
+
* @param cwd - Project directory containing the manifest.
|
|
151
|
+
* @param manifest - Optional manifest configuration for language-agnostic support.
|
|
136
152
|
* @example
|
|
137
153
|
* ```ts
|
|
138
154
|
* import { setPackageVersion } from 'versionguard';
|
|
139
155
|
*
|
|
156
|
+
* // Write to package.json (legacy fallback)
|
|
140
157
|
* setPackageVersion('1.2.3', process.cwd());
|
|
158
|
+
*
|
|
159
|
+
* // Write to a configured manifest source
|
|
160
|
+
* setPackageVersion('1.2.3', process.cwd(), { source: 'Cargo.toml' });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare function setPackageVersion(version: string, cwd?: string, manifest?: ManifestConfig): void;
|
|
164
|
+
/**
|
|
165
|
+
* Resolves the version source provider for a project.
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* Delegates to `resolveVersionSource` to create the appropriate provider
|
|
169
|
+
* for the configured manifest type. Use this when you need direct access
|
|
170
|
+
* to the provider's `exists`, `getVersion`, and `setVersion` methods.
|
|
171
|
+
*
|
|
172
|
+
* @param manifest - Manifest configuration.
|
|
173
|
+
* @param cwd - Project directory.
|
|
174
|
+
* @returns The resolved provider instance.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { getVersionSource } from 'versionguard';
|
|
179
|
+
*
|
|
180
|
+
* const source = getVersionSource({ source: 'package.json' }, process.cwd());
|
|
181
|
+
* const version = source.getVersion(process.cwd());
|
|
141
182
|
* ```
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
* @since 0.3.0
|
|
142
186
|
*/
|
|
143
|
-
export declare function
|
|
187
|
+
export declare function getVersionSource(manifest: ManifestConfig, cwd?: string): VersionSourceProvider;
|
|
144
188
|
//# sourceMappingURL=project.d.ts.map
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAEtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAsB,GAAG,WAAW,CAQxE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,GAAE,MAAsB,GAAG,IAAI,CAEpF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAchG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAsB,EAC3B,QAAQ,CAAC,EAAE,cAAc,GACxB,IAAI,CAWN;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EACxB,GAAG,GAAE,MAAsB,GAC1B,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git tag-based version source for Go, Swift, and similar ecosystems.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import type { VersionSourceProvider } from './provider';
|
|
7
|
+
/**
|
|
8
|
+
* Reads version from the latest Git tag. Writing creates a new annotated tag.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This provider is used for languages where the version is determined
|
|
12
|
+
* entirely by Git tags (Go, Swift, PHP/Packagist).
|
|
13
|
+
*
|
|
14
|
+
* The tag prefix (`v` by default) is auto-detected from existing tags
|
|
15
|
+
* when writing, so projects using unprefixed tags (e.g. `1.0.0`) stay
|
|
16
|
+
* consistent.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @since 0.3.0
|
|
20
|
+
*/
|
|
21
|
+
export declare class GitTagSource implements VersionSourceProvider {
|
|
22
|
+
/** Human-readable provider name. */
|
|
23
|
+
readonly name = "git-tag";
|
|
24
|
+
/** Empty string since git-tag has no manifest file. */
|
|
25
|
+
readonly manifestFile = "";
|
|
26
|
+
/**
|
|
27
|
+
* Returns `true` when `cwd` is inside a Git repository.
|
|
28
|
+
*
|
|
29
|
+
* @param cwd - Project directory to check.
|
|
30
|
+
* @returns Whether a Git repository is found.
|
|
31
|
+
*/
|
|
32
|
+
exists(cwd: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Reads the version string from the latest Git tag.
|
|
35
|
+
*
|
|
36
|
+
* @param cwd - Project directory containing the Git repository.
|
|
37
|
+
* @returns The version string extracted from the latest version tag.
|
|
38
|
+
*/
|
|
39
|
+
getVersion(cwd: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new annotated Git tag for the given version.
|
|
42
|
+
*
|
|
43
|
+
* @param version - Version string to tag.
|
|
44
|
+
* @param cwd - Project directory containing the Git repository.
|
|
45
|
+
*/
|
|
46
|
+
setVersion(version: string, cwd: string): void;
|
|
47
|
+
/** Try version-like tag patterns, fall back to any tag. */
|
|
48
|
+
private describeVersionTag;
|
|
49
|
+
/** Detect whether existing tags use a `v` prefix or not. */
|
|
50
|
+
private detectPrefix;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=git-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tag.d.ts","sourceRoot":"","sources":["../../src/sources/git-tag.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAa,YAAW,qBAAqB;IACxD,oCAAoC;IACpC,QAAQ,CAAC,IAAI,aAAa;IAE1B,uDAAuD;IACvD,QAAQ,CAAC,YAAY,MAAM;IAE3B;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAY5B;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAU/B;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAU9C,2DAA2D;IAC3D,OAAO,CAAC,kBAAkB;IAwB1B,4DAA4D;IAC5D,OAAO,CAAC,YAAY;CASrB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version source providers for language-agnostic manifest support.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export { GitTagSource } from './git-tag';
|
|
8
|
+
export { JsonVersionSource } from './json';
|
|
9
|
+
export type { VersionSourceProvider } from './provider';
|
|
10
|
+
export { RegexVersionSource } from './regex';
|
|
11
|
+
export { detectManifests, resolveVersionSource } from './resolve';
|
|
12
|
+
export { TomlVersionSource } from './toml';
|
|
13
|
+
export { VersionFileSource } from './version-file';
|
|
14
|
+
export { YamlVersionSource } from './yaml';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sources/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-based version source provider for package.json and composer.json.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import type { VersionSourceProvider } from './provider';
|
|
7
|
+
/**
|
|
8
|
+
* Reads and writes version strings from JSON manifest files.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Supports dotted key paths for nested version fields and preserves the
|
|
12
|
+
* original indentation style when writing back to disk.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @since 0.3.0
|
|
16
|
+
*/
|
|
17
|
+
export declare class JsonVersionSource implements VersionSourceProvider {
|
|
18
|
+
/** Human-readable provider name. */
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** Filename of the JSON manifest (e.g. `'package.json'`). */
|
|
21
|
+
readonly manifestFile: string;
|
|
22
|
+
/** Dotted key path to the version field within the JSON document. */
|
|
23
|
+
private readonly versionPath;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new JSON version source.
|
|
26
|
+
*
|
|
27
|
+
* @param manifestFile - JSON manifest filename.
|
|
28
|
+
* @param versionPath - Dotted key path to the version field.
|
|
29
|
+
*/
|
|
30
|
+
constructor(manifestFile?: string, versionPath?: string);
|
|
31
|
+
/**
|
|
32
|
+
* Returns `true` when the manifest file exists in `cwd`.
|
|
33
|
+
*
|
|
34
|
+
* @param cwd - Project directory to check.
|
|
35
|
+
* @returns Whether the manifest file exists.
|
|
36
|
+
*/
|
|
37
|
+
exists(cwd: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Reads the version string from the JSON manifest.
|
|
40
|
+
*
|
|
41
|
+
* @param cwd - Project directory containing the manifest.
|
|
42
|
+
* @returns The version string extracted from the manifest.
|
|
43
|
+
*/
|
|
44
|
+
getVersion(cwd: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Writes a version string to the JSON manifest, preserving indentation.
|
|
47
|
+
*
|
|
48
|
+
* @param version - Version string to write.
|
|
49
|
+
* @param cwd - Project directory containing the manifest.
|
|
50
|
+
*/
|
|
51
|
+
setVersion(version: string, cwd: string): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/sources/json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,qBAAqB;IAC7D,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC;;;;;OAKG;gBACS,YAAY,GAAE,MAAuB,EAAE,WAAW,GAAE,MAAkB;IAMlF;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAgB/B;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;CAe/C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version source provider interface and base utilities.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Abstraction for reading and writing a version string from any manifest format.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @since 0.3.0
|
|
12
|
+
*/
|
|
13
|
+
export interface VersionSourceProvider {
|
|
14
|
+
/** Human-readable provider name (e.g. `'package.json'`, `'Cargo.toml'`). */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Default manifest filename this provider handles. */
|
|
17
|
+
readonly manifestFile: string;
|
|
18
|
+
/** Returns `true` when the manifest file exists in `cwd`. */
|
|
19
|
+
exists(cwd: string): boolean;
|
|
20
|
+
/** Reads the version string from the manifest. Throws if missing or unreadable. */
|
|
21
|
+
getVersion(cwd: string): string;
|
|
22
|
+
/** Writes a version string back to the manifest. Throws if the file does not exist. */
|
|
23
|
+
setVersion(version: string, cwd: string): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/sources/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,uDAAuD;IACvD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,6DAA6D;IAC7D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7B,mFAAmF;IACnF,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC,uFAAuF;IACvF,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex-based version source for source-code manifests.
|
|
3
|
+
*
|
|
4
|
+
* Handles gemspec, mix.exs, setup.py, build.gradle, etc.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { VersionSourceProvider } from './provider';
|
|
9
|
+
/**
|
|
10
|
+
* Reads and writes version strings using regex extraction from source files.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Capture group 1 of the provided regex must match the version string.
|
|
14
|
+
* Uses position-based replacement to avoid wrong-match corruption when
|
|
15
|
+
* writing back to disk.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
* @since 0.3.0
|
|
19
|
+
*/
|
|
20
|
+
export declare class RegexVersionSource implements VersionSourceProvider {
|
|
21
|
+
/** Human-readable provider name. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Filename of the source manifest (e.g. `'setup.py'`). */
|
|
24
|
+
readonly manifestFile: string;
|
|
25
|
+
/** Compiled regex used to locate the version string. */
|
|
26
|
+
private readonly versionRegex;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new regex version source.
|
|
29
|
+
*
|
|
30
|
+
* @param manifestFile - Source manifest filename.
|
|
31
|
+
* @param versionRegex - Regex string with at least one capture group for the version.
|
|
32
|
+
*/
|
|
33
|
+
constructor(manifestFile: string, versionRegex: string);
|
|
34
|
+
/**
|
|
35
|
+
* Returns `true` when the manifest file exists in `cwd`.
|
|
36
|
+
*
|
|
37
|
+
* @param cwd - Project directory to check.
|
|
38
|
+
* @returns Whether the manifest file exists.
|
|
39
|
+
*/
|
|
40
|
+
exists(cwd: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Reads the version string from the source manifest using regex extraction.
|
|
43
|
+
*
|
|
44
|
+
* @param cwd - Project directory containing the manifest.
|
|
45
|
+
* @returns The version string captured by group 1 of the regex.
|
|
46
|
+
*/
|
|
47
|
+
getVersion(cwd: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Writes a version string to the source manifest using position-based replacement.
|
|
50
|
+
*
|
|
51
|
+
* @param version - Version string to write.
|
|
52
|
+
* @param cwd - Project directory containing the manifest.
|
|
53
|
+
*/
|
|
54
|
+
setVersion(version: string, cwd: string): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=regex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/sources/regex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,YAAW,qBAAqB;IAC9D,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IAEtC;;;;;OAKG;gBACS,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAiBtD;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAgB/B;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;CAoB/C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version source auto-detection and resolution.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import type { ManifestConfig, ManifestSourceType } from '../types';
|
|
7
|
+
import type { VersionSourceProvider } from './provider';
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the version source provider for a project.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* When `source` is `'auto'`, scans the project directory for known manifest
|
|
13
|
+
* files and returns the first match. Throws with helpful guidance if no
|
|
14
|
+
* supported manifest is found.
|
|
15
|
+
*
|
|
16
|
+
* @param config - Manifest configuration from `.versionguard.yml`.
|
|
17
|
+
* @param cwd - Project directory to scan.
|
|
18
|
+
* @returns The resolved version source provider.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { resolveVersionSource } from './resolve';
|
|
23
|
+
*
|
|
24
|
+
* const provider = resolveVersionSource({ source: 'auto' }, process.cwd());
|
|
25
|
+
* const version = provider.getVersion(process.cwd());
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @since 0.3.0
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveVersionSource(config: ManifestConfig, cwd?: string): VersionSourceProvider;
|
|
32
|
+
/**
|
|
33
|
+
* Detects all manifest files present in a project directory.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Useful for polyglot projects that may have multiple version sources.
|
|
37
|
+
* Scans the detection table in priority order and returns all matches.
|
|
38
|
+
*
|
|
39
|
+
* @param cwd - Project directory to scan.
|
|
40
|
+
* @returns Array of detected manifest source types.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { detectManifests } from './resolve';
|
|
45
|
+
*
|
|
46
|
+
* const manifests = detectManifests(process.cwd());
|
|
47
|
+
* // ['package.json', 'Cargo.toml']
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @since 0.3.0
|
|
52
|
+
*/
|
|
53
|
+
export declare function detectManifests(cwd?: string): ManifestSourceType[];
|
|
54
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/sources/resolve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAiIxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,GAAG,GAAE,MAAsB,GAC1B,qBAAqB,CAoBvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAsB,GAAG,kBAAkB,EAAE,CAWjF"}
|