@halospv3/hce.shared-config 3.0.0-develop.6 → 3.0.0-develop.7
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/CHANGELOG.md +37 -0
- package/mjs/debug.d.ts +1 -1
- package/mjs/debug.d.ts.map +1 -1
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +13 -9
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -1
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs +1 -3
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +14 -9
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -1
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProject.d.ts +79 -86
- package/mjs/dotnet/MSBuildProject.d.ts.map +1 -1
- package/mjs/dotnet/MSBuildProject.mjs +4 -1
- package/mjs/dotnet/MSBuildProject.mjs.map +1 -1
- package/mjs/dotnet/MSBuildProjectProperties.d.ts +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -1
- package/mjs/dotnet/MSBuildProjectProperties.mjs +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -1
- package/mjs/dotnet/NugetProjectProperties.d.ts +3 -2
- package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -1
- package/mjs/dotnet/NugetRegistryInfo.d.ts +28 -26
- package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -1
- package/mjs/dotnet/helpers.d.ts +7 -39
- package/mjs/dotnet/helpers.d.ts.map +1 -1
- package/mjs/dotnet/helpers.mjs +4 -1
- package/mjs/dotnet/helpers.mjs.map +1 -1
- package/mjs/dotnet/index.d.ts +17 -0
- package/mjs/dotnet/index.d.ts.map +1 -0
- package/mjs/dotnet/index.mjs +9 -0
- package/mjs/dotnet/index.mjs.map +1 -0
- package/mjs/dotnet.d.ts +3 -0
- package/mjs/dotnet.d.ts.map +1 -0
- package/mjs/dotnet.mjs +9 -0
- package/mjs/dotnet.mjs.map +1 -0
- package/mjs/insertPlugins.d.ts +2 -2
- package/mjs/insertPlugins.d.ts.map +1 -1
- package/mjs/semanticReleaseConfig.d.ts +7 -2
- package/mjs/semanticReleaseConfig.d.ts.map +1 -1
- package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -1
- package/mjs/setupGitPluginSpec.d.ts +2 -2
- package/mjs/setupGitPluginSpec.d.ts.map +1 -1
- package/mjs/utils/execAsync.d.ts +4 -3
- package/mjs/utils/execAsync.d.ts.map +1 -1
- package/mjs/utils/miscTypes.d.ts +4 -2
- package/mjs/utils/miscTypes.d.ts.map +1 -1
- package/mjs/utils/reflection/inheritance.d.ts.map +1 -1
- package/package.json +4 -7
- package/src/debug.ts +1 -1
- package/src/dotnet/GithubNugetRegistryInfo.ts +17 -9
- package/src/dotnet/GitlabNugetRegistryInfo.ts +19 -5
- package/src/dotnet/MSBuildProject.ts +150 -5
- package/src/dotnet/MSBuildProjectProperties.ts +2 -1
- package/src/dotnet/NugetProjectProperties.ts +3 -2
- package/src/dotnet/NugetRegistryInfo.ts +93 -7
- package/src/dotnet/helpers.ts +78 -47
- package/src/dotnet/index.ts +17 -0
- package/src/dotnet.ts +2 -0
- package/src/insertPlugins.ts +2 -2
- package/src/semantic-release__exec.d.ts +1 -1
- package/src/semanticReleaseConfig.ts +7 -2
- package/src/semanticReleaseConfigDotnet.ts +1 -1
- package/src/setupGitPluginSpec.ts +4 -1
- package/src/tsconfig.json +1 -1
- package/src/utils/execAsync.ts +13 -1
- package/src/utils/miscTypes.ts +4 -3
- package/src/utils/reflection/inheritance.ts +1 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import type { Type } from 'arktype';
|
|
1
2
|
import { getEnvVarValue } from '../utils/env.js';
|
|
3
|
+
import type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.js';
|
|
4
|
+
import type { NugetProjectProperties } from './NugetProjectProperties.js';
|
|
2
5
|
import {
|
|
3
6
|
NugetRegistryInfo,
|
|
4
7
|
NRIOptsBase,
|
|
5
8
|
} from './NugetRegistryInfo.js';
|
|
9
|
+
import type { Default } from 'arktype/internal/attributes.ts';
|
|
6
10
|
|
|
7
11
|
const NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';
|
|
8
|
-
const DefaultGithubTokenEnvVars = Object.freeze([
|
|
12
|
+
export const DefaultGithubTokenEnvVars: readonly ['GH_TOKEN', 'GITHUB_TOKEN'] = Object.freeze([
|
|
9
13
|
'GH_TOKEN',
|
|
10
14
|
'GITHUB_TOKEN',
|
|
11
|
-
]
|
|
15
|
+
]);
|
|
12
16
|
|
|
13
17
|
export class GithubNugetRegistryInfo extends NugetRegistryInfo {
|
|
14
18
|
static readonly NUGET_PKG_GITHUB_COM = 'https://nuget.pkg.github.com';
|
|
15
|
-
// todo: deduplicate definition
|
|
16
|
-
static readonly DefaultGithubTokenEnvVars = Object.freeze([
|
|
17
|
-
'GH_TOKEN',
|
|
18
|
-
'GITHUB_TOKEN',
|
|
19
|
-
] as const);
|
|
20
19
|
|
|
21
20
|
// GithubNugetRegistryInfo.CtorArgs(...) behaves differently than NugetRegistryInfo.CtorArgs(...)
|
|
22
21
|
/**
|
|
@@ -48,13 +47,22 @@ const GHNRI = GithubNugetRegistryInfo;
|
|
|
48
47
|
* {@link GHNRI.getNugetGitHubUrl} and will default to an empty string if the
|
|
49
48
|
* environment variable `GITHUB_REPOSITORY_OWNER` is undefined!
|
|
50
49
|
*/
|
|
51
|
-
export const GHNRIOpts
|
|
50
|
+
export const GHNRIOpts: Type<{
|
|
51
|
+
project: MSBuildProject | {
|
|
52
|
+
readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
|
|
53
|
+
readonly Properties: Readonly<NugetProjectProperties>;
|
|
54
|
+
readonly Targets: readonly string[];
|
|
55
|
+
readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
|
|
56
|
+
};
|
|
57
|
+
source: Default<string, string>;
|
|
58
|
+
tokenEnvVars: Default<readonly string[], readonly ['GH_TOKEN', 'GITHUB_TOKEN']>;
|
|
59
|
+
}> = NRIOptsBase.merge({
|
|
52
60
|
/** @see {@link GHNRI.getNugetGitHubUrl } */
|
|
53
61
|
source: NRIOptsBase.get('source')
|
|
54
62
|
.default(() => GHNRI.getNugetGitHubUrl() ?? ''),
|
|
55
63
|
tokenEnvVars: NRIOptsBase.get('tokenEnvVars')
|
|
56
64
|
.default(
|
|
57
65
|
/* must be a function. A fixed-length array is NOT a primitive type! */
|
|
58
|
-
() => DefaultGithubTokenEnvVars,
|
|
66
|
+
(): typeof DefaultGithubTokenEnvVars => DefaultGithubTokenEnvVars,
|
|
59
67
|
),
|
|
60
68
|
});
|
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
NRIOpts,
|
|
6
6
|
NRIOptsBase,
|
|
7
7
|
} from './NugetRegistryInfo.js';
|
|
8
|
+
import type { Out } from 'arktype';
|
|
9
|
+
import type { Default } from 'arktype/internal/attributes.ts';
|
|
10
|
+
import type { ObjectType } from 'arktype/internal/methods/object.ts';
|
|
11
|
+
import type { MSBuildProject, MSBuildEvaluationOutput } from './MSBuildProject.js';
|
|
12
|
+
import type { NugetProjectProperties } from './NugetProjectProperties.js';
|
|
8
13
|
|
|
9
14
|
// https://docs.gitlab.com/ee/user/packages/nuget_repository/
|
|
10
15
|
export class GitlabNugetRegistryInfo extends NugetRegistryInfo {
|
|
@@ -13,7 +18,7 @@ export class GitlabNugetRegistryInfo extends NugetRegistryInfo {
|
|
|
13
18
|
* @returns The value of the environment variable `CI_API_V4_URL`.
|
|
14
19
|
* If that's `undefined`, 'https://gitlab.com/api/v4' is returned, instead.
|
|
15
20
|
*/
|
|
16
|
-
static get CI_API_V4_URL() {
|
|
21
|
+
static get CI_API_V4_URL(): string {
|
|
17
22
|
return getEnvVarValue('CI_API_V4_URL') ?? 'https://gitlab.com/api/v4';
|
|
18
23
|
}
|
|
19
24
|
|
|
@@ -23,7 +28,7 @@ export class GitlabNugetRegistryInfo extends NugetRegistryInfo {
|
|
|
23
28
|
* @returns The value of the environment variable `CI_PROJECT_ID` or `undefined`.
|
|
24
29
|
* @todo add URI encoded project pathname as alternative e.g. 'halospv3%2FHCE.Shared' in 'https://gitlab.com/api/v4/projects/halospv3%2FHCE.Shared'
|
|
25
30
|
*/
|
|
26
|
-
static get projectId() {
|
|
31
|
+
static get projectId(): string | undefined {
|
|
27
32
|
return getEnvVarValue('CI_PROJECT_ID');
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -32,11 +37,11 @@ export class GitlabNugetRegistryInfo extends NugetRegistryInfo {
|
|
|
32
37
|
* This method checks the contents of your `.env` file, if present.
|
|
33
38
|
* @returns The value of the environment variable 'CI_PROJECT_NAMESPACE_ID' or `undefined`.
|
|
34
39
|
*/
|
|
35
|
-
static get ownerId() {
|
|
40
|
+
static get ownerId(): string | undefined {
|
|
36
41
|
return getEnvVarValue('CI_PROJECT_NAMESPACE_ID');
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
static readonly DefaultGitlabTokenEnvVars = Object.freeze([
|
|
44
|
+
static readonly DefaultGitlabTokenEnvVars: readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN'] = Object.freeze([
|
|
40
45
|
'GL_TOKEN',
|
|
41
46
|
'GITLAB_TOKEN',
|
|
42
47
|
'CI_JOB_TOKEN',
|
|
@@ -83,7 +88,16 @@ const GLNRI = GitlabNugetRegistryInfo;
|
|
|
83
88
|
/**
|
|
84
89
|
* The Arktype definition for {@link GitlabNugetRegistryInfo}'s constructor parameter. Construct an object of this type by calling {@link GLNRIOpts.from}
|
|
85
90
|
*/
|
|
86
|
-
export const GLNRIOpts
|
|
91
|
+
export const GLNRIOpts: ObjectType<{
|
|
92
|
+
project: MSBuildProject | {
|
|
93
|
+
readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
|
|
94
|
+
readonly Properties: Readonly<NugetProjectProperties>;
|
|
95
|
+
readonly Targets: readonly string[];
|
|
96
|
+
readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
|
|
97
|
+
};
|
|
98
|
+
tokenEnvVars: Default<readonly string[], readonly ['GL_TOKEN', 'GITLAB_TOKEN', 'CI_JOB_TOKEN']>;
|
|
99
|
+
source: (In: Default<string | Error, string | Error>) => Out<string | Error>;
|
|
100
|
+
}> = NRIOpts.merge({
|
|
87
101
|
tokenEnvVars: NRIOptsBase.get('tokenEnvVars').default(
|
|
88
102
|
() => GLNRI.DefaultGitlabTokenEnvVars,
|
|
89
103
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
1
|
+
import { type, type Scope } from 'arktype';
|
|
2
2
|
import { warn } from 'node:console';
|
|
3
3
|
import { type Dirent } from 'node:fs';
|
|
4
4
|
import { readdir, realpath, stat } from 'node:fs/promises';
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
NPPGetterNames,
|
|
13
13
|
NugetProjectProperties,
|
|
14
14
|
} from './NugetProjectProperties.js';
|
|
15
|
+
import type { ObjectType } from 'arktype/internal/methods/object.ts';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* See [MSBuild well-known item metadata](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-well-known-item-metadata).
|
|
@@ -72,7 +73,65 @@ const targetFailure = type({
|
|
|
72
73
|
Items: 'never[]',
|
|
73
74
|
});
|
|
74
75
|
|
|
75
|
-
const msbuildEvaluationOutput
|
|
76
|
+
const msbuildEvaluationOutput: ObjectType<{
|
|
77
|
+
Properties?: Record<string, string> | undefined;
|
|
78
|
+
Items?: Record<string, {
|
|
79
|
+
[x: string]: string | undefined;
|
|
80
|
+
Identity: string;
|
|
81
|
+
FullPath: string;
|
|
82
|
+
RootDir: string;
|
|
83
|
+
Filename: string;
|
|
84
|
+
Extension: string;
|
|
85
|
+
RelativeDir: string;
|
|
86
|
+
Directory: string;
|
|
87
|
+
RecursiveDir: string;
|
|
88
|
+
ModifiedTime: string;
|
|
89
|
+
CreatedTime: string;
|
|
90
|
+
AccessedTime: string;
|
|
91
|
+
DefiningProjectFullPath: string;
|
|
92
|
+
DefiningProjectDirectory: string;
|
|
93
|
+
DefiningProjectName: string;
|
|
94
|
+
DefiningProjectExtension: string;
|
|
95
|
+
SubType?: string;
|
|
96
|
+
TargetFrameworkIdentifier?: string | undefined;
|
|
97
|
+
TargetPlatformMoniker?: string | undefined;
|
|
98
|
+
CopyUpToDateMarker?: string | undefined;
|
|
99
|
+
TargetPlatformIdentifier?: string | undefined;
|
|
100
|
+
TargetFrameworkVersion?: string | undefined;
|
|
101
|
+
ReferenceAssembly?: string | undefined;
|
|
102
|
+
}[]> | undefined;
|
|
103
|
+
TargetResults?: Record<string, {
|
|
104
|
+
Result: 'Success';
|
|
105
|
+
Items: {
|
|
106
|
+
[x: string]: string | undefined;
|
|
107
|
+
Identity: string;
|
|
108
|
+
FullPath: string;
|
|
109
|
+
RootDir: string;
|
|
110
|
+
Filename: string;
|
|
111
|
+
Extension: string;
|
|
112
|
+
RelativeDir: string;
|
|
113
|
+
Directory: string;
|
|
114
|
+
RecursiveDir: string;
|
|
115
|
+
ModifiedTime: string;
|
|
116
|
+
CreatedTime: string;
|
|
117
|
+
AccessedTime: string;
|
|
118
|
+
DefiningProjectFullPath: string;
|
|
119
|
+
DefiningProjectDirectory: string;
|
|
120
|
+
DefiningProjectName: string;
|
|
121
|
+
DefiningProjectExtension: string;
|
|
122
|
+
SubType?: string | undefined;
|
|
123
|
+
TargetFrameworkIdentifier?: string | undefined;
|
|
124
|
+
TargetPlatformMoniker?: string | undefined;
|
|
125
|
+
CopyUpToDateMarker?: string | undefined;
|
|
126
|
+
TargetPlatformIdentifier?: string | undefined;
|
|
127
|
+
TargetFrameworkVersion?: string | undefined;
|
|
128
|
+
ReferenceAssembly?: string | undefined;
|
|
129
|
+
}[];
|
|
130
|
+
} | {
|
|
131
|
+
Result: 'Failure';
|
|
132
|
+
Items: never[];
|
|
133
|
+
}> | undefined;
|
|
134
|
+
}> = type({
|
|
76
135
|
'Properties?': type({ '[string]': 'string' }),
|
|
77
136
|
'Items?': type({ '[string]': interface_ItemMetadataBuiltIn.array() }),
|
|
78
137
|
'TargetResults?': type({ '[string]': targetSuccess.or(targetFailure) }),
|
|
@@ -111,7 +170,30 @@ export class MSBuildEvaluationOutput {
|
|
|
111
170
|
TargetResults?: typeof msbuildEvaluationOutput.infer.TargetResults;
|
|
112
171
|
}
|
|
113
172
|
|
|
114
|
-
export const EvaluationOptions
|
|
173
|
+
export const EvaluationOptions: ObjectType<{
|
|
174
|
+
FullName: string;
|
|
175
|
+
Property: {
|
|
176
|
+
MSBuildProjectFullPath?: string | undefined;
|
|
177
|
+
AssemblyName?: string | undefined;
|
|
178
|
+
BaseIntermediateOutputPath?: string | undefined;
|
|
179
|
+
BaseOutputPath?: string | undefined;
|
|
180
|
+
Description?: string | undefined;
|
|
181
|
+
IntermediateOutput?: string | undefined;
|
|
182
|
+
OutDir?: string | undefined;
|
|
183
|
+
OutputPath?: string | undefined;
|
|
184
|
+
Version?: string | undefined;
|
|
185
|
+
VersionPrefix?: string | undefined;
|
|
186
|
+
VersionSuffix?: string | undefined;
|
|
187
|
+
TargetFramework?: string | undefined;
|
|
188
|
+
TargetFrameworks?: string | undefined;
|
|
189
|
+
RuntimeIdentifier?: string | undefined;
|
|
190
|
+
RuntimeIdentifiers?: string | undefined;
|
|
191
|
+
};
|
|
192
|
+
Targets: readonly string[] | string[];
|
|
193
|
+
GetItem: readonly string[] | string[];
|
|
194
|
+
GetProperty: readonly string[] | string[];
|
|
195
|
+
GetTargetResult: readonly string[] | string[];
|
|
196
|
+
}> = Object.freeze(
|
|
115
197
|
type({
|
|
116
198
|
/**
|
|
117
199
|
* The project file's full path.
|
|
@@ -508,8 +590,71 @@ const T_PseudoMSBPInstance = type({
|
|
|
508
590
|
|
|
509
591
|
});
|
|
510
592
|
|
|
511
|
-
/**
|
|
512
|
-
|
|
593
|
+
/**
|
|
594
|
+
* ArkType type definitions for internal usage, but may be re-used elsewhere
|
|
595
|
+
* @internal
|
|
596
|
+
*/
|
|
597
|
+
export const _InternalMSBuildEvaluationTypes: Scope<{
|
|
598
|
+
msbuildEvaluationOutput: {
|
|
599
|
+
Properties?: Record<string, string> | undefined;
|
|
600
|
+
Items?: Record<string, {
|
|
601
|
+
[x: string]: string | undefined;
|
|
602
|
+
Identity: string;
|
|
603
|
+
FullPath: string;
|
|
604
|
+
RootDir: string;
|
|
605
|
+
Filename: string;
|
|
606
|
+
Extension: string;
|
|
607
|
+
RelativeDir: string;
|
|
608
|
+
Directory: string;
|
|
609
|
+
RecursiveDir: string;
|
|
610
|
+
ModifiedTime: string;
|
|
611
|
+
CreatedTime: string;
|
|
612
|
+
AccessedTime: string;
|
|
613
|
+
DefiningProjectFullPath: string;
|
|
614
|
+
DefiningProjectDirectory: string;
|
|
615
|
+
DefiningProjectName: string;
|
|
616
|
+
DefiningProjectExtension: string;
|
|
617
|
+
SubType?: string | undefined;
|
|
618
|
+
TargetFrameworkIdentifier?: string | undefined;
|
|
619
|
+
TargetPlatformMoniker?: string | undefined;
|
|
620
|
+
CopyUpToDateMarker?: string | undefined;
|
|
621
|
+
TargetPlatformIdentifier?: string | undefined;
|
|
622
|
+
TargetFrameworkVersion?: string | undefined;
|
|
623
|
+
ReferenceAssembly?: string | undefined;
|
|
624
|
+
}[]> | undefined;
|
|
625
|
+
TargetResults?: Record<string, {
|
|
626
|
+
Result: 'Success';
|
|
627
|
+
Items: {
|
|
628
|
+
[x: string]: string | undefined;
|
|
629
|
+
Identity: string;
|
|
630
|
+
FullPath: string;
|
|
631
|
+
RootDir: string;
|
|
632
|
+
Filename: string;
|
|
633
|
+
Extension: string;
|
|
634
|
+
RelativeDir: string;
|
|
635
|
+
Directory: string;
|
|
636
|
+
RecursiveDir: string;
|
|
637
|
+
ModifiedTime: string;
|
|
638
|
+
CreatedTime: string;
|
|
639
|
+
AccessedTime: string;
|
|
640
|
+
DefiningProjectFullPath: string;
|
|
641
|
+
DefiningProjectDirectory: string;
|
|
642
|
+
DefiningProjectName: string;
|
|
643
|
+
DefiningProjectExtension: string;
|
|
644
|
+
SubType?: string | undefined;
|
|
645
|
+
TargetFrameworkIdentifier?: string | undefined;
|
|
646
|
+
TargetPlatformMoniker?: string | undefined;
|
|
647
|
+
CopyUpToDateMarker?: string | undefined;
|
|
648
|
+
TargetPlatformIdentifier?: string | undefined;
|
|
649
|
+
TargetFrameworkVersion?: string | undefined;
|
|
650
|
+
ReferenceAssembly?: string | undefined;
|
|
651
|
+
}[];
|
|
652
|
+
} | {
|
|
653
|
+
Result: 'Failure';
|
|
654
|
+
Items: never[];
|
|
655
|
+
}> | undefined;
|
|
656
|
+
};
|
|
657
|
+
}> = type.scope({
|
|
513
658
|
msbuildEvaluationOutput,
|
|
514
659
|
});
|
|
515
660
|
|
|
@@ -23,8 +23,9 @@ export class MSBuildProjectProperties {
|
|
|
23
23
|
* Resolve the given path if it is not absolute. If the path exists, it is returned. Else, an Error is thrown.
|
|
24
24
|
* @param path The full file path of an MSBuild project.
|
|
25
25
|
* @returns The absolute path to the MSBuild project file.
|
|
26
|
+
* @throws {Error} if the path cannot be resolved to an existing file.
|
|
26
27
|
*/
|
|
27
|
-
static GetFullPath(path: string) {
|
|
28
|
+
static GetFullPath(path: string): string {
|
|
28
29
|
if (!node_path.isAbsolute(path))
|
|
29
30
|
path = node_path.resolve(path);
|
|
30
31
|
if (!existsSync(path))
|
|
@@ -14,9 +14,10 @@ import {
|
|
|
14
14
|
type WithProto,
|
|
15
15
|
} from '../utils/reflection.js';
|
|
16
16
|
import { MSBuildProjectProperties, type Class_MSBPP } from './MSBuildProjectProperties.js';
|
|
17
|
+
import type { StringType } from 'arktype/internal/methods/string.ts';
|
|
17
18
|
|
|
18
|
-
const Type_RepositoryType = type('""|"git"|"tfs"');
|
|
19
|
-
const Type_SymbolPackageFormat = type('"symbols.nupkg" | "snupkg"');
|
|
19
|
+
const Type_RepositoryType: StringType<'' | 'git' | 'tfs'> = type('""|"git"|"tfs"');
|
|
20
|
+
const Type_SymbolPackageFormat: StringType<'symbols.nupkg' | 'snupkg'> = type('"symbols.nupkg" | "snupkg"');
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* A readonly record of a .csproj or .fsproj with NuGet configuration properties in
|
|
@@ -20,6 +20,8 @@ import sanitizeFileName from 'sanitize-filename';
|
|
|
20
20
|
import { getEnvVarValue } from '../utils/env.js';
|
|
21
21
|
import { execAsync } from '../utils/execAsync.js';
|
|
22
22
|
import { catchCsc2012, MSBuildEvaluationOutput, MSBuildProject } from './MSBuildProject.js';
|
|
23
|
+
import type { ObjectType } from 'arktype/internal/methods/object.ts';
|
|
24
|
+
import type { Default } from 'arktype/internal/attributes.ts';
|
|
23
25
|
|
|
24
26
|
type TmpDirNamespace_Unix = `${ReturnType<typeof tmpdir>}/HCE.Shared/.NET/Dummies`;
|
|
25
27
|
type TmpDirNamespace_Win = `${ReturnType<typeof tmpdir>}\\HCE.Shared\\.NET\\Dummies`;
|
|
@@ -292,7 +294,27 @@ but the environment variable is empty or undefined.`);
|
|
|
292
294
|
* {@link NRI.PackPackagesOptionsType.t.propertyOverrides `propertyOverrides`}
|
|
293
295
|
* is a wrapper for MSBuild's `-property:<n>=<v>` properties override arg.
|
|
294
296
|
*/
|
|
295
|
-
static readonly PackPackagesOptionsType
|
|
297
|
+
static readonly PackPackagesOptionsType: ObjectType<{
|
|
298
|
+
propertyOverrides?: Record<string, string> | undefined;
|
|
299
|
+
artifactsPath?: string | undefined;
|
|
300
|
+
configuration?: 'Release' | 'Debug' | undefined;
|
|
301
|
+
disableBuildServers?: boolean | undefined;
|
|
302
|
+
force?: boolean | undefined;
|
|
303
|
+
includeSource?: boolean | undefined;
|
|
304
|
+
includeSymbols?: boolean | undefined;
|
|
305
|
+
interactive?: boolean | undefined;
|
|
306
|
+
noBuild?: boolean | undefined;
|
|
307
|
+
noLogo?: boolean | undefined;
|
|
308
|
+
noRestore?: boolean | undefined;
|
|
309
|
+
output?: string | undefined;
|
|
310
|
+
runtime?: string | undefined;
|
|
311
|
+
serviceable?: boolean | undefined;
|
|
312
|
+
terminalLogger?: 'auto' | 'on' | 'off' | undefined;
|
|
313
|
+
useCurrentRuntime?: boolean | undefined;
|
|
314
|
+
verbosity?: 'quiet' | 'minimal' | 'normal' | 'detailed' | 'diagnostic' | undefined;
|
|
315
|
+
versionSuffix?: string | undefined;
|
|
316
|
+
'-GetItem'?: readonly string[] | string[] | undefined;
|
|
317
|
+
}> = Object.freeze(
|
|
296
318
|
type({
|
|
297
319
|
/**
|
|
298
320
|
* a custom arg for handling MSBuild's `-property:<n>=<v>` argument for overriding MSBuild properties.
|
|
@@ -323,7 +345,26 @@ but the environment variable is empty or undefined.`);
|
|
|
323
345
|
}),
|
|
324
346
|
);
|
|
325
347
|
|
|
326
|
-
public static readonly PackDummyPackagesOptionsType
|
|
348
|
+
public static readonly PackDummyPackagesOptionsType: ObjectType<{
|
|
349
|
+
propertyOverrides?: Record<string, string> | undefined;
|
|
350
|
+
artifactsPath?: string | undefined;
|
|
351
|
+
configuration?: 'Release' | 'Debug' | undefined;
|
|
352
|
+
disableBuildServers?: boolean | undefined;
|
|
353
|
+
force?: boolean | undefined;
|
|
354
|
+
includeSource?: boolean | undefined;
|
|
355
|
+
includeSymbols?: boolean | undefined;
|
|
356
|
+
interactive?: boolean | undefined;
|
|
357
|
+
noBuild?: boolean | undefined;
|
|
358
|
+
noLogo?: boolean | undefined;
|
|
359
|
+
noRestore?: boolean | undefined;
|
|
360
|
+
runtime?: string | undefined;
|
|
361
|
+
serviceable?: boolean | undefined;
|
|
362
|
+
terminalLogger?: 'auto' | 'on' | 'off' | undefined;
|
|
363
|
+
useCurrentRuntime?: boolean | undefined;
|
|
364
|
+
verbosity?: 'quiet' | 'minimal' | 'normal' | 'detailed' | 'diagnostic' | undefined;
|
|
365
|
+
versionSuffix?: string | undefined;
|
|
366
|
+
'-GetItem'?: readonly string[] | string[] | undefined;
|
|
367
|
+
}>
|
|
327
368
|
= this.PackPackagesOptionsType.omit('output');
|
|
328
369
|
|
|
329
370
|
/**
|
|
@@ -518,7 +559,21 @@ but the environment variable is empty or undefined.`);
|
|
|
518
559
|
* Specific to this API:
|
|
519
560
|
* If you want to use this API's default root value (\`${cwd()}/publish`), assign an empty string.
|
|
520
561
|
*/
|
|
521
|
-
static readonly PushPackagesOptionsType
|
|
562
|
+
static readonly PushPackagesOptionsType: ObjectType<{
|
|
563
|
+
root: string;
|
|
564
|
+
apiKey?: string | undefined;
|
|
565
|
+
configFile?: string | undefined;
|
|
566
|
+
disableBuffering?: boolean | undefined;
|
|
567
|
+
forceEnglishOutput?: boolean | undefined;
|
|
568
|
+
interactive?: boolean | undefined;
|
|
569
|
+
noServiceEndpoint?: boolean | undefined;
|
|
570
|
+
noSymbols?: boolean | undefined;
|
|
571
|
+
skipDuplicate?: boolean | undefined;
|
|
572
|
+
source?: string | undefined;
|
|
573
|
+
symbolApiKey?: string | undefined;
|
|
574
|
+
symbolSource?: string | undefined;
|
|
575
|
+
timeout?: number | undefined;
|
|
576
|
+
}> = Object.freeze(
|
|
522
577
|
type({
|
|
523
578
|
/** If an empty string is passed, this property is overridden to `./publish` */
|
|
524
579
|
root: 'string',
|
|
@@ -557,7 +612,20 @@ but the environment variable is empty or undefined.`);
|
|
|
557
612
|
* {@link NRI.PushPackagesOptionsType} sans {@link NRI.PushPackagesOptionsType.t.root}.
|
|
558
613
|
* The result of {@link getDummiesDir} is used, instead.
|
|
559
614
|
*/
|
|
560
|
-
public static readonly PushDummyPackagesOptionsType
|
|
615
|
+
public static readonly PushDummyPackagesOptionsType: ObjectType<{
|
|
616
|
+
apiKey?: string | undefined;
|
|
617
|
+
configFile?: string | undefined;
|
|
618
|
+
disableBuffering?: boolean | undefined;
|
|
619
|
+
forceEnglishOutput?: boolean | undefined;
|
|
620
|
+
interactive?: boolean | undefined;
|
|
621
|
+
noServiceEndpoint?: boolean | undefined;
|
|
622
|
+
noSymbols?: boolean | undefined;
|
|
623
|
+
source?: string | undefined;
|
|
624
|
+
symbolApiKey?: string | undefined;
|
|
625
|
+
symbolSource?: string | undefined;
|
|
626
|
+
timeout?: number | undefined;
|
|
627
|
+
skipDuplicate: Default<true, true>;
|
|
628
|
+
}>
|
|
561
629
|
= NugetRegistryInfo.PushPackagesOptionsType.merge({
|
|
562
630
|
skipDuplicate: 'true = true',
|
|
563
631
|
}).omit('root');
|
|
@@ -832,13 +900,22 @@ but the environment variable is empty or undefined.`);
|
|
|
832
900
|
}
|
|
833
901
|
|
|
834
902
|
// shorthand/alias for NugetRegistryInfo
|
|
835
|
-
const NRI = NugetRegistryInfo;
|
|
903
|
+
const NRI: typeof NugetRegistryInfo = NugetRegistryInfo;
|
|
836
904
|
|
|
837
905
|
/**
|
|
838
906
|
* The base type for {@link NRIOpts} and related types. Extend this type while
|
|
839
907
|
* overriding member types via {@link NRIOptsBase.merge}
|
|
840
908
|
*/
|
|
841
|
-
export const NRIOptsBase
|
|
909
|
+
export const NRIOptsBase: ObjectType<{
|
|
910
|
+
project: MSBuildProject | {
|
|
911
|
+
readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
|
|
912
|
+
readonly Properties: Readonly<NugetProjectProperties>;
|
|
913
|
+
readonly Targets: readonly string[];
|
|
914
|
+
readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
|
|
915
|
+
};
|
|
916
|
+
source: string;
|
|
917
|
+
tokenEnvVars: readonly string[];
|
|
918
|
+
}> = type({
|
|
842
919
|
/**
|
|
843
920
|
* The environment variables whose values are tokens with permission to push a
|
|
844
921
|
* package to the NuGet package registry. The array is iterated through until
|
|
@@ -883,7 +960,16 @@ export const NRIOptsBase = type({
|
|
|
883
960
|
/**
|
|
884
961
|
* The type of the parameter for {@link NugetRegistryInfo}'s constructor.
|
|
885
962
|
*/
|
|
886
|
-
export const NRIOpts
|
|
963
|
+
export const NRIOpts: ObjectType<{
|
|
964
|
+
project: MSBuildProject | {
|
|
965
|
+
readonly Items: Readonly<Required<MSBuildEvaluationOutput>['Items']>;
|
|
966
|
+
readonly Properties: Readonly<NugetProjectProperties>;
|
|
967
|
+
readonly Targets: readonly string[];
|
|
968
|
+
readonly TargetResults: Required<MSBuildEvaluationOutput>['TargetResults'][];
|
|
969
|
+
};
|
|
970
|
+
tokenEnvVars: Default<readonly string[], readonly ['NUGET_TOKEN']>;
|
|
971
|
+
source: Default<string, string>;
|
|
972
|
+
}> = NRIOptsBase.merge({
|
|
887
973
|
/**
|
|
888
974
|
* Defaults to {@link NugetRegistryInfo.DefaultTokenEnvVars}
|
|
889
975
|
* @see {@link NRIOptsBase.t.tokenEnvVars}
|
package/src/dotnet/helpers.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { cwd } from 'node:process';
|
|
|
4
4
|
import { MSBuildProject } from './MSBuildProject.js';
|
|
5
5
|
import { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.js';
|
|
6
6
|
import { NugetRegistryInfo } from './NugetRegistryInfo.js';
|
|
7
|
+
import type { Default } from 'arktype/internal/attributes.ts';
|
|
8
|
+
import type { ObjectType } from 'arktype/internal/methods/object.ts';
|
|
7
9
|
|
|
8
10
|
const ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\'}publish`;
|
|
9
11
|
|
|
@@ -290,7 +292,9 @@ export async function configurePrepareCmd(
|
|
|
290
292
|
*/
|
|
291
293
|
export function configureDotnetNugetPush(
|
|
292
294
|
registryInfos: NugetRegistryInfo[],
|
|
293
|
-
|
|
295
|
+
// Explicit type required by JSR
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
+
packageOutputPath: string = `${cwd()}/publish`,
|
|
294
298
|
): string {
|
|
295
299
|
if (registryInfos.some(registry => registry.source.trim() === ''))
|
|
296
300
|
throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');
|
|
@@ -362,48 +366,75 @@ function formatDotnetNugetSign(
|
|
|
362
366
|
}
|
|
363
367
|
}
|
|
364
368
|
|
|
365
|
-
const DotnetNugetSignOptions
|
|
369
|
+
const DotnetNugetSignOptions: ObjectType<
|
|
370
|
+
{
|
|
371
|
+
timestamper: Default<string, 'https://rfc3161.ai.moda/'>;
|
|
372
|
+
certificatePassword?: string | undefined;
|
|
373
|
+
hashAlgorithm?: string | undefined;
|
|
374
|
+
output?: string | undefined;
|
|
375
|
+
overwrite?: true | undefined;
|
|
376
|
+
timestampHashAlgorithm?: string | undefined;
|
|
377
|
+
verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';
|
|
378
|
+
} & ({
|
|
379
|
+
certificatePath: string;
|
|
380
|
+
certificateSubjectName: string;
|
|
381
|
+
} | {
|
|
382
|
+
certificatePath: string;
|
|
383
|
+
certificateFingerprint: string;
|
|
384
|
+
} | {
|
|
385
|
+
certificateStoreName: string;
|
|
386
|
+
certificateSubjectName: string;
|
|
387
|
+
} | {
|
|
388
|
+
certificateStoreName: string;
|
|
389
|
+
certificateFingerprint: string;
|
|
390
|
+
} | {
|
|
391
|
+
certificateStoreLocation: string;
|
|
392
|
+
certificateSubjectName: string;
|
|
393
|
+
} | {
|
|
394
|
+
certificateStoreLocation: string;
|
|
395
|
+
certificateFingerprint: string;
|
|
396
|
+
})> = type({
|
|
366
397
|
/**
|
|
367
398
|
* Password for the certificate, if needed. This option can be used to specify
|
|
368
399
|
* the password for the certificate. The command will throw an error message
|
|
369
400
|
* if certificate is password protected but password is not provided as input.
|
|
370
401
|
*/
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Hash algorithm to be used to sign the package. Defaults to SHA256.
|
|
374
|
-
*/
|
|
375
|
-
'hashAlgorithm?': 'string | "SHA256"',
|
|
376
|
-
/**
|
|
377
|
-
* Directory where the signed package(s) should be saved. By default the
|
|
378
|
-
* original package is overwritten by the signed package.
|
|
379
|
-
*/
|
|
380
|
-
'output?': 'string',
|
|
381
|
-
/**
|
|
382
|
-
* Switch to indicate if the current signature should be overwritten. By
|
|
383
|
-
* default the command will fail if the package already has a signature.
|
|
384
|
-
*/
|
|
385
|
-
'overwrite?': 'true',
|
|
386
|
-
/**
|
|
387
|
-
* URL to an RFC 3161 timestamping server.
|
|
388
|
-
*/
|
|
389
|
-
timestamper: 'string = "https://rfc3161.ai.moda/"',
|
|
390
|
-
/**
|
|
391
|
-
* Hash algorithm to be used to sign the package. Defaults to SHA256.
|
|
392
|
-
*/
|
|
393
|
-
'timestampHashAlgorithm?': 'string | "SHA256"',
|
|
394
|
-
/**
|
|
395
|
-
* Set the verbosity level of the command. Allowed values are q[uiet],
|
|
396
|
-
* m[inimal], n[ormal], d[etailed], and diag[nostic].
|
|
397
|
-
*/
|
|
398
|
-
'verbosity?': '"q"|"quiet"|"m"|"minimal"|"n"|"normal"|"d"|"detailed"|"diag"|"diagnostic"',
|
|
399
|
-
}).and(
|
|
400
|
-
type({
|
|
402
|
+
'certificatePassword?': 'string',
|
|
401
403
|
/**
|
|
402
|
-
*
|
|
404
|
+
* Hash algorithm to be used to sign the package. Defaults to SHA256.
|
|
405
|
+
*/
|
|
406
|
+
'hashAlgorithm?': 'string | "SHA256"',
|
|
407
|
+
/**
|
|
408
|
+
* Directory where the signed package(s) should be saved. By default the
|
|
409
|
+
* original package is overwritten by the signed package.
|
|
403
410
|
*/
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
'output?': 'string',
|
|
412
|
+
/**
|
|
413
|
+
* Switch to indicate if the current signature should be overwritten. By
|
|
414
|
+
* default the command will fail if the package already has a signature.
|
|
415
|
+
*/
|
|
416
|
+
'overwrite?': 'true',
|
|
417
|
+
/**
|
|
418
|
+
* URL to an RFC 3161 timestamping server.
|
|
419
|
+
*/
|
|
420
|
+
timestamper: 'string = "https://rfc3161.ai.moda/"',
|
|
421
|
+
/**
|
|
422
|
+
* Hash algorithm to be used to sign the package. Defaults to SHA256.
|
|
423
|
+
*/
|
|
424
|
+
'timestampHashAlgorithm?': 'string | "SHA256"',
|
|
425
|
+
/**
|
|
426
|
+
* Set the verbosity level of the command. Allowed values are q[uiet],
|
|
427
|
+
* m[inimal], n[ormal], d[etailed], and diag[nostic].
|
|
428
|
+
*/
|
|
429
|
+
'verbosity?': '"q"|"quiet"|"m"|"minimal"|"n"|"normal"|"d"|"detailed"|"diag"|"diagnostic"',
|
|
430
|
+
}).and(
|
|
406
431
|
type({
|
|
432
|
+
/**
|
|
433
|
+
* File path to the certificate to be used while signing the package.
|
|
434
|
+
*/
|
|
435
|
+
certificatePath: 'string',
|
|
436
|
+
}).or(
|
|
437
|
+
type({
|
|
407
438
|
/**
|
|
408
439
|
* Name of the X.509 certificate store to use to search for the
|
|
409
440
|
* certificate. Defaults to "My", the X.509 certificate store for personal
|
|
@@ -412,8 +443,8 @@ const DotnetNugetSignOptions = type({
|
|
|
412
443
|
* This option should be used when specifying the certificate via
|
|
413
444
|
* --certificate-subject-name or --certificate-fingerprint options.
|
|
414
445
|
*/
|
|
415
|
-
|
|
416
|
-
|
|
446
|
+
certificateStoreName: 'string',
|
|
447
|
+
}).or({
|
|
417
448
|
/**
|
|
418
449
|
* Name of the X.509 certificate store use to search for the
|
|
419
450
|
* certificate. Defaults to "CurrentUser", the X.509 certificate store
|
|
@@ -422,10 +453,10 @@ const DotnetNugetSignOptions = type({
|
|
|
422
453
|
* This option should be used when specifying the certificate via
|
|
423
454
|
* --certificate-subject-name or --certificate-fingerprint options.
|
|
424
455
|
*/
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
456
|
+
certificateStoreLocation: 'string',
|
|
457
|
+
}),
|
|
458
|
+
).and(
|
|
459
|
+
type({
|
|
429
460
|
/**
|
|
430
461
|
* Subject name of the certificate used to search a local certificate
|
|
431
462
|
* store for the certificate. The search is a case-insensitive string
|
|
@@ -434,15 +465,15 @@ const DotnetNugetSignOptions = type({
|
|
|
434
465
|
* subject values. The certificate store can be specified by
|
|
435
466
|
* --certificate-store-name and --certificate-store-location options.
|
|
436
467
|
*/
|
|
437
|
-
|
|
438
|
-
|
|
468
|
+
certificateSubjectName: 'string',
|
|
469
|
+
}).or({
|
|
439
470
|
/**
|
|
440
471
|
* SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to
|
|
441
472
|
* search a local certificate store for the certificate. The certificate
|
|
442
473
|
* store can be specified by --certificate-store-name and
|
|
443
474
|
* --certificate-store-location options.
|
|
444
475
|
*/
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
);
|
|
476
|
+
certificateFingerprint: 'string',
|
|
477
|
+
}),
|
|
478
|
+
),
|
|
479
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type * from './GithubNugetRegistryInfo.js';
|
|
2
|
+
export type * from './GitlabNugetRegistryInfo.js';
|
|
3
|
+
export type * from './helpers.js';
|
|
4
|
+
export type * from './IsNextVersionAlreadyPublished.cli.js';
|
|
5
|
+
export type * from './MSBuildProject.js';
|
|
6
|
+
export type * from './MSBuildProjectProperties.js';
|
|
7
|
+
export type * from './NugetProjectProperties.js';
|
|
8
|
+
export type * from './NugetRegistryInfo.js';
|
|
9
|
+
|
|
10
|
+
export * from './GithubNugetRegistryInfo.js';
|
|
11
|
+
export * from './GitlabNugetRegistryInfo.js';
|
|
12
|
+
export * from './helpers.js';
|
|
13
|
+
export * from './IsNextVersionAlreadyPublished.cli.js';
|
|
14
|
+
export * from './MSBuildProject.js';
|
|
15
|
+
export * from './MSBuildProjectProperties.js';
|
|
16
|
+
export * from './NugetProjectProperties.js';
|
|
17
|
+
export * from './NugetRegistryInfo.js';
|
package/src/dotnet.ts
ADDED