@halospv3/hce.shared-config 3.0.0-develop.4 → 3.0.0-develop.6

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dotnet/.github/workflows/_unit_test.yml +0 -3
  3. package/dotnet/.github/workflows/dotnet-release.yml +0 -3
  4. package/dotnet/.github/workflows/sample-dotnet-build.yml +0 -3
  5. package/mjs/CaseInsensitiveMap.d.ts +12 -0
  6. package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
  7. package/mjs/CaseInsensitiveMap.mjs +33 -0
  8. package/mjs/CaseInsensitiveMap.mjs.map +1 -0
  9. package/mjs/commitlintConfig.d.ts +12 -0
  10. package/mjs/commitlintConfig.d.ts.map +1 -0
  11. package/mjs/commitlintConfig.mjs +13 -0
  12. package/mjs/commitlintConfig.mjs.map +1 -0
  13. package/mjs/debug.d.ts +4 -0
  14. package/mjs/debug.d.ts.map +1 -0
  15. package/mjs/debug.mjs +7 -0
  16. package/mjs/debug.mjs.map +1 -0
  17. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +34 -0
  18. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
  19. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +45 -0
  20. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
  21. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +57 -0
  22. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
  23. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
  24. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
  25. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
  26. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
  27. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +26 -0
  28. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
  29. package/mjs/dotnet/MSBuildProject.d.ts +263 -0
  30. package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
  31. package/mjs/dotnet/MSBuildProject.mjs +444 -0
  32. package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
  33. package/mjs/dotnet/MSBuildProjectProperties.d.ts +169 -0
  34. package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
  35. package/mjs/dotnet/MSBuildProjectProperties.mjs +259 -0
  36. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
  37. package/mjs/dotnet/NugetProjectProperties.d.ts +378 -0
  38. package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
  39. package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
  40. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
  41. package/mjs/dotnet/NugetRegistryInfo.d.ts +382 -0
  42. package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
  43. package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
  44. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
  45. package/mjs/dotnet/helpers.d.ts +95 -0
  46. package/mjs/dotnet/helpers.d.ts.map +1 -0
  47. package/mjs/dotnet/helpers.mjs +351 -0
  48. package/mjs/dotnet/helpers.mjs.map +1 -0
  49. package/mjs/eslintConfig.d.ts +4 -0
  50. package/mjs/eslintConfig.d.ts.map +1 -0
  51. package/mjs/eslintConfig.mjs +98 -0
  52. package/mjs/eslintConfig.mjs.map +1 -0
  53. package/mjs/index.d.ts +3 -0
  54. package/mjs/index.d.ts.map +1 -0
  55. package/mjs/index.mjs +4 -0
  56. package/mjs/index.mjs.map +1 -0
  57. package/mjs/insertPlugins.d.ts +18 -0
  58. package/mjs/insertPlugins.d.ts.map +1 -0
  59. package/mjs/insertPlugins.mjs +73 -0
  60. package/mjs/insertPlugins.mjs.map +1 -0
  61. package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
  62. package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
  63. package/mjs/semantic-release__exec.d.mjs +2 -0
  64. package/mjs/semantic-release__exec.d.mjs.map +1 -0
  65. package/mjs/semantic-release__git.d.mjs +2 -0
  66. package/mjs/semantic-release__git.d.mjs.map +1 -0
  67. package/mjs/semantic-release__github.d.mjs +2 -0
  68. package/mjs/semantic-release__github.d.mjs.map +1 -0
  69. package/mjs/semanticReleaseConfig.d.ts +92 -0
  70. package/mjs/semanticReleaseConfig.d.ts.map +1 -0
  71. package/mjs/semanticReleaseConfig.mjs +63 -0
  72. package/mjs/semanticReleaseConfig.mjs.map +1 -0
  73. package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
  74. package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
  75. package/mjs/semanticReleaseConfigDotnet.mjs +267 -0
  76. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
  77. package/mjs/setupGitPluginSpec.d.ts +22 -0
  78. package/mjs/setupGitPluginSpec.d.ts.map +1 -0
  79. package/mjs/setupGitPluginSpec.mjs +144 -0
  80. package/mjs/setupGitPluginSpec.mjs.map +1 -0
  81. package/mjs/utils/Exact.d.ts +20 -0
  82. package/mjs/utils/Exact.d.ts.map +1 -0
  83. package/mjs/utils/Exact.mjs +75 -0
  84. package/mjs/utils/Exact.mjs.map +1 -0
  85. package/mjs/utils/GracefulRecursion.d.mjs +2 -0
  86. package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
  87. package/mjs/utils/env.d.ts +24 -0
  88. package/mjs/utils/env.d.ts.map +1 -0
  89. package/mjs/utils/env.mjs +39 -0
  90. package/mjs/utils/env.mjs.map +1 -0
  91. package/mjs/utils/execAsync.d.ts +36 -0
  92. package/mjs/utils/execAsync.d.ts.map +1 -0
  93. package/mjs/utils/execAsync.mjs +59 -0
  94. package/mjs/utils/execAsync.mjs.map +1 -0
  95. package/mjs/utils/miscTypes.d.ts +11 -0
  96. package/mjs/utils/miscTypes.d.ts.map +1 -0
  97. package/mjs/utils/miscTypes.mjs +10 -0
  98. package/mjs/utils/miscTypes.mjs.map +1 -0
  99. package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
  100. package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
  101. package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
  102. package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
  103. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
  104. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
  105. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
  106. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
  107. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
  108. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
  109. package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
  110. package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
  111. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
  112. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
  113. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
  114. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
  115. package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
  116. package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
  117. package/mjs/utils/reflection/filterForGetters.mjs +27 -0
  118. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
  119. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
  120. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
  121. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
  122. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
  123. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
  124. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
  125. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
  126. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
  127. package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
  128. package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
  129. package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
  130. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
  131. package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
  132. package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
  133. package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
  134. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
  135. package/mjs/utils/reflection/inheritance.d.ts +180 -0
  136. package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
  137. package/mjs/utils/reflection/inheritance.mjs +148 -0
  138. package/mjs/utils/reflection/inheritance.mjs.map +1 -0
  139. package/mjs/utils/reflection/isConstructor.d.ts +17 -0
  140. package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
  141. package/mjs/utils/reflection/isConstructor.mjs +63 -0
  142. package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
  143. package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
  144. package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
  145. package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
  146. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
  147. package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
  148. package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
  149. package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
  150. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
  151. package/mjs/utils/reflection.d.ts +18 -0
  152. package/mjs/utils/reflection.d.ts.map +1 -0
  153. package/mjs/utils/reflection.mjs +10 -0
  154. package/mjs/utils/reflection.mjs.map +1 -0
  155. package/package.json +6 -4
  156. package/src/insertPlugins.ts +116 -0
  157. package/src/semanticReleaseConfigDotnet.ts +84 -81
