@halospv3/hce.shared-config 3.0.0-develop.2 → 3.0.0-develop.21
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 +164 -0
- package/dotnet/.github/workflows/_unit_test.yml +0 -3
- package/dotnet/.github/workflows/dotnet-release.yml +0 -3
- package/dotnet/.github/workflows/sample-dotnet-build.yml +0 -3
- package/dotnet/PublishAll.targets +3 -2
- package/dotnet/ZipPublishDir.targets +24 -29
- package/mjs/CaseInsensitiveMap.d.ts +12 -0
- package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
- package/mjs/CaseInsensitiveMap.mjs +33 -0
- package/mjs/CaseInsensitiveMap.mjs.map +1 -0
- package/mjs/commitlintConfig.d.ts +12 -0
- package/mjs/commitlintConfig.d.ts.map +1 -0
- package/mjs/commitlintConfig.mjs +13 -0
- package/mjs/commitlintConfig.mjs.map +1 -0
- package/mjs/debug.d.ts +6 -0
- package/mjs/debug.d.ts.map +1 -0
- package/mjs/debug.mjs +9 -0
- package/mjs/debug.mjs.map +1 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +38 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs +43 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +62 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +41 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
- package/mjs/dotnet/MSBuildProject.d.ts +256 -0
- package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
- package/mjs/dotnet/MSBuildProject.mjs +447 -0
- package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.d.ts +170 -0
- package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.mjs +260 -0
- package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
- package/mjs/dotnet/NugetProjectProperties.d.ts +379 -0
- package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
- package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
- package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
- package/mjs/dotnet/NugetRegistryInfo.d.ts +384 -0
- package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
- package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/helpers.d.ts +63 -0
- package/mjs/dotnet/helpers.d.ts.map +1 -0
- package/mjs/dotnet/helpers.mjs +354 -0
- package/mjs/dotnet/helpers.mjs.map +1 -0
- package/mjs/dotnet/index.d.ts +9 -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 +2 -0
- package/mjs/dotnet.d.ts.map +1 -0
- package/mjs/dotnet.mjs +9 -0
- package/mjs/dotnet.mjs.map +1 -0
- package/mjs/eslintConfig.d.ts +4 -0
- package/mjs/eslintConfig.d.ts.map +1 -0
- package/mjs/eslintConfig.mjs +98 -0
- package/mjs/eslintConfig.mjs.map +1 -0
- package/mjs/index.d.ts +3 -0
- package/mjs/index.d.ts.map +1 -0
- package/mjs/index.mjs +4 -0
- package/mjs/index.mjs.map +1 -0
- package/mjs/insertPlugins.d.ts +18 -0
- package/mjs/insertPlugins.d.ts.map +1 -0
- package/mjs/insertPlugins.mjs +73 -0
- package/mjs/insertPlugins.mjs.map +1 -0
- package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
- package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
- package/mjs/semantic-release__exec.d.mjs +2 -0
- package/mjs/semantic-release__exec.d.mjs.map +1 -0
- package/mjs/semantic-release__git.d.mjs +2 -0
- package/mjs/semantic-release__git.d.mjs.map +1 -0
- package/mjs/semantic-release__github.d.mjs +2 -0
- package/mjs/semantic-release__github.d.mjs.map +1 -0
- package/mjs/semanticReleaseConfig.d.ts +97 -0
- package/mjs/semanticReleaseConfig.d.ts.map +1 -0
- package/mjs/semanticReleaseConfig.mjs +63 -0
- package/mjs/semanticReleaseConfig.mjs.map +1 -0
- package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
- package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
- package/mjs/semanticReleaseConfigDotnet.mjs +268 -0
- package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
- package/mjs/setupGitPluginSpec.d.ts +22 -0
- package/mjs/setupGitPluginSpec.d.ts.map +1 -0
- package/mjs/setupGitPluginSpec.mjs +144 -0
- package/mjs/setupGitPluginSpec.mjs.map +1 -0
- package/mjs/utils/Exact.d.ts +20 -0
- package/mjs/utils/Exact.d.ts.map +1 -0
- package/mjs/utils/Exact.mjs +75 -0
- package/mjs/utils/Exact.mjs.map +1 -0
- package/mjs/utils/GracefulRecursion.d.mjs +2 -0
- package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
- package/mjs/utils/env.d.ts +24 -0
- package/mjs/utils/env.d.ts.map +1 -0
- package/mjs/utils/env.mjs +39 -0
- package/mjs/utils/env.mjs.map +1 -0
- package/mjs/utils/execAsync.d.ts +37 -0
- package/mjs/utils/execAsync.d.ts.map +1 -0
- package/mjs/utils/execAsync.mjs +59 -0
- package/mjs/utils/execAsync.mjs.map +1 -0
- package/mjs/utils/miscTypes.d.ts +13 -0
- package/mjs/utils/miscTypes.d.ts.map +1 -0
- package/mjs/utils/miscTypes.mjs +10 -0
- package/mjs/utils/miscTypes.mjs.map +1 -0
- package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
- package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
- package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
- package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
- package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
- package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
- package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
- package/mjs/utils/reflection/filterForGetters.mjs +27 -0
- package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
- package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
- package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
- package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
- package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
- package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
- package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
- package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
- package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
- package/mjs/utils/reflection/inheritance.d.ts +180 -0
- package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
- package/mjs/utils/reflection/inheritance.mjs +148 -0
- package/mjs/utils/reflection/inheritance.mjs.map +1 -0
- package/mjs/utils/reflection/isConstructor.d.ts +17 -0
- package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
- package/mjs/utils/reflection/isConstructor.mjs +63 -0
- package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
- package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
- package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
- package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
- package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
- package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
- package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
- package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
- package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
- package/mjs/utils/reflection.d.ts +18 -0
- package/mjs/utils/reflection.d.ts.map +1 -0
- package/mjs/utils/reflection.mjs +10 -0
- package/mjs/utils/reflection.mjs.map +1 -0
- package/package.json +17 -17
- package/src/debug.ts +5 -4
- package/src/dotnet/GithubNugetRegistryInfo.ts +17 -9
- package/src/dotnet/GitlabNugetRegistryInfo.ts +19 -5
- package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +53 -36
- 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 +94 -8
- package/src/dotnet/helpers.ts +87 -53
- package/src/dotnet/index.ts +8 -0
- package/src/dotnet.ts +1 -0
- package/src/insertPlugins.ts +116 -0
- package/src/semantic-release__exec.d.ts +1 -1
- package/src/semanticReleaseConfig.ts +8 -3
- package/src/semanticReleaseConfigDotnet.ts +90 -88
- 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
- package/tsconfig.base.json +54 -0
- package/tsconfig.json +22 -0
- package/tsconfig.mjs.json +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halospv3/hce.shared-config",
|
|
3
|
-
"version": "3.0.0-develop.
|
|
3
|
+
"version": "3.0.0-develop.21",
|
|
4
4
|
"description": "Automate commit message quality, changelogs, and CI/CD releases. Exports a semantic-release shareable configuration deserialized from this package's '.releaserc.yml'. Shared resources for .NET projects are also distributed with this package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"halo",
|
|
@@ -23,9 +23,11 @@
|
|
|
23
23
|
"!dotnet/samples/",
|
|
24
24
|
"!tests/",
|
|
25
25
|
"CHANGELOG.md",
|
|
26
|
-
"dotnet
|
|
26
|
+
"dotnet/*",
|
|
27
|
+
"dotnet/.github/**/*",
|
|
27
28
|
"mjs/**/*",
|
|
28
|
-
"src/**/*"
|
|
29
|
+
"src/**/*",
|
|
30
|
+
"tsconfig*.json"
|
|
29
31
|
],
|
|
30
32
|
"main": "./mjs/index.mjs",
|
|
31
33
|
"infra": "polyrepo",
|
|
@@ -43,16 +45,15 @@
|
|
|
43
45
|
"lint": "eslint --cache --fix .",
|
|
44
46
|
"lint:check": "eslint --cache .",
|
|
45
47
|
"eslint-inspector": "eslint --inspect-config",
|
|
46
|
-
"
|
|
48
|
+
"prepack": "packemon pack --addExports --addFiles --declaration --loadConfigs",
|
|
49
|
+
"pack": "echo 'You should use `npm pack`' && exit 1",
|
|
47
50
|
"prepare": "husky",
|
|
48
|
-
"presemantic-release": "npm
|
|
51
|
+
"presemantic-release": "npm pack",
|
|
49
52
|
"semantic-release": "semantic-release",
|
|
50
|
-
"
|
|
53
|
+
"pretest": "npm run build && npm run test:cacheSampleProjects",
|
|
54
|
+
"test": "tsx --test --experimental-test-coverage --enable-source-maps --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.txt --test-reporter=junit --test-reporter-destination=junit.xml",
|
|
51
55
|
"test:cacheSampleProjects": "echo \"START: Cache Sample Projects\" && tsx ./tests/dotnet/MSBuildProject.projects.ts && echo \"DONE: Cache Sample Projects\"",
|
|
52
|
-
"
|
|
53
|
-
"test:noBuild": "npm run test:justTest",
|
|
54
|
-
"test:justTest": "tsx --test --experimental-test-coverage --enable-source-maps --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.txt --test-reporter=junit --test-reporter-destination=junit.xml",
|
|
55
|
-
"test:watch": "npm run test:justTest -- -- --watch",
|
|
56
|
+
"test:watch": "npm run test -- --watch",
|
|
56
57
|
"type": "tsc --build",
|
|
57
58
|
"validate": "packemon validate",
|
|
58
59
|
"watch": "packemon watch --loadConfigs"
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"chardet": "^2.1.0",
|
|
76
77
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
77
78
|
"debug": "^4.4.1",
|
|
79
|
+
"es-main": "^1.3.0",
|
|
78
80
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
79
81
|
"globals": "^16.3.0",
|
|
80
82
|
"husky": "^9.1.7",
|
|
@@ -85,20 +87,22 @@
|
|
|
85
87
|
"typescript-eslint": "^8.37.0"
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|
|
90
|
+
"@amanda-mitchell/semantic-release-npm-multiple": "^3.16.0",
|
|
88
91
|
"@babel/cli": "^7.28.0",
|
|
89
92
|
"@babel/core": "^7.28.0",
|
|
90
93
|
"@babel/eslint-parser": "^7.28.0",
|
|
91
94
|
"@commitlint/types": "^19.8.1",
|
|
92
95
|
"@eslint/config-inspector": "^1.1.0",
|
|
93
96
|
"@eslint/markdown": "^7.0.0",
|
|
97
|
+
"@sebbo2002/semantic-release-jsr": "^3.0.0",
|
|
94
98
|
"@semantic-release/gitlab": "^13.2.6",
|
|
95
99
|
"@tsconfig/node20": "^20.1.6",
|
|
96
100
|
"@types/debug": "^4.1.12",
|
|
97
101
|
"@types/tmp": "^0.2.6",
|
|
98
102
|
"conventional-changelog-preset-loader": "^5.0.0",
|
|
99
103
|
"eslint": "^9.31.0",
|
|
100
|
-
"eslint-plugin-jsdoc": "^
|
|
101
|
-
"eslint-plugin-unicorn": "^
|
|
104
|
+
"eslint-plugin-jsdoc": "^54.0.0",
|
|
105
|
+
"eslint-plugin-unicorn": "^60.0.0",
|
|
102
106
|
"packemon": "^4.1.2",
|
|
103
107
|
"tmp": "^0.2.3",
|
|
104
108
|
"tslib": "^2.8.1",
|
|
@@ -110,10 +114,6 @@
|
|
|
110
114
|
"npm": ">=10.5.0"
|
|
111
115
|
},
|
|
112
116
|
"engineStrict": true,
|
|
113
|
-
"publishConfig": {
|
|
114
|
-
"tag": "latest",
|
|
115
|
-
"provenance": true
|
|
116
|
-
},
|
|
117
117
|
"exports": {
|
|
118
118
|
".": {
|
|
119
119
|
"types": "./mjs/index.d.ts",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"setupGitPluginSpec": "src/setupGitPluginSpec.ts"
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
-
"packageManager": "pnpm@10.
|
|
141
|
+
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
|
|
142
142
|
}
|
package/src/debug.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// note: @types/debug is incorrect. There is no .log function!
|
|
2
|
+
import createDebugger, { type Debugger } from 'debug';
|
|
2
3
|
|
|
3
|
-
const _debug =
|
|
4
|
+
const _debug = createDebugger('@halospv3/hce.shared-config') as Debugger & { log: never };
|
|
4
5
|
|
|
5
|
-
if (process.argv.some(v => v.includes('--debug')) ||
|
|
6
|
-
|
|
6
|
+
if (process.argv.some(v => v.includes('--debug')) || createDebugger.enabled('@halospv3/hce.shared-config')) {
|
|
7
|
+
createDebugger.enable(_debug.namespace);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export default _debug;
|
|
@@ -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,44 +1,61 @@
|
|
|
1
1
|
import { NugetRegistryInfo, getGithubOutput } from './NugetRegistryInfo.js';
|
|
2
|
+
import esMain from 'es-main';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @returns if successful
|
|
6
|
+
* @throws if...
|
|
7
|
+
* - {@link process.argv} does not include...
|
|
8
|
+
* - `--packageId [string]`
|
|
9
|
+
* - `--source [string]`
|
|
10
|
+
* - Value of `await getGithubOutput())['new-release-version']`...
|
|
11
|
+
* - is not a valid Version
|
|
12
|
+
* - already exists at `source`
|
|
13
|
+
*/
|
|
14
|
+
async function main(): Promise<0> {
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
// Parse command-line arguments - https://stackoverflow.com/a/76298476/14894786
|
|
17
|
+
const options: {
|
|
18
|
+
packageId?: string;
|
|
19
|
+
source?: string;
|
|
20
|
+
} & Record<string, string> = {};
|
|
21
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
22
|
+
const argName = args[i];
|
|
23
|
+
const argValue = args[i + 1];
|
|
24
|
+
if (argValue !== undefined && argName?.startsWith('--') === true && options[argName.slice(2)] !== undefined) {
|
|
25
|
+
options[argName] = argValue;
|
|
26
|
+
}
|
|
15
27
|
}
|
|
16
|
-
}
|
|
17
28
|
|
|
18
|
-
if (typeof options.packageId !== 'string')
|
|
19
|
-
|
|
20
|
-
if (typeof options.source !== 'string')
|
|
21
|
-
|
|
29
|
+
if (typeof options.packageId !== 'string')
|
|
30
|
+
throw new Error('packageId must be a string');
|
|
31
|
+
if (typeof options.source !== 'string')
|
|
32
|
+
throw new Error('source must be a string');
|
|
33
|
+
|
|
34
|
+
const packageId = options.packageId,
|
|
35
|
+
source = options.source,
|
|
36
|
+
versionPattern = new RegExp(/\d+\.\d+\.\d+([-+].+)?/);
|
|
37
|
+
const ghOutput = await getGithubOutput() ?? {};
|
|
38
|
+
const matches = versionPattern.exec(ghOutput['new-release-version'] ?? '');
|
|
39
|
+
if (matches === null || matches.length === 0)
|
|
40
|
+
throw new Error(
|
|
41
|
+
'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',
|
|
42
|
+
);
|
|
22
43
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (matches === null || matches.length === 0)
|
|
29
|
-
throw new Error(
|
|
30
|
-
'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',
|
|
44
|
+
const nextVersion = matches[0];
|
|
45
|
+
const isPublished = await NugetRegistryInfo.IsNextVersionAlreadyPublished(
|
|
46
|
+
source,
|
|
47
|
+
packageId,
|
|
48
|
+
nextVersion,
|
|
31
49
|
);
|
|
32
50
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
nextVersion
|
|
38
|
-
|
|
51
|
+
if (typeof isPublished !== 'boolean')
|
|
52
|
+
throw new Error('isPublished is not a boolean');
|
|
53
|
+
if (isPublished)
|
|
54
|
+
throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);
|
|
55
|
+
console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);
|
|
56
|
+
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
39
59
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
if (isPublished)
|
|
43
|
-
throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);
|
|
44
|
-
console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);
|
|
60
|
+
if (esMain(import.meta))
|
|
61
|
+
await main();
|
|
@@ -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
|