@halospv3/hce.shared-config 2.6.4 → 3.0.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +452 -101
- package/README.md +100 -87
- package/dotnet/.github/workflows/_unit_test.yml +3 -3
- package/dotnet/.github/workflows/ci.yml +2 -2
- package/dotnet/.github/workflows/dotnet-release.yml +28 -28
- package/dotnet/.github/workflows/sample-dotnet-build.yml +13 -11
- package/dotnet/ExecNupkgDeterministicator.README.md +20 -0
- package/dotnet/ExecNupkgDeterministicator.targets +173 -0
- package/dotnet/GitVersion.yml +3 -1
- package/dotnet/GitVersion6.0.yml +3 -1
- package/dotnet/HCE.Shared.sln +34 -0
- package/dotnet/HCE.Shared.targets +1 -0
- package/dotnet/PublishAll.targets +2 -0
- package/dotnet/SignAfterPack.targets +104 -0
- package/dotnet/samples/HCE.Shared.DeterministicNupkg/Dummy.cs +6 -0
- package/dotnet/samples/HCE.Shared.DeterministicNupkg/HCE.Shared.DeterministicNupkg.csproj +21 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/Class1.cs +6 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/HCE.Shared.SignAfterPack.csproj +21 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/sampleCert.samplepfx +0 -0
- package/dotnet/samples/README.md +7 -0
- 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/{cjs/commitlintConfig.cjs → mjs/commitlintConfig.mjs} +3 -4
- package/mjs/commitlintConfig.mjs.map +1 -0
- package/mjs/debug.d.ts +4 -0
- package/{cjs → mjs}/debug.d.ts.map +1 -1
- package/mjs/debug.mjs +7 -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 +26 -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 +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/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 +267 -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 +77 -78
- package/src/CaseInsensitiveMap.ts +34 -0
- package/src/commitlintConfig.ts +17 -9
- package/src/debug.ts +4 -4
- package/src/dotnet/GithubNugetRegistryInfo.ts +68 -0
- package/src/dotnet/GitlabNugetRegistryInfo.ts +126 -0
- package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +44 -0
- package/src/dotnet/MSBuildProject.ts +702 -76
- package/src/dotnet/MSBuildProjectProperties.ts +281 -15
- package/src/dotnet/NugetProjectProperties.ts +609 -0
- package/src/dotnet/NugetRegistryInfo.ts +1025 -0
- package/src/dotnet/helpers.ts +479 -0
- package/src/dotnet/index.ts +17 -0
- package/src/dotnet.ts +2 -6
- package/src/eslintConfig.ts +174 -71
- package/src/index.ts +1 -3
- package/src/insertPlugins.ts +116 -0
- package/src/semantic-release__commit-analyzer.d.ts +44 -38
- package/src/semantic-release__exec.d.ts +15 -0
- package/src/semantic-release__git.d.ts +85 -88
- package/src/semantic-release__github.d.ts +139 -139
- package/src/semanticReleaseConfig.ts +111 -47
- package/src/semanticReleaseConfigDotnet.ts +397 -104
- package/src/setupGitPluginSpec.ts +153 -58
- package/src/tsconfig.json +8 -8
- package/src/utils/Exact.ts +49 -0
- package/src/utils/GracefulRecursion.d.ts +12 -0
- package/src/utils/env.ts +44 -0
- package/src/utils/execAsync.ts +89 -0
- package/src/utils/miscTypes.ts +18 -0
- package/src/utils/reflection/FunctionLike.d.ts +17 -0
- package/src/utils/reflection/GetterDescriptor.d.ts +8 -0
- package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +32 -0
- package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +20 -0
- package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +17 -0
- package/src/utils/reflection/OwnKeyOf.d.ts +20 -0
- package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +82 -0
- package/src/utils/reflection/PropertyDescriptorMap.d.ts +15 -0
- package/src/utils/reflection/filterForGetters.ts +59 -0
- package/src/utils/reflection/getOwnPropertyDescriptors.ts +52 -0
- package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +127 -0
- package/src/utils/reflection/getPrototypeChainOf.ts +85 -0
- package/src/utils/reflection/getPrototypeOf.ts +12 -0
- package/src/utils/reflection/inheritance.ts +262 -0
- package/src/utils/reflection/isConstructor.ts +74 -0
- package/src/utils/reflection/isGetterDescriptor.ts +11 -0
- package/src/utils/reflection/listOwnGetters.ts +80 -0
- package/src/utils/reflection.ts +18 -0
- package/cjs/commitlintConfig-wrapper.mjs +0 -6
- package/cjs/commitlintConfig.cjs.map +0 -1
- package/cjs/commitlintConfig.d.ts +0 -4
- package/cjs/commitlintConfig.d.ts.map +0 -1
- package/cjs/debug.cjs +0 -13
- package/cjs/debug.cjs.map +0 -1
- package/cjs/debug.d.ts +0 -4
- package/cjs/dotnet/MSBuildProject.cjs +0 -84
- package/cjs/dotnet/MSBuildProject.cjs.map +0 -1
- package/cjs/dotnet/MSBuildProject.d.ts +0 -42
- package/cjs/dotnet/MSBuildProject.d.ts.map +0 -1
- package/cjs/dotnet/MSBuildProjectProperties.cjs +0 -22
- package/cjs/dotnet/MSBuildProjectProperties.cjs.map +0 -1
- package/cjs/dotnet/MSBuildProjectProperties.d.ts +0 -13
- package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +0 -1
- package/cjs/dotnet/createDummyNupkg.cjs +0 -26
- package/cjs/dotnet/createDummyNupkg.cjs.map +0 -1
- package/cjs/dotnet/createDummyNupkg.d.ts +0 -2
- package/cjs/dotnet/createDummyNupkg.d.ts.map +0 -1
- package/cjs/dotnet/dotnetGHPR.cjs +0 -173
- package/cjs/dotnet/dotnetGHPR.cjs.map +0 -1
- package/cjs/dotnet/dotnetGHPR.d.ts +0 -37
- package/cjs/dotnet/dotnetGHPR.d.ts.map +0 -1
- package/cjs/dotnet/dotnetGLPR.cjs +0 -41
- package/cjs/dotnet/dotnetGLPR.cjs.map +0 -1
- package/cjs/dotnet/dotnetGLPR.d.ts +0 -13
- package/cjs/dotnet/dotnetGLPR.d.ts.map +0 -1
- package/cjs/dotnet/dotnetHelpers.cjs +0 -141
- package/cjs/dotnet/dotnetHelpers.cjs.map +0 -1
- package/cjs/dotnet/dotnetHelpers.d.ts +0 -26
- package/cjs/dotnet/dotnetHelpers.d.ts.map +0 -1
- package/cjs/dotnet-wrapper.mjs +0 -6
- package/cjs/dotnet.cjs +0 -15
- package/cjs/dotnet.cjs.map +0 -1
- package/cjs/dotnet.d.ts +0 -7
- package/cjs/dotnet.d.ts.map +0 -1
- package/cjs/envUtils-wrapper.mjs +0 -6
- package/cjs/envUtils.cjs +0 -37
- package/cjs/envUtils.cjs.map +0 -1
- package/cjs/envUtils.d.ts +0 -15
- package/cjs/envUtils.d.ts.map +0 -1
- package/cjs/eslintConfig-wrapper.mjs +0 -6
- package/cjs/eslintConfig.cjs +0 -52
- package/cjs/eslintConfig.cjs.map +0 -1
- package/cjs/eslintConfig.d.ts +0 -3
- package/cjs/eslintConfig.d.ts.map +0 -1
- package/cjs/findStaticConfig-wrapper.mjs +0 -6
- package/cjs/findStaticConfig.cjs +0 -34
- package/cjs/findStaticConfig.cjs.map +0 -1
- package/cjs/findStaticConfig.d.ts +0 -2
- package/cjs/findStaticConfig.d.ts.map +0 -1
- package/cjs/index-wrapper.mjs +0 -6
- package/cjs/index.cjs +0 -10
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.ts +0 -5
- package/cjs/index.d.ts.map +0 -1
- package/cjs/semantic-release__commit-analyzer.d.cjs +0 -2
- package/cjs/semantic-release__commit-analyzer.d.cjs.map +0 -1
- package/cjs/semantic-release__git.d.cjs +0 -2
- package/cjs/semantic-release__git.d.cjs.map +0 -1
- package/cjs/semantic-release__github.d.cjs +0 -2
- package/cjs/semantic-release__github.d.cjs.map +0 -1
- package/cjs/semanticReleaseConfig-wrapper.mjs +0 -6
- package/cjs/semanticReleaseConfig.cjs +0 -33
- package/cjs/semanticReleaseConfig.cjs.map +0 -1
- package/cjs/semanticReleaseConfig.d.ts +0 -4
- package/cjs/semanticReleaseConfig.d.ts.map +0 -1
- package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +0 -7
- package/cjs/semanticReleaseConfigDotnet.cjs +0 -112
- package/cjs/semanticReleaseConfigDotnet.cjs.map +0 -1
- package/cjs/semanticReleaseConfigDotnet.d.ts +0 -51
- package/cjs/semanticReleaseConfigDotnet.d.ts.map +0 -1
- package/cjs/setupGitPluginSpec-wrapper.mjs +0 -6
- package/cjs/setupGitPluginSpec.cjs +0 -67
- package/cjs/setupGitPluginSpec.cjs.map +0 -1
- package/cjs/setupGitPluginSpec.d.ts +0 -19
- package/cjs/setupGitPluginSpec.d.ts.map +0 -1
- package/src/dotnet/createDummyNupkg.ts +0 -30
- package/src/dotnet/dotnetGHPR.ts +0 -232
- package/src/dotnet/dotnetGLPR.ts +0 -46
- package/src/dotnet/dotnetHelpers.ts +0 -184
- package/src/envUtils.ts +0 -36
- package/src/findStaticConfig.ts +0 -31
- package/static/.releaserc.yml +0 -35
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* # Semantic-Release Config Factory (dotnet)
|
|
2
3
|
* A functional Semantic-Release configuration for dotnet projects
|
|
3
4
|
*
|
|
4
5
|
* extends {@link baseConfig }
|
|
5
6
|
*
|
|
6
7
|
* <-- TABLE OF CONTENTS -->
|
|
7
|
-
* - evaluateProperties
|
|
8
8
|
* - configureDotnetRelease
|
|
9
9
|
* - Insert-Edit Plugins
|
|
10
10
|
* - Append Plugins
|
|
@@ -12,119 +12,412 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { inspect } from 'node:util';
|
|
15
|
-
import type { Options
|
|
15
|
+
import type { Options } from 'semantic-release';
|
|
16
|
+
import type { Options as SRExecOptions } from '@semantic-release/exec';
|
|
16
17
|
import debug from './debug.js';
|
|
17
|
-
import { configureDotnetNugetPush, configurePrepareCmd } from './dotnet/
|
|
18
|
-
import { getEnvVarValue } from './
|
|
19
|
-
import { baseConfig
|
|
20
|
-
import {
|
|
18
|
+
import { configureDotnetNugetPush, configurePrepareCmd } from './dotnet/helpers.js';
|
|
19
|
+
import { getEnvVarValue } from './utils/env.js';
|
|
20
|
+
import { baseConfig } from './semanticReleaseConfig.js';
|
|
21
|
+
import { NugetRegistryInfo } from './dotnet/NugetRegistryInfo.js';
|
|
22
|
+
import { MSBuildProject } from './dotnet/MSBuildProject.js';
|
|
23
|
+
import { insertPlugin } from './insertPlugins.js';
|
|
24
|
+
|
|
25
|
+
type UnArray<T> = T extends (infer U)[] ? U : T;
|
|
26
|
+
interface SRConfigDotnetOptions extends Omit<typeof baseConfig, 'plugins'> {
|
|
27
|
+
plugins: (UnArray<typeof baseConfig.plugins> | [string, unknown])[];
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
/**
|
|
23
|
-
* TODO: options/params for inserts/edits. NOT ready for production. Currently, this can only add Git plugin's options if undefined or one or more is missing.
|
|
24
|
-
* Insert (`array.splice`) and/or configure plugins.\
|
|
25
|
-
* Can be used to...\
|
|
26
|
-
* ...load plugin A before plugin B\
|
|
27
|
-
* ...edit a plugin's existing configuration
|
|
28
|
-
*
|
|
29
|
-
* @param config An instance of {@link Options}
|
|
30
|
-
* @returns a modified copy of {@link config}
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
export class SemanticReleaseConfigDotnet {
|
|
33
|
+
private readonly options: SRConfigDotnetOptions;
|
|
34
|
+
private readonly _projectsToPublish: string[] | MSBuildProject[];
|
|
35
|
+
private _projectsToPackAndPush: string[] | NugetRegistryInfo[];
|
|
36
|
+
private readonly _evaluatedProjects: MSBuildProject[];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates an instance of SemanticReleaseConfigDotnet.
|
|
40
|
+
* Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet` publish, pack, and push.
|
|
41
|
+
*
|
|
42
|
+
* Note: To sign packages, create a Target in the corresponding project(s) e.g.
|
|
43
|
+
* ```xml
|
|
44
|
+
* <Target Name="SignNupkgs" AfterTargets="Pack">
|
|
45
|
+
* <Exec Command="dotnet nuget sign $(PackageOutputPath) [remaining args]" ConsoleToMsBuild="true" />
|
|
46
|
+
* </Target>
|
|
47
|
+
* ```
|
|
48
|
+
* Alternatively, splice your signing commands into the publishCmd string,
|
|
49
|
+
* inserting them before `dotnet nuget push`.
|
|
50
|
+
* If you sign different signatures depending on the NuGet registry,
|
|
51
|
+
* splice your signing command (with "overwrite signature" enabled, if
|
|
52
|
+
* desired) before the corresponding registry's `dotnet nuget push` command.
|
|
53
|
+
* @param projectsToPublish An array of dotnet projects' relative paths. If
|
|
54
|
+
* empty or unspecified, tries getting projects' semi-colon-separated relative
|
|
55
|
+
* paths from the `PROJECTS_TO_PUBLISH` environment variable. If configured as
|
|
56
|
+
* recommended, the projects' publish outputs will be zipped to '$PWD/publish'
|
|
57
|
+
* for use in the `publish` semantic-release step (typically, GitHub release).
|
|
58
|
+
* @param projectsToPackAndPush An array of dotnet projects' relative paths.
|
|
59
|
+
* If empty or unspecified, tries getting projects' semi-colon-separated
|
|
60
|
+
* relative paths from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.
|
|
61
|
+
* Otherwise, no packages will be packed and pushed.
|
|
62
|
+
* If configured as recommended, `dotnet pack` will output the nupkg/snupkg
|
|
63
|
+
* files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.
|
|
64
|
+
*/
|
|
65
|
+
constructor(
|
|
66
|
+
projectsToPublish: string[] | MSBuildProject[],
|
|
67
|
+
projectsToPackAndPush: string[] | NugetRegistryInfo[],
|
|
68
|
+
) {
|
|
69
|
+
this.options = baseConfig;
|
|
70
|
+
/* normalize PluginSpecs to tuples */
|
|
71
|
+
this.options.plugins = this.options.plugins.map(pluginSpec => typeof pluginSpec === 'string'
|
|
72
|
+
? [pluginSpec, {}]
|
|
73
|
+
: pluginSpec,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
this._projectsToPublish = projectsToPublish;
|
|
77
|
+
if (this._projectsToPublish.length === 0) {
|
|
78
|
+
const p = getEnvVarValue('PROJECTS_TO_PUBLISH')?.split(';');
|
|
79
|
+
if (p && p.length > 0) {
|
|
80
|
+
this._projectsToPublish = p;
|
|
81
|
+
}
|
|
82
|
+
else if (debug.enabled) {
|
|
83
|
+
debug.log(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
this._projectsToPackAndPush = projectsToPackAndPush;
|
|
88
|
+
if (this._projectsToPackAndPush.length === 0) {
|
|
89
|
+
const p = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH')?.split(';');
|
|
90
|
+
if (p && p.length > 0) {
|
|
91
|
+
this._projectsToPackAndPush = p;
|
|
92
|
+
}
|
|
93
|
+
else if (debug.enabled) {
|
|
94
|
+
debug.log(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// may be zero-length array
|
|
99
|
+
this._evaluatedProjects = [
|
|
100
|
+
...this._projectsToPublish.filter(v => v instanceof MSBuildProject),
|
|
101
|
+
...this._projectsToPackAndPush
|
|
102
|
+
.filter(v => v instanceof NugetRegistryInfo)
|
|
103
|
+
.map(v => v.project),
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
get ProjectsToPublish(): string[] | MSBuildProject[] {
|
|
108
|
+
return this._projectsToPublish;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get ProjectsToPackAndPush(): string[] | NugetRegistryInfo[] {
|
|
112
|
+
return this._projectsToPackAndPush;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get EvaluatedProjects(): MSBuildProject[] {
|
|
116
|
+
return this._evaluatedProjects;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
insertPlugin(
|
|
120
|
+
afterPluginsIDs: string[],
|
|
121
|
+
insertPluginIDs: string[],
|
|
122
|
+
beforePluginsIDs: string[],
|
|
123
|
+
): void {
|
|
124
|
+
this.options.plugins = insertPlugin(this.options.plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* generate dotnet commands for \@semantic-release/exec, appending commands with ' && ' when necessary.
|
|
129
|
+
*
|
|
130
|
+
* Note: All strings in {@link this.ProjectsToPackAndPush} will be converted to basic {@link NugetRegistryInfo} instances with default values.
|
|
131
|
+
* If you need specific NRI settings or you need to push to GitLab-like or GitHub-like registries, instantiate them instead of passing their paths.
|
|
132
|
+
* @todo change to builder method? e.g. static async SetupDotnetCommands(this: SemanticReleaseConfigDotnet): Promise<SemanticReleaseConfigDotnet>
|
|
133
|
+
* @todo Add options param to allow users to enable pushing to GitLab, GitHub, NuGet.org with default settings -OR- with entirely custom settings.
|
|
134
|
+
* @see https://github.com/semantic-release/exec#usage
|
|
135
|
+
*/
|
|
136
|
+
async setupDotnetCommands(): Promise<void> {
|
|
137
|
+
let srExecIndex = this.options.plugins.findIndex(
|
|
138
|
+
v => v[0] === '@semantic-release/exec',
|
|
139
|
+
);
|
|
140
|
+
if (srExecIndex === -1) {
|
|
141
|
+
const message = `\
|
|
142
|
+
Unable to find\`['@semantic-release/exec', unknown]\` in plugins array!
|
|
143
|
+
Appending it to the end of the array...This may cause an unexpected order of operations!`;
|
|
144
|
+
console.warn(message);
|
|
145
|
+
srExecIndex = this.options.plugins.push(['@semantic-release/exec', {}]) - 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const execOptions = this.options.plugins[srExecIndex] as SRExecOptions;
|
|
149
|
+
|
|
150
|
+
// ensure all packable projects are evaluated
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
152
|
+
this._projectsToPackAndPush = await Promise.all(
|
|
153
|
+
this._projectsToPackAndPush.map(async (project) => {
|
|
154
|
+
if (typeof project === 'string') {
|
|
155
|
+
const packableProjects = await Promise.all(
|
|
156
|
+
await MSBuildProject.PackableProjectsToMSBuildProjects(
|
|
157
|
+
[project],
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
if (packableProjects.length === 0)
|
|
161
|
+
throw new Error('No MSBuildProject instances were returned!');
|
|
162
|
+
this._evaluatedProjects.push(...packableProjects);
|
|
163
|
+
|
|
164
|
+
// if the user doesn't want a defaulted NRI, they should pass their own NRI (or derived) instance.
|
|
165
|
+
return packableProjects.map(project => new NugetRegistryInfo({ project }));
|
|
166
|
+
}
|
|
167
|
+
else return [project];
|
|
168
|
+
}),
|
|
169
|
+
).then(p => p.flat()) as NugetRegistryInfo[];
|
|
170
|
+
|
|
171
|
+
// todo: double-check token-testing commands. Are they formatted prepended correctly?
|
|
172
|
+
const verifyConditionsCmdAppendix = await Promise.all(
|
|
173
|
+
this._projectsToPackAndPush
|
|
174
|
+
.map(async project =>
|
|
175
|
+
await project.PackDummyPackage({})
|
|
176
|
+
.then(() =>
|
|
177
|
+
project.GetPushDummyCommand({}),
|
|
178
|
+
),
|
|
179
|
+
),
|
|
180
|
+
).then(cmds =>
|
|
181
|
+
cmds.join(' && '),
|
|
182
|
+
);
|
|
183
|
+
execOptions.verifyConditionsCmd
|
|
184
|
+
= execOptions.verifyConditionsCmd && execOptions.verifyConditionsCmd.trim().length > 0
|
|
185
|
+
? `${execOptions.verifyConditionsCmd} && ${verifyConditionsCmdAppendix}`
|
|
186
|
+
: verifyConditionsCmdAppendix;
|
|
187
|
+
|
|
188
|
+
const verifyReleaseCmdAppendix = await Promise.all(
|
|
189
|
+
this.ProjectsToPackAndPush
|
|
190
|
+
.filter(project =>
|
|
191
|
+
typeof project !== 'string',
|
|
192
|
+
).map(project =>
|
|
193
|
+
project.GetIsNextVersionAlreadyPublishedCommand(),
|
|
194
|
+
),
|
|
195
|
+
).then(cmds =>
|
|
196
|
+
cmds.join(' && '),
|
|
197
|
+
);
|
|
198
|
+
execOptions.verifyReleaseCmd
|
|
199
|
+
= execOptions.verifyReleaseCmd && execOptions.verifyReleaseCmd.trim().length > 0
|
|
200
|
+
? `${execOptions.verifyReleaseCmd} && ${verifyReleaseCmdAppendix}`
|
|
201
|
+
: verifyConditionsCmdAppendix;
|
|
202
|
+
|
|
203
|
+
const prepareCmdAppendix = await configurePrepareCmd(
|
|
204
|
+
this._projectsToPublish,
|
|
205
|
+
this._projectsToPackAndPush,
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
// 'ZipPublishDir' zips each publish folder to ./publish/*.zip
|
|
209
|
+
execOptions.prepareCmd
|
|
210
|
+
= execOptions.prepareCmd && execOptions.prepareCmd.trim().length > 0
|
|
211
|
+
? `${execOptions.prepareCmd} && ${prepareCmdAppendix}`
|
|
212
|
+
: prepareCmdAppendix;
|
|
35
213
|
|
|
36
|
-
|
|
214
|
+
// FINISHED execOptions.prepareCmd
|
|
215
|
+
// STARTING execOptions.publishCmd
|
|
216
|
+
if (this._projectsToPackAndPush.length > 0) {
|
|
217
|
+
const publishCmdAppendix: string = configureDotnetNugetPush(
|
|
218
|
+
this._projectsToPackAndPush,
|
|
219
|
+
);
|
|
220
|
+
execOptions.publishCmd
|
|
221
|
+
= execOptions.publishCmd && execOptions.publishCmd.trim().length > 0
|
|
222
|
+
? `${execOptions.publishCmd} && ${publishCmdAppendix}`
|
|
223
|
+
: publishCmdAppendix;
|
|
224
|
+
}
|
|
37
225
|
|
|
38
|
-
|
|
226
|
+
// FINISHED execOptions.publishCmd
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Insert a plugin into the plugins array.
|
|
231
|
+
* @deprecated EXPERIMENTAL: needs thorough tests implemented before use in production!
|
|
232
|
+
* @param insertAfterPluginIDs Plugins which should appear BEFORE
|
|
233
|
+
* {@link insertPluginIDs}.
|
|
234
|
+
* @param insertPluginIDs The plugin(s) to insert into the plugins array.
|
|
235
|
+
* @param insertBeforePluginsIDs plugins which should appear AFTER the
|
|
236
|
+
* inserted plugin(s).
|
|
237
|
+
*/
|
|
238
|
+
splicePlugin(
|
|
239
|
+
insertAfterPluginIDs: string[],
|
|
240
|
+
insertPluginIDs: string[],
|
|
241
|
+
insertBeforePluginsIDs: string[],
|
|
242
|
+
): void {
|
|
243
|
+
const errors: Error[] = [];
|
|
244
|
+
const pluginIDs = this.options.plugins.map(v =>
|
|
245
|
+
typeof v === 'string' ? v : v[0],
|
|
246
|
+
) as (typeof this.options.plugins[number])[][0];
|
|
247
|
+
|
|
248
|
+
// if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.
|
|
249
|
+
|
|
250
|
+
const indexOfLastPreceding: number | undefined = insertAfterPluginIDs
|
|
251
|
+
.filter(v => pluginIDs.includes(v))
|
|
252
|
+
.map(v => pluginIDs.indexOf(v))
|
|
253
|
+
.sort()
|
|
254
|
+
.find((_v, i, obj) => i === obj.length - 1);
|
|
255
|
+
if (!indexOfLastPreceding)
|
|
256
|
+
throw new ReferenceError(
|
|
257
|
+
'An attempt to get the last element of indexOfLastAfter returned undefined.',
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const indicesOfBefore: number[] = insertBeforePluginsIDs
|
|
261
|
+
.filter(v => pluginIDs.includes(v))
|
|
262
|
+
.map(v => pluginIDs.indexOf(v))
|
|
263
|
+
.sort();
|
|
264
|
+
|
|
265
|
+
for (const index of indicesOfBefore) {
|
|
266
|
+
if (index <= indexOfLastPreceding) {
|
|
267
|
+
const formattedInsertIds: string
|
|
268
|
+
= '[' + insertPluginIDs.map(v => `"${v}"`).join(', ') + ']';
|
|
269
|
+
const formattedAfterIds: string
|
|
270
|
+
= '[' + insertAfterPluginIDs.map(v => `"${v}"`).join(', ') + ']';
|
|
271
|
+
const formattedBeforeIds: string
|
|
272
|
+
= '[' + insertBeforePluginsIDs.map(v => `"${v}"`).join(', ') + ']';
|
|
273
|
+
errors.push(
|
|
274
|
+
new Error(
|
|
275
|
+
`insertPlugin was instructed to insert ${formattedInsertIds} after ${formattedAfterIds} and before ${formattedBeforeIds}, `
|
|
276
|
+
+ `but ${JSON.stringify(pluginIDs[indexOfLastPreceding])} is ordered after ${JSON.stringify(pluginIDs[index])}!`,
|
|
277
|
+
),
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (errors.length > 0)
|
|
283
|
+
throw new AggregateError(errors, 'One or more errors occurred while splicing plugin-option tuples into the Semantic Release config!');
|
|
284
|
+
|
|
285
|
+
this.options.plugins.splice(
|
|
286
|
+
indexOfLastPreceding + 1,
|
|
287
|
+
0,
|
|
288
|
+
...insertPluginIDs.map(v => [v, {}] satisfies [string, unknown]),
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// todo: join result with dummy pack commands
|
|
293
|
+
protected async getTokenTestingCommands(): Promise<string> {
|
|
294
|
+
const promiseProjects = this.ProjectsToPackAndPush.every(nri => nri instanceof NugetRegistryInfo)
|
|
295
|
+
? this.ProjectsToPackAndPush.map(nri => nri.project)
|
|
296
|
+
: await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects(this.ProjectsToPackAndPush));
|
|
297
|
+
|
|
298
|
+
/** if a project is not in {@link EvaluatedProjects}, add it */
|
|
299
|
+
for (const project of promiseProjects) {
|
|
300
|
+
if (!this.EvaluatedProjects.includes(project))
|
|
301
|
+
this.EvaluatedProjects.push(project);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const regInfos = promiseProjects.map(
|
|
305
|
+
p => new NugetRegistryInfo({ project: p }),
|
|
306
|
+
);
|
|
307
|
+
const nupkgPaths = await Promise.all(
|
|
308
|
+
regInfos.map(async nri =>
|
|
309
|
+
nri.PackDummyPackage({}).then((nupkgs) => {
|
|
310
|
+
// this is a full file path.
|
|
311
|
+
const mainNupkg = nupkgs.find(nupkg =>
|
|
312
|
+
new RegExp(/(?<!symbols)\.nupkg$/).test(nupkg),
|
|
313
|
+
);
|
|
314
|
+
if (mainNupkg !== undefined)
|
|
315
|
+
return { nri: nri, nupkgPath: mainNupkg } as const;
|
|
316
|
+
throw new Error(
|
|
317
|
+
'None of the following dummy packages are non-symbol .nupkg files:\n'
|
|
318
|
+
+ nupkgs.map(nupkg => ` - ${nupkg}`).join('\n')
|
|
319
|
+
+ '\nIf you intended to push only symbol packages, check if a feature request already exists (https://github.com/HaloSPV3/HCE.Shared/issues?q=push+snupkg) and, if one does not exist, create one containing the keywords "push snupkg".',
|
|
320
|
+
);
|
|
321
|
+
}),
|
|
322
|
+
),
|
|
323
|
+
);
|
|
324
|
+
const pushCommands = nupkgPaths.map(pair =>
|
|
325
|
+
pair.nri.GetPushDummyCommand({}),
|
|
326
|
+
);
|
|
327
|
+
return pushCommands.join(' && ');
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
toOptions(): Options {
|
|
331
|
+
return this.options;
|
|
332
|
+
}
|
|
39
333
|
}
|
|
40
334
|
|
|
41
335
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @param projectsToPublish
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
336
|
+
* Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet`
|
|
337
|
+
* publish, pack, and nuget-push.
|
|
338
|
+
* @param projectsToPublish
|
|
339
|
+
* An array of dotnet projects' relative paths -OR- an array of
|
|
340
|
+
* {@link MSBuildProject} instances.
|
|
341
|
+
* - If `MSBuildProject[]`, the instances will be used as-is.
|
|
342
|
+
* - If `[]`, tries getting projects' semi-colon-separated relative paths from
|
|
343
|
+
* the `PROJECTS_TO_PUBLISH` environment variable.
|
|
344
|
+
* - If configured as recommended, the projects' publish outputs will be zipped
|
|
345
|
+
* to '$PWD/publish' for use in the `publish` semantic-release step e.g. for a
|
|
346
|
+
* GitHub release.
|
|
347
|
+
* @param projectsToPackAndPush An array of dotnet projects' relative paths -OR-
|
|
348
|
+
* an array of instances of {@link NugetRegistryInfo} and/or derived classes.
|
|
349
|
+
* - If `NugetRegistryInfo[]`, no conversions or modifications will occur.
|
|
350
|
+
* - If `string[]`, the project paths will be converted to
|
|
351
|
+
* {@link NugetRegistryInfo} instances with default values. This may be undesired.
|
|
352
|
+
* - If `[]`, `dotnet pack` and `dotnet nuget push` commands will not be configured.
|
|
353
|
+
* - If `undefined`, tries getting projects' semi-colon-separated relative paths
|
|
354
|
+
* from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.
|
|
355
|
+
* With the recommended configuration, `dotnet pack` will write the nupkg/snupkg
|
|
356
|
+
* files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.
|
|
357
|
+
* @returns a semantic-release Options object, based on
|
|
358
|
+
* `@halospv3/hce.shared-config` (our base config), with the
|
|
359
|
+
* `@semantic-release/exec` plugin configured to `dotnet publish`, `pack`, and
|
|
360
|
+
* `push` the specified projects.
|
|
47
361
|
*/
|
|
48
|
-
export function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
362
|
+
export async function getConfig(
|
|
363
|
+
projectsToPublish: string[] | MSBuildProject[],
|
|
364
|
+
projectsToPackAndPush?: string[] | NugetRegistryInfo[],
|
|
365
|
+
): Promise<Options> {
|
|
366
|
+
if (debug.enabled) {
|
|
367
|
+
debug.log(
|
|
368
|
+
'hce.shared-config:\n' + inspect(baseConfig, false, Infinity, true),
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const errors: Error[] = [];
|
|
373
|
+
|
|
374
|
+
if (projectsToPublish.length === 0) {
|
|
375
|
+
const _ = getEnvVarValue('PROJECTS_TO_PUBLISH');
|
|
376
|
+
if (_ === undefined)
|
|
377
|
+
errors.push(
|
|
378
|
+
new Error(
|
|
379
|
+
'projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path.',
|
|
380
|
+
),
|
|
381
|
+
);
|
|
382
|
+
else projectsToPublish = _.split(';');
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (!projectsToPackAndPush) {
|
|
386
|
+
const _ = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH');
|
|
387
|
+
if (_ === undefined)
|
|
388
|
+
errors.push(
|
|
389
|
+
new Error(
|
|
390
|
+
'projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.',
|
|
391
|
+
),
|
|
392
|
+
);
|
|
393
|
+
else projectsToPackAndPush = _.split(';');
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (errors.length > 0) {
|
|
397
|
+
throw new Error(
|
|
398
|
+
[
|
|
399
|
+
'getConfig cannot continue. One or more errors occurred.',
|
|
400
|
+
...errors.map(v => v.stack),
|
|
401
|
+
].join('\n'),
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const config = new SemanticReleaseConfigDotnet(
|
|
406
|
+
projectsToPublish,
|
|
407
|
+
projectsToPackAndPush ?? [],
|
|
408
|
+
);
|
|
409
|
+
await config.setupDotnetCommands();
|
|
410
|
+
|
|
411
|
+
const options: Options = config.toOptions();
|
|
412
|
+
if (debug.enabled) {
|
|
413
|
+
console.debug(
|
|
414
|
+
`modified plugins array:\n${inspect(options.plugins, false, Infinity)}`,
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return options;
|
|
68
419
|
}
|
|
69
420
|
|
|
70
421
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param projectsToPublish An array of dotnet projects' relative paths. If
|
|
73
|
-
* empty or unspecified, tries getting projects' semi-colon-separated relative
|
|
74
|
-
* paths from the `PROJECTS_TO_PUBLISH` environment variable. If configured as
|
|
75
|
-
* recommended, the projects' publish outputs will be zipped to '$PWD/publish'
|
|
76
|
-
* for use in the `publish` semantic-release step (typically, GitHub release).
|
|
77
|
-
* @param projectsToPackAndPush An array of dotnet projects' relative paths. If
|
|
78
|
-
* false, `dotnet pack` and `dotnet nuget push` will be left out of the exec
|
|
79
|
-
* commands. If empty or unspecified, tries getting projects'
|
|
80
|
-
* semi-colon-separated relative paths from the `PROJECTS_TO_PACK_AND_PUSH`
|
|
81
|
-
* environment variable. If configured as recommended, `dotnet pack` will output
|
|
82
|
-
* the nupkg/snupk files to `$PWD/publish` where they will be globbed by `dotnet
|
|
83
|
-
* nuget push`.
|
|
84
|
-
* @returns a semantic-release Options object, based on `@halospv3/hce.shared-config` (our base config), with the `@semantic-release/exec` plugin configured to `dotnet publish`, `pack`, and `push` the specified projects.
|
|
422
|
+
* @module semanticReleaseConfigDotnet
|
|
85
423
|
*/
|
|
86
|
-
export function getConfig(projectsToPublish: string[] = [], projectsToPackAndPush: string[] | false = []): Options {
|
|
87
|
-
if (debug.enabled) {
|
|
88
|
-
console.debug('hce.shared-config:\n' + inspect(baseConfig, false, Infinity, true));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const errors: Error[] = [];
|
|
92
|
-
|
|
93
|
-
if (projectsToPublish.length === 0) {
|
|
94
|
-
const _ = getEnvVarValue("PROJECTS_TO_PUBLISH");
|
|
95
|
-
if (_ === undefined)
|
|
96
|
-
errors.push(new Error("projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path."));
|
|
97
|
-
else
|
|
98
|
-
projectsToPublish = _.split(';');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (projectsToPackAndPush !== false && projectsToPackAndPush.length === 0) {
|
|
102
|
-
const _ = getEnvVarValue("PROJECTS_TO_PACK_AND_PUSH")
|
|
103
|
-
if (_ === undefined)
|
|
104
|
-
errors.push(new Error("projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path."));
|
|
105
|
-
else
|
|
106
|
-
projectsToPackAndPush = _.split(';');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (errors.length > 0) {
|
|
110
|
-
throw new Error(
|
|
111
|
-
[
|
|
112
|
-
"getConfig cannot continue. One or more errors occurred.",
|
|
113
|
-
...(errors.map(v => v.stack))
|
|
114
|
-
].join('\n')
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let config = { ...baseConfig };
|
|
119
|
-
config = insertAndEditPlugins(config);
|
|
120
|
-
if (projectsToPublish)
|
|
121
|
-
config = appendPlugins(config, projectsToPublish, projectsToPackAndPush);
|
|
122
|
-
|
|
123
|
-
if (debug.enabled) {
|
|
124
|
-
console.debug(`modified plugins array:\n${inspect(config.plugins, false, Infinity)}`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return config;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export default getConfig;
|