@@ -0,0 +1,116 @@
1
+ import type {
2
+ PluginSpec,
3
+ Options as SemanticReleaseOptions,
4
+ } from 'semantic-release';
5
+
6
+ /**
7
+ * @since 3.0.0
8
+ * @deprecated EXPERIMENTAL
9
+ */
10
+ interface PluginInsertRuleSet {
11
+ Id: string;
12
+ BeforeIds: string[];
13
+ AfterIds: string[];
14
+ }
15
+
16
+ /**
17
+ * [W.I.P. STUB]
18
+ *
19
+ * Given an array of {@link PluginInsertRuleSet}s, insert plugins into a
20
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone structured clone}
21
+ * (i.e. deep-copy) of the {@link plugins} array, sort the plugin entries, and
22
+ * return the modified array copy.
23
+ * @todo implement
24
+ * @param plugins Your {@link SemanticReleaseOptions.plugins} array.
25
+ * @param inserts An array of {@link PluginInsertRuleSet}s.
26
+ *
27
+ * If a plugin is already in the plugins array, inserting is skipped. The
28
+ * existing entry is sorted according to its ruleset.
29
+ *
30
+ * If any rulesets conflict, an error will be thrown.
31
+ * - error: A must precede B; B must precede A.
32
+ * - pass: C must precede D and E; D must precede E and follow B. Add ruleset
33
+ * interface: {Id:string, BeforeIds:string[], AfterIds:string[] }
34
+ * @returns A deep-cloned, modified copy of {@link plugins} with plugins
35
+ * inserted and sorted where needed.
36
+ * @since 3.0.0
37
+ * @deprecated EXPERIMENTAL
38
+ */
39
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
40
+ declare function insertAndSortPlugins(
41
+ plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,
42
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
43
+ inserts: PluginInsertRuleSet[]
44
+ ): PluginSpec[];
45
+
46
+ /**
47
+ * @param plugins {@link SemanticReleaseOptions.plugins}
48
+ * @param afterPluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must follow.
49
+ * @param insertPluginIDs The `string` IDs of plugins to insert into a copy of the {@link plugins} array.
50
+ * @param beforePluginsIDs The `string` IDs of plugins that the {@link insertPluginIDs} must precede.
51
+ * @returns
52
+ * A modified copy of {@link plugins} with the given plugins inserted
53
+ * before {@link beforePluginsIDs} and after {@link afterPluginsIDs}.
54
+ *
55
+ * Inserted plugins will be a `[string, {}]` tuple.
56
+ * @throws {ReferenceError} This should never occur. One or more of the
57
+ * {@link afterPluginsIDs} had been found in {@link plugins}, but a `.find` call
58
+ * to get the highest index of the found plugins had returned `undefined`
59
+ * @throws {AggregateError} One or more error occurred when inserting plugins: `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '"' + v + '"').join(', ')}] and before [${beforePluginsIDs.map(v => `"${v}"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`
60
+ */
61
+ export function insertPlugin(
62
+ plugins: Exclude<SemanticReleaseOptions['plugins'], undefined>,
63
+ afterPluginsIDs: string[],
64
+ insertPluginIDs: string[],
65
+ beforePluginsIDs: string[],
66
+ ): PluginSpec[] {
67
+ const pluginIDs = plugins.map(v =>
68
+ typeof v === 'string' ? v : v[0],
69
+ );
70
+
71
+ // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.
72
+
73
+ const indexOfLastAfter = afterPluginsIDs
74
+ .filter(v => pluginIDs.includes(v))
75
+ .map(v => pluginIDs.indexOf(v))
76
+ .sort()
77
+ .find((_v, i, obj) => i === obj.length - 1);
78
+ if (undefined === indexOfLastAfter)
79
+ throw new ReferenceError(
80
+ 'An attempt to get the last element of an array returned undefined.',
81
+ );
82
+
83
+ const indicesOfBefore = beforePluginsIDs
84
+ .filter(v => pluginIDs.includes(v))
85
+ .map(v => pluginIDs.indexOf(v))
86
+ .sort();
87
+
88
+ // This for-of collects *all* sorting errors. The resulting AggregateError
89
+ // notifies the API user of *all* errors in the order rather than just the
90
+ // first error encountered.
91
+ const errors: Error[] = [];
92
+ for (const index of indicesOfBefore) {
93
+ if (index <= indexOfLastAfter) {
94
+ errors.push(
95
+ new Error(
96
+ `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '"' + v + '"').join(', ')}] and before [${beforePluginsIDs.map(v => `"${v}"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,
97
+ ),
98
+ );
99
+ }
100
+ }
101
+ if (errors.length > 0)
102
+ throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');
103
+
104
+ // insert plugin(s)
105
+
106
+ const beforeInsert = plugins.slice(0, indexOfLastAfter + 1);
107
+ const afterInsert = plugins.slice(indexOfLastAfter + 1, plugins.length + 1);
108
+
109
+ return [
110
+ ...beforeInsert,
111
+ ...insertPluginIDs.map(id =>
112
+ [id, {}] as [string, unknown],
113
+ ),
114
+ ...afterInsert,
115
+ ];
116
+ }
@@ -20,7 +20,7 @@ import { getEnvVarValue } from './utils/env.js';
20
20
  import { baseConfig } from './semanticReleaseConfig.js';
21
21
  import { NugetRegistryInfo } from './dotnet/NugetRegistryInfo.js';
22
22
  import { MSBuildProject } from './dotnet/MSBuildProject.js';
23
- import { NPPGetterNames } from './dotnet/NugetProjectProperties.js';
23
+ import { insertPlugin } from './insertPlugins.js';
24
24
 
25
25
  type UnArray<T> = T extends (infer U)[] ? U : T;
26
26
  interface SRConfigDotnetOptions extends Omit<typeof baseConfig, 'plugins'> {
@@ -121,90 +121,85 @@ export class SemanticReleaseConfigDotnet {
121
121
  insertPluginIDs: string[],
122
122
  beforePluginsIDs: string[],
123
123
  ) {
124
- const pluginIDs = this.options.plugins.map(v =>
125
- typeof v === 'string' ? v : v[0],
126
- );
127
-
128
- // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.
129
-
130
- const indexOfLastAfter = afterPluginsIDs
131
- .filter(v => pluginIDs.includes(v))
132
- .map(v => pluginIDs.indexOf(v))
133
- .sort()
134
- .find((_v, i, obj) => i === obj.length - 1);
135
- if (!indexOfLastAfter)
136
- throw new ReferenceError(
137
- 'An attempt to get the last element of an array returned undefined.',
138
- );
139
-
140
- const indicesOfBefore = beforePluginsIDs
141
- .filter(v => pluginIDs.includes(v))
142
- .map(v => pluginIDs.indexOf(v))
143
- .sort();
144
-
145
- // This for-of collects *all* sorting errors. The resulting AggregateError
146
- // notifies the API user of *all* errors in the order rather than just the
147
- // first error encountered.
148
- const errors: Error[] = [];
149
- for (const index of indicesOfBefore) {
150
- if (index <= indexOfLastAfter) {
151
- errors.push(
152
- new Error(
153
- `insertPlugin was instructed to insert one or more plugins after [${afterPluginsIDs.map(v => '"' + v + '"').join(', ')}] and before [${beforePluginsIDs.map(v => `"${v}"`).join(', ')}], but ${JSON.stringify(pluginIDs[indexOfLastAfter])} comes after ${JSON.stringify(pluginIDs[index])}!`,
154
- ),
155
- );
156
- }
157
- }
158
- if (errors.length > 0)
159
- throw new AggregateError(errors, 'One or more errors occurred while inserting plugin configs into the Semantic Release config!');
160
-
161
- // insert plugin(s)
162
- this.options.plugins.splice(
163
- indexOfLastAfter + 1,
164
- 0,
165
- ...insertPluginIDs.map(id =>
166
- [id, {}] as [string, unknown],
167
- ),
168
- );
124
+ this.options.plugins = insertPlugin(this.options.plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs);
169
125
  }
170
126
 
171
127
  /**
172
128
  * generate dotnet commands for \@semantic-release/exec, appending commands with ' && ' when necessary.
173
- * ?todo: change to builder method? e.g. static async SetupDotnetCommands(this: SemanticReleaseConfigDotnet): Promise<SemanticReleaseConfigDotnet>
174
- * @async
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.
175
134
  * @see https://github.com/semantic-release/exec#usage
176
135
  */
177
136
  async setupDotnetCommands(): Promise<void> {
178
- const srExecIndex = this.options.plugins.findIndex(
137
+ let srExecIndex = this.options.plugins.findIndex(
179
138
  v => v[0] === '@semantic-release/exec',
180
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
+
181
148
  const execOptions = this.options.plugins[srExecIndex] as SRExecOptions;
182
149
 
183
- // TODO: move configurePrepareCmd into SemanticReleaseConfigDotnet
184
150
  // ensure all packable projects are evaluated
151
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
185
152
  this._projectsToPackAndPush = await Promise.all(
186
- this.ProjectsToPackAndPush.map(async (v) => {
187
- if (typeof v === 'string') {
188
- const msbp = await MSBuildProject.Evaluate({
189
- FullName: v,
190
- GetItem: [],
191
- GetProperty: [
192
- ...MSBuildProject.MatrixProperties,
193
- ...NPPGetterNames.InstanceGettersRecursive,
194
- ],
195
- GetTargetResult: [],
196
- Property: {},
197
- Targets: ['Restore', 'Pack'],
198
- });
199
-
200
- this._evaluatedProjects.push(msbp);
201
-
202
- return new NugetRegistryInfo({ project: msbp });
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 }));
203
166
  }
204
- else return v;
167
+ else return [project];
205
168
  }),
206
- );
169
+ ).then(p => p.flat()) as NugetRegistryInfo[];
170
+
207
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
+
208
203
  const prepareCmdAppendix = await configurePrepareCmd(
209
204
  this._projectsToPublish,
210
205
  this._projectsToPackAndPush,
@@ -212,7 +207,7 @@ export class SemanticReleaseConfigDotnet {
212
207
 
213
208
  // 'ZipPublishDir' zips each publish folder to ./publish/*.zip
214
209
  execOptions.prepareCmd
215
- = execOptions.prepareCmd !== undefined && execOptions.prepareCmd.length > 0
210
+ = execOptions.prepareCmd && execOptions.prepareCmd.trim().length > 0
216
211
  ? `${execOptions.prepareCmd} && ${prepareCmdAppendix}`
217
212
  : prepareCmdAppendix;
218
213
 
@@ -223,7 +218,7 @@ export class SemanticReleaseConfigDotnet {
223
218
  this._projectsToPackAndPush,
224
219
  );
225
220
  execOptions.publishCmd
226
- = execOptions.publishCmd && execOptions.publishCmd.length > 0
221
+ = execOptions.publishCmd && execOptions.publishCmd.trim().length > 0
227
222
  ? `${execOptions.publishCmd} && ${publishCmdAppendix}`
228
223
  : publishCmdAppendix;
229
224
  }
@@ -338,16 +333,24 @@ export class SemanticReleaseConfigDotnet {
338
333
  }
339
334
 
340
335
  /**
341
- * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet` publish, pack, and push.
342
- * @param projectsToPublish An array of dotnet projects' relative paths.
343
- * If empty, tries getting projects' semi-colon-separated relative
344
- * paths from the `PROJECTS_TO_PUBLISH` environment variable.
345
- * If configured as recommended, the projects' publish outputs will be zipped to
346
- * '$PWD/publish' for use in the `publish` semantic-release step (typically,
347
- * GitHub release).
348
- * @param projectsToPackAndPush An array of dotnet projects' relative paths.
349
- * If empty, `dotnet pack` and `dotnet nuget push` commands will not be configured.
350
- * If undefined, tries getting projects' semi-colon-separated relative paths
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
351
354
  * from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.
352
355
  * With the recommended configuration, `dotnet pack` will write the nupkg/snupkg
353
356
  * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.