@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.
Files changed (310) hide show
  1. package/CHANGELOG.md +452 -101
  2. package/README.md +100 -87
  3. package/dotnet/.github/workflows/_unit_test.yml +3 -3
  4. package/dotnet/.github/workflows/ci.yml +2 -2
  5. package/dotnet/.github/workflows/dotnet-release.yml +28 -28
  6. package/dotnet/.github/workflows/sample-dotnet-build.yml +13 -11
  7. package/dotnet/ExecNupkgDeterministicator.README.md +20 -0
  8. package/dotnet/ExecNupkgDeterministicator.targets +173 -0
  9. package/dotnet/GitVersion.yml +3 -1
  10. package/dotnet/GitVersion6.0.yml +3 -1
  11. package/dotnet/HCE.Shared.sln +34 -0
  12. package/dotnet/HCE.Shared.targets +1 -0
  13. package/dotnet/PublishAll.targets +2 -0
  14. package/dotnet/SignAfterPack.targets +104 -0
  15. package/dotnet/samples/HCE.Shared.DeterministicNupkg/Dummy.cs +6 -0
  16. package/dotnet/samples/HCE.Shared.DeterministicNupkg/HCE.Shared.DeterministicNupkg.csproj +21 -0
  17. package/dotnet/samples/HCE.Shared.SignAfterPack/Class1.cs +6 -0
  18. package/dotnet/samples/HCE.Shared.SignAfterPack/HCE.Shared.SignAfterPack.csproj +21 -0
  19. package/dotnet/samples/HCE.Shared.SignAfterPack/sampleCert.samplepfx +0 -0
  20. package/dotnet/samples/README.md +7 -0
  21. package/mjs/CaseInsensitiveMap.d.ts +12 -0
  22. package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
  23. package/mjs/CaseInsensitiveMap.mjs +33 -0
  24. package/mjs/CaseInsensitiveMap.mjs.map +1 -0
  25. package/mjs/commitlintConfig.d.ts +12 -0
  26. package/mjs/commitlintConfig.d.ts.map +1 -0
  27. package/{cjs/commitlintConfig.cjs → mjs/commitlintConfig.mjs} +3 -4
  28. package/mjs/commitlintConfig.mjs.map +1 -0
  29. package/mjs/debug.d.ts +4 -0
  30. package/{cjs → mjs}/debug.d.ts.map +1 -1
  31. package/mjs/debug.mjs +7 -0
  32. package/mjs/debug.mjs.map +1 -0
  33. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +38 -0
  34. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
  35. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +43 -0
  36. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
  37. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +62 -0
  38. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
  39. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
  40. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
  41. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
  42. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
  43. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +26 -0
  44. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
  45. package/mjs/dotnet/MSBuildProject.d.ts +256 -0
  46. package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
  47. package/mjs/dotnet/MSBuildProject.mjs +447 -0
  48. package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
  49. package/mjs/dotnet/MSBuildProjectProperties.d.ts +170 -0
  50. package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
  51. package/mjs/dotnet/MSBuildProjectProperties.mjs +260 -0
  52. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
  53. package/mjs/dotnet/NugetProjectProperties.d.ts +379 -0
  54. package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
  55. package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
  56. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
  57. package/mjs/dotnet/NugetRegistryInfo.d.ts +384 -0
  58. package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
  59. package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
  60. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
  61. package/mjs/dotnet/helpers.d.ts +63 -0
  62. package/mjs/dotnet/helpers.d.ts.map +1 -0
  63. package/mjs/dotnet/helpers.mjs +354 -0
  64. package/mjs/dotnet/helpers.mjs.map +1 -0
  65. package/mjs/dotnet/index.d.ts +17 -0
  66. package/mjs/dotnet/index.d.ts.map +1 -0
  67. package/mjs/dotnet/index.mjs +9 -0
  68. package/mjs/dotnet/index.mjs.map +1 -0
  69. package/mjs/dotnet.d.ts +3 -0
  70. package/mjs/dotnet.d.ts.map +1 -0
  71. package/mjs/dotnet.mjs +9 -0
  72. package/mjs/dotnet.mjs.map +1 -0
  73. package/mjs/eslintConfig.d.ts +4 -0
  74. package/mjs/eslintConfig.d.ts.map +1 -0
  75. package/mjs/eslintConfig.mjs +98 -0
  76. package/mjs/eslintConfig.mjs.map +1 -0
  77. package/mjs/index.d.ts +3 -0
  78. package/mjs/index.d.ts.map +1 -0
  79. package/mjs/index.mjs +4 -0
  80. package/mjs/index.mjs.map +1 -0
  81. package/mjs/insertPlugins.d.ts +18 -0
  82. package/mjs/insertPlugins.d.ts.map +1 -0
  83. package/mjs/insertPlugins.mjs +73 -0
  84. package/mjs/insertPlugins.mjs.map +1 -0
  85. package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
  86. package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
  87. package/mjs/semantic-release__exec.d.mjs +2 -0
  88. package/mjs/semantic-release__exec.d.mjs.map +1 -0
  89. package/mjs/semantic-release__git.d.mjs +2 -0
  90. package/mjs/semantic-release__git.d.mjs.map +1 -0
  91. package/mjs/semantic-release__github.d.mjs +2 -0
  92. package/mjs/semantic-release__github.d.mjs.map +1 -0
  93. package/mjs/semanticReleaseConfig.d.ts +97 -0
  94. package/mjs/semanticReleaseConfig.d.ts.map +1 -0
  95. package/mjs/semanticReleaseConfig.mjs +63 -0
  96. package/mjs/semanticReleaseConfig.mjs.map +1 -0
  97. package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
  98. package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
  99. package/mjs/semanticReleaseConfigDotnet.mjs +267 -0
  100. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
  101. package/mjs/setupGitPluginSpec.d.ts +22 -0
  102. package/mjs/setupGitPluginSpec.d.ts.map +1 -0
  103. package/mjs/setupGitPluginSpec.mjs +144 -0
  104. package/mjs/setupGitPluginSpec.mjs.map +1 -0
  105. package/mjs/utils/Exact.d.ts +20 -0
  106. package/mjs/utils/Exact.d.ts.map +1 -0
  107. package/mjs/utils/Exact.mjs +75 -0
  108. package/mjs/utils/Exact.mjs.map +1 -0
  109. package/mjs/utils/GracefulRecursion.d.mjs +2 -0
  110. package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
  111. package/mjs/utils/env.d.ts +24 -0
  112. package/mjs/utils/env.d.ts.map +1 -0
  113. package/mjs/utils/env.mjs +39 -0
  114. package/mjs/utils/env.mjs.map +1 -0
  115. package/mjs/utils/execAsync.d.ts +37 -0
  116. package/mjs/utils/execAsync.d.ts.map +1 -0
  117. package/mjs/utils/execAsync.mjs +59 -0
  118. package/mjs/utils/execAsync.mjs.map +1 -0
  119. package/mjs/utils/miscTypes.d.ts +13 -0
  120. package/mjs/utils/miscTypes.d.ts.map +1 -0
  121. package/mjs/utils/miscTypes.mjs +10 -0
  122. package/mjs/utils/miscTypes.mjs.map +1 -0
  123. package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
  124. package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
  125. package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
  126. package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
  127. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
  128. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
  129. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
  130. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
  131. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
  132. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
  133. package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
  134. package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
  135. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
  136. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
  137. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
  138. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
  139. package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
  140. package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
  141. package/mjs/utils/reflection/filterForGetters.mjs +27 -0
  142. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
  143. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
  144. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
  145. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
  146. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
  147. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
  148. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
  149. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
  150. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
  151. package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
  152. package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
  153. package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
  154. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
  155. package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
  156. package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
  157. package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
  158. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
  159. package/mjs/utils/reflection/inheritance.d.ts +180 -0
  160. package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
  161. package/mjs/utils/reflection/inheritance.mjs +148 -0
  162. package/mjs/utils/reflection/inheritance.mjs.map +1 -0
  163. package/mjs/utils/reflection/isConstructor.d.ts +17 -0
  164. package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
  165. package/mjs/utils/reflection/isConstructor.mjs +63 -0
  166. package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
  167. package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
  168. package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
  169. package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
  170. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
  171. package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
  172. package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
  173. package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
  174. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
  175. package/mjs/utils/reflection.d.ts +18 -0
  176. package/mjs/utils/reflection.d.ts.map +1 -0
  177. package/mjs/utils/reflection.mjs +10 -0
  178. package/mjs/utils/reflection.mjs.map +1 -0
  179. package/package.json +77 -78
  180. package/src/CaseInsensitiveMap.ts +34 -0
  181. package/src/commitlintConfig.ts +17 -9
  182. package/src/debug.ts +4 -4
  183. package/src/dotnet/GithubNugetRegistryInfo.ts +68 -0
  184. package/src/dotnet/GitlabNugetRegistryInfo.ts +126 -0
  185. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +44 -0
  186. package/src/dotnet/MSBuildProject.ts +702 -76
  187. package/src/dotnet/MSBuildProjectProperties.ts +281 -15
  188. package/src/dotnet/NugetProjectProperties.ts +609 -0
  189. package/src/dotnet/NugetRegistryInfo.ts +1025 -0
  190. package/src/dotnet/helpers.ts +479 -0
  191. package/src/dotnet/index.ts +17 -0
  192. package/src/dotnet.ts +2 -6
  193. package/src/eslintConfig.ts +174 -71
  194. package/src/index.ts +1 -3
  195. package/src/insertPlugins.ts +116 -0
  196. package/src/semantic-release__commit-analyzer.d.ts +44 -38
  197. package/src/semantic-release__exec.d.ts +15 -0
  198. package/src/semantic-release__git.d.ts +85 -88
  199. package/src/semantic-release__github.d.ts +139 -139
  200. package/src/semanticReleaseConfig.ts +111 -47
  201. package/src/semanticReleaseConfigDotnet.ts +397 -104
  202. package/src/setupGitPluginSpec.ts +153 -58
  203. package/src/tsconfig.json +8 -8
  204. package/src/utils/Exact.ts +49 -0
  205. package/src/utils/GracefulRecursion.d.ts +12 -0
  206. package/src/utils/env.ts +44 -0
  207. package/src/utils/execAsync.ts +89 -0
  208. package/src/utils/miscTypes.ts +18 -0
  209. package/src/utils/reflection/FunctionLike.d.ts +17 -0
  210. package/src/utils/reflection/GetterDescriptor.d.ts +8 -0
  211. package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +32 -0
  212. package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +20 -0
  213. package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +17 -0
  214. package/src/utils/reflection/OwnKeyOf.d.ts +20 -0
  215. package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +82 -0
  216. package/src/utils/reflection/PropertyDescriptorMap.d.ts +15 -0
  217. package/src/utils/reflection/filterForGetters.ts +59 -0
  218. package/src/utils/reflection/getOwnPropertyDescriptors.ts +52 -0
  219. package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +127 -0
  220. package/src/utils/reflection/getPrototypeChainOf.ts +85 -0
  221. package/src/utils/reflection/getPrototypeOf.ts +12 -0
  222. package/src/utils/reflection/inheritance.ts +262 -0
  223. package/src/utils/reflection/isConstructor.ts +74 -0
  224. package/src/utils/reflection/isGetterDescriptor.ts +11 -0
  225. package/src/utils/reflection/listOwnGetters.ts +80 -0
  226. package/src/utils/reflection.ts +18 -0
  227. package/cjs/commitlintConfig-wrapper.mjs +0 -6
  228. package/cjs/commitlintConfig.cjs.map +0 -1
  229. package/cjs/commitlintConfig.d.ts +0 -4
  230. package/cjs/commitlintConfig.d.ts.map +0 -1
  231. package/cjs/debug.cjs +0 -13
  232. package/cjs/debug.cjs.map +0 -1
  233. package/cjs/debug.d.ts +0 -4
  234. package/cjs/dotnet/MSBuildProject.cjs +0 -84
  235. package/cjs/dotnet/MSBuildProject.cjs.map +0 -1
  236. package/cjs/dotnet/MSBuildProject.d.ts +0 -42
  237. package/cjs/dotnet/MSBuildProject.d.ts.map +0 -1
  238. package/cjs/dotnet/MSBuildProjectProperties.cjs +0 -22
  239. package/cjs/dotnet/MSBuildProjectProperties.cjs.map +0 -1
  240. package/cjs/dotnet/MSBuildProjectProperties.d.ts +0 -13
  241. package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +0 -1
  242. package/cjs/dotnet/createDummyNupkg.cjs +0 -26
  243. package/cjs/dotnet/createDummyNupkg.cjs.map +0 -1
  244. package/cjs/dotnet/createDummyNupkg.d.ts +0 -2
  245. package/cjs/dotnet/createDummyNupkg.d.ts.map +0 -1
  246. package/cjs/dotnet/dotnetGHPR.cjs +0 -173
  247. package/cjs/dotnet/dotnetGHPR.cjs.map +0 -1
  248. package/cjs/dotnet/dotnetGHPR.d.ts +0 -37
  249. package/cjs/dotnet/dotnetGHPR.d.ts.map +0 -1
  250. package/cjs/dotnet/dotnetGLPR.cjs +0 -41
  251. package/cjs/dotnet/dotnetGLPR.cjs.map +0 -1
  252. package/cjs/dotnet/dotnetGLPR.d.ts +0 -13
  253. package/cjs/dotnet/dotnetGLPR.d.ts.map +0 -1
  254. package/cjs/dotnet/dotnetHelpers.cjs +0 -141
  255. package/cjs/dotnet/dotnetHelpers.cjs.map +0 -1
  256. package/cjs/dotnet/dotnetHelpers.d.ts +0 -26
  257. package/cjs/dotnet/dotnetHelpers.d.ts.map +0 -1
  258. package/cjs/dotnet-wrapper.mjs +0 -6
  259. package/cjs/dotnet.cjs +0 -15
  260. package/cjs/dotnet.cjs.map +0 -1
  261. package/cjs/dotnet.d.ts +0 -7
  262. package/cjs/dotnet.d.ts.map +0 -1
  263. package/cjs/envUtils-wrapper.mjs +0 -6
  264. package/cjs/envUtils.cjs +0 -37
  265. package/cjs/envUtils.cjs.map +0 -1
  266. package/cjs/envUtils.d.ts +0 -15
  267. package/cjs/envUtils.d.ts.map +0 -1
  268. package/cjs/eslintConfig-wrapper.mjs +0 -6
  269. package/cjs/eslintConfig.cjs +0 -52
  270. package/cjs/eslintConfig.cjs.map +0 -1
  271. package/cjs/eslintConfig.d.ts +0 -3
  272. package/cjs/eslintConfig.d.ts.map +0 -1
  273. package/cjs/findStaticConfig-wrapper.mjs +0 -6
  274. package/cjs/findStaticConfig.cjs +0 -34
  275. package/cjs/findStaticConfig.cjs.map +0 -1
  276. package/cjs/findStaticConfig.d.ts +0 -2
  277. package/cjs/findStaticConfig.d.ts.map +0 -1
  278. package/cjs/index-wrapper.mjs +0 -6
  279. package/cjs/index.cjs +0 -10
  280. package/cjs/index.cjs.map +0 -1
  281. package/cjs/index.d.ts +0 -5
  282. package/cjs/index.d.ts.map +0 -1
  283. package/cjs/semantic-release__commit-analyzer.d.cjs +0 -2
  284. package/cjs/semantic-release__commit-analyzer.d.cjs.map +0 -1
  285. package/cjs/semantic-release__git.d.cjs +0 -2
  286. package/cjs/semantic-release__git.d.cjs.map +0 -1
  287. package/cjs/semantic-release__github.d.cjs +0 -2
  288. package/cjs/semantic-release__github.d.cjs.map +0 -1
  289. package/cjs/semanticReleaseConfig-wrapper.mjs +0 -6
  290. package/cjs/semanticReleaseConfig.cjs +0 -33
  291. package/cjs/semanticReleaseConfig.cjs.map +0 -1
  292. package/cjs/semanticReleaseConfig.d.ts +0 -4
  293. package/cjs/semanticReleaseConfig.d.ts.map +0 -1
  294. package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +0 -7
  295. package/cjs/semanticReleaseConfigDotnet.cjs +0 -112
  296. package/cjs/semanticReleaseConfigDotnet.cjs.map +0 -1
  297. package/cjs/semanticReleaseConfigDotnet.d.ts +0 -51
  298. package/cjs/semanticReleaseConfigDotnet.d.ts.map +0 -1
  299. package/cjs/setupGitPluginSpec-wrapper.mjs +0 -6
  300. package/cjs/setupGitPluginSpec.cjs +0 -67
  301. package/cjs/setupGitPluginSpec.cjs.map +0 -1
  302. package/cjs/setupGitPluginSpec.d.ts +0 -19
  303. package/cjs/setupGitPluginSpec.d.ts.map +0 -1
  304. package/src/dotnet/createDummyNupkg.ts +0 -30
  305. package/src/dotnet/dotnetGHPR.ts +0 -232
  306. package/src/dotnet/dotnetGLPR.ts +0 -46
  307. package/src/dotnet/dotnetHelpers.ts +0 -184
  308. package/src/envUtils.ts +0 -36
  309. package/src/findStaticConfig.ts +0 -31
  310. package/static/.releaserc.yml +0 -35
@@ -0,0 +1,479 @@
1
+ import { type } from 'arktype';
2
+ import path from 'node:path';
3
+ import { cwd } from 'node:process';
4
+ import { MSBuildProject } from './MSBuildProject.js';
5
+ import { MSBuildProjectProperties as MSBPP } from './MSBuildProjectProperties.js';
6
+ import { NugetRegistryInfo } from './NugetRegistryInfo.js';
7
+ import type { Default } from 'arktype/internal/attributes.ts';
8
+ import type { ObjectType } from 'arktype/internal/methods/object.ts';
9
+
10
+ const ourDefaultPubDir = path.join('.', 'publish') as `.${'/' | '\\'}publish`;
11
+
12
+ /**
13
+ * Build a prepareCmd string from .NET projects.\
14
+ * This will include a `dotnet publish` for each project's RID and TFM permutation,\
15
+ * `dotnet pack` for each project with output paths separated by NuGet Source and PackageId,\
16
+ * and `dotnet nuget sign` for each nupkg output directory.
17
+ * @todo parse Solution files to publish all projects with default Publish parameters (as evaluated by MSBuild).
18
+ * @param projectsToPublish An array of relative or full file paths of `.csproj`
19
+ * projects -OR- an array of {@link MSBuildProject} objects.
20
+ * The project paths will be passed to `dotnet publish` commands.
21
+ * @param projectsToPackAndPush
22
+ * Relative and/or full file paths of projects to pass to `dotnet pack`. If
23
+ * string[], only the default NuGet Source will be used. If GitHub, GitLab,
24
+ * etc. are also desired, pass {@link NugetRegistryInfo}[]
25
+ * @param dotnetNugetSignOpts A {@link DotnetNugetSignOptions} object. The value
26
+ * of the `--output` argument will be set to {@link ourDefaultPubDir} if `undefined`.
27
+ * @returns A single string of CLI commands joined by ' && '
28
+ */
29
+ export async function configurePrepareCmd(
30
+ projectsToPublish: string[] | MSBuildProject[],
31
+ projectsToPackAndPush?: string[] | NugetRegistryInfo[],
32
+ dotnetNugetSignOpts?: typeof DotnetNugetSignOptions.inferIn,
33
+ ): Promise<string> {
34
+ const evaluatedProjects: MSBuildProject[] = [];
35
+
36
+ // append evaluated projects
37
+ for (const p of projectsToPublish.filter(p => p instanceof MSBuildProject)) {
38
+ evaluatedProjects.push(p);
39
+ }
40
+ if (projectsToPackAndPush) {
41
+ for (const p of projectsToPackAndPush.filter(p => p instanceof NugetRegistryInfo)) {
42
+ evaluatedProjects.push(p.project);
43
+ }
44
+ }
45
+
46
+ const dotnetPublishCmd: string = await formatDotnetPublish(projectsToPublish);
47
+ const dotnetPackCmd: string | undefined = await formatDotnetPack(projectsToPackAndPush ?? []);
48
+ const dotnetNugetSignCmd: string | undefined = formatDotnetNugetSign(dotnetNugetSignOpts);
49
+
50
+ return [
51
+ dotnetPublishCmd,
52
+ dotnetPackCmd,
53
+ dotnetNugetSignCmd,
54
+ // remove no-op commands
55
+ ]
56
+ .filter(v => v !== undefined)
57
+ .join(' && ');
58
+
59
+ /**
60
+ * Create a string of CLI commands to run `dotnet publish` or the Publish
61
+ * MSBuild target for one or more projects.
62
+ * @async
63
+ * @param projectsToPublish An array of one or more projects, either
64
+ * pre-evaluated (see {@link MSBuildProject.Evaluate}) or as full file paths.\
65
+ * NOTE: Although `dotnet publish` allows directory or Solution file (.sln,
66
+ * .slnx) paths, this function expects projects' full or relative file
67
+ * paths.
68
+ * @returns A Promise of a string. This string contains one or more `dotnet publish`
69
+ * commands conjoined by " && ". It may also include one or more
70
+ * `dotnet msbuild ${...} -t:PublishAll` commands.
71
+ */
72
+ async function formatDotnetPublish(
73
+ projectsToPublish: string[] | MSBuildProject[],
74
+ ): Promise<string> {
75
+ /* Fun Fact: You can define a property and get the evaluated value in the same command!
76
+ ```pwsh
77
+ dotnet msbuild .\src\HXE.csproj -property:RuntimeIdentifiers="""place;holder""" -getProperty:RuntimeIdentifiers
78
+ place;holder
79
+ ```
80
+ enclosing with """ is required in pwsh to prevent the semicolon from breaking the string.
81
+ */
82
+ if (!Array.isArray(projectsToPublish) || projectsToPublish.length === 0) {
83
+ throw new Error(
84
+ `Type of projectsToPublish (${typeof projectsToPublish}) is not allowed. Expected a string[] or MSBuildProject[] where length > 0.`,
85
+ );
86
+ }
87
+
88
+ // each may have TargetFramework OR TargetFrameworks (plural)
89
+ const evaluatedPublishProjects: MSBuildProject[] = await Promise.all(
90
+ projectsToPublish.map(async (proj): Promise<MSBuildProject> => {
91
+ if (proj instanceof MSBuildProject)
92
+ return proj;
93
+
94
+ // filter for projects whose full paths match the full path of the given string
95
+ const filteredProjects = evaluatedProjects.filter(p =>
96
+ p.Properties.MSBuildProjectFullPath === MSBPP.GetFullPath(proj),
97
+ );
98
+
99
+ // if no pre-existing MSBuildProject found,
100
+ // evaluate a new one and push it
101
+ if (filteredProjects.length === 0) {
102
+ const _proj = await MSBuildProject.Evaluate({
103
+ FullName: proj,
104
+ GetProperty: MSBuildProject.MatrixProperties,
105
+ GetItem: [],
106
+ GetTargetResult: [],
107
+ Property: {},
108
+ Targets: ['Restore'],
109
+ });
110
+ evaluatedProjects.push(_proj);
111
+ return _proj;
112
+ }
113
+
114
+ /**
115
+ * Finds and returns the subjectively "best" project in {@link filteredProjects}
116
+ * @returns the subjective "best" project in {@link filteredProjects}
117
+ */
118
+ function getBest() {
119
+ let best: MSBuildProject | undefined;
120
+ if (filteredProjects.length > 0 && (best = filteredProjects[0]) instanceof MSBuildProject)
121
+ return best;
122
+ throw new Error('No MSBuildProjects could be found!');
123
+ }
124
+
125
+ /*
126
+ todo: improve filtering to select "optimal" instance.
127
+ Which properties are most-needed?
128
+ For now, we just pray the project has a well-defined publish flow e.g.
129
+ @halospv3/hce.shared-config/dotnet/PublishAll.targets
130
+ */
131
+ return getBest();
132
+ }),
133
+ );
134
+
135
+ /**
136
+ * Returns an array of one or more `dotnet` arguments.
137
+ * @param proj An {@link MSBuildProject} to be published for one or more
138
+ * runtime-framework combinations.
139
+ * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...
140
+ * ```
141
+ * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll`]
142
+ * ```
143
+ * Else, an array of `dotnet publish` arguments permutations e.g.
144
+ * ```
145
+ * [
146
+ * 'myProj.csproj --runtime win7-x86 --framework net6.0',
147
+ * 'myProj.csproj --runtime win7-x64 --framework net6.0'
148
+ * ]
149
+ * ```
150
+ * @example
151
+ * const publishCmdArray = [];
152
+ * const permutations = getPublishArgsPermutations(msbuildProject);
153
+ * for (const permutation of permutations) {
154
+ * if (permutation[0] === 'PublishAll') {
155
+ * // 'dotnet msbuild full/path/to/myProj.csproj t:PublishAll'
156
+ * publishCmdArray.push(`dotnet msbuild ${permutation[1]}`)
157
+ * }
158
+ * else {
159
+ * publishCmdArray.push(`dotnet publish ${permutation}`)
160
+ * }
161
+ * }
162
+ * // return array as success-chained CLI commands.
163
+ * return publishCmdArray.join(' && ');
164
+ */
165
+ function getPublishArgsPermutations(proj: MSBuildProject):
166
+ ([`"${typeof proj.Properties.MSBuildProjectFullPath}" -t:PublishAll`])
167
+ | ([`"${typeof proj.Properties.MSBuildProjectFullPath}"`])
168
+ | (`"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string} --framework ${string}`)[]
169
+ | (`"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string}`)[]
170
+ | (`"${typeof proj.Properties.MSBuildProjectFullPath}" --framework ${string}`)[] {
171
+ /**
172
+ * If the project imports PublishAll to publish for each TFM-RID
173
+ * permutation, return the appropriate command line.
174
+ */
175
+ if (proj.Targets.includes('PublishAll'))
176
+ return [`"${proj.Properties.MSBuildProjectFullPath}" -t:PublishAll`];
177
+
178
+ // #region formatFrameworksAndRuntimes
179
+ const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]
180
+ | `--runtime ${string}`[]
181
+ | `--framework ${string}`[]
182
+ = []; // forEach, run dotnet [proj.Properties.MSBuildProjectFullPath,...v]
183
+ const RIDs: string[] = proj.Properties.RuntimeIdentifiers.split(';').filter(v => v !== '');
184
+ const TFMs: string[] = proj.Properties.TargetFrameworks.split(';').filter(v => v !== '');
185
+
186
+ if (TFMs.length === 0 && RIDs.length === 0)
187
+ return [`"${proj.Properties.MSBuildProjectFullPath}"`] as [`"${string}"`];
188
+
189
+ if (RIDs.length > 0) {
190
+ if (TFMs.length > 0) {
191
+ for (const RID of RIDs) {
192
+ for (const TFM of TFMs) {
193
+ (tfmRidPermutations as `--runtime ${string} --framework ${string}`[]).push(
194
+ `--runtime ${RID} --framework ${TFM}`,
195
+ );
196
+ }
197
+ }
198
+ }
199
+ else {
200
+ // assume singular TFM. No need to specify it.
201
+ for (const RID of RIDs) {
202
+ (tfmRidPermutations as `--runtime ${string}`[]).push(
203
+ `--runtime ${RID}`,
204
+ );
205
+ }
206
+ }
207
+ }
208
+ else if (TFMs.length > 0) {
209
+ for (const TFM of TFMs) {
210
+ (tfmRidPermutations as `--framework ${string}`[]).push(`--framework ${TFM}`);
211
+ }
212
+ }
213
+
214
+ /** prepend each set of args with the project's path */
215
+ return tfmRidPermutations.map(permArgs =>
216
+ `"${proj.Properties.MSBuildProjectFullPath}" ${permArgs}`,
217
+ ) as `"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string} --framework ${string}`[]
218
+ | `"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string}`[]
219
+ | `"${typeof proj.Properties.MSBuildProjectFullPath}" --framework ${string}`[];
220
+ // #endregion formatFrameworksAndRuntimes
221
+ }
222
+
223
+ const publishCmds: (`dotnet publish "${string}"` | `dotnet publish "${string}" ${string}` | `dotnet msbuild "${string}" -t:PublishAll`)[] = [];
224
+ /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */
225
+ const argsSets = evaluatedPublishProjects.map(
226
+ proj => getPublishArgsPermutations(proj),
227
+ );
228
+ for (const args of argsSets) {
229
+ if (typeof args === 'string')
230
+ throw new Error(`\`args\` should not be a string!`);
231
+ for (const permutation of args) {
232
+ if (typeof permutation === 'string' && permutation.length === 1)
233
+ throw new Error('Something has gone terribly wrong. A `dotnet publish` argument set was split to single characters!');
234
+ publishCmds.push(`dotnet publish ${permutation}`);
235
+ }
236
+ }
237
+
238
+ // For each argSet, create a new exec command. Then, join all commands with ' && ' so they are executed serially, synchronously.
239
+ // e.g. `dotnet publish project.csproj --runtime win7-x86 --framework net6.0 && dotnet publish project.csproj --runtime win-x64 --framework net8.0
240
+ return publishCmds.join(' && ');
241
+ }
242
+
243
+ /**
244
+ * @param projectsToPackAndPush a string[] or {@link NugetRegistryInfo}[].
245
+ * If a string[], the string must be the platform-dependent (not file://),
246
+ * full path(s) to one or more projects with the .NET "Pack" MSBuild target.
247
+ * See {@link https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack}
248
+ * for command line usage.
249
+ * @returns one or more command line strings joined with ' && '.
250
+ * Each command line comprises the `dotnet pack` command, a project file path,
251
+ * and a hardcoded output path (`--output ${cwd()}/publish`)
252
+ */
253
+ async function formatDotnetPack(
254
+ projectsToPackAndPush: string[] | NugetRegistryInfo[],
255
+ ): Promise<string | undefined> {
256
+ if (projectsToPackAndPush.length === 0)
257
+ return undefined;
258
+ return await Promise.all(
259
+ projectsToPackAndPush.map(async (proj) => {
260
+ if (proj instanceof NugetRegistryInfo)
261
+ return proj;
262
+
263
+ const msbpArr: MSBuildProject[] = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([proj]));
264
+ if (msbpArr.length === 0 || msbpArr[0] === undefined) {
265
+ throw new Error('This should be impossible!');
266
+ }
267
+ const msbp: MSBuildProject = msbpArr[0];
268
+
269
+ evaluatedProjects.push(msbp);
270
+
271
+ return new NugetRegistryInfo({ project: msbp });
272
+ }),
273
+ ).then((nriArray: NugetRegistryInfo[]): string => {
274
+ return nriArray
275
+ .map((nri: NugetRegistryInfo): string =>
276
+ nri.GetPackCommand(NugetRegistryInfo.PackPackagesOptionsType.from({})),
277
+ ).join(' && ');
278
+ });
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Prepare the CLI command to push NuGet packages. This should added to the `publishCmd` option of `@semantic-release/exec`
284
+ *
285
+ * Ensure your verifyConditionsCmd is set to prevent releases failing due to bad tokens or packages!
286
+ * See {@link NugetRegistryInfo#PackDummyPackage}, {@link NugetRegistryInfo#GetPushDummyCommand}
287
+ * @param registryInfos an array of {@link NugetRegistryInfo} (or derived classes) instances.
288
+ * @param packageOutputPath Default: `${cwd()}/publish`.\
289
+ * The directory at which dotnet outputs the given projects' packages. Passed to
290
+ * `dotnet pack` via the `--output` argument.
291
+ * @returns a string of `dotnet pack` and `dotnet push` commands, joined by ' && '.
292
+ */
293
+ export function configureDotnetNugetPush(
294
+ registryInfos: NugetRegistryInfo[],
295
+ // Explicit type required by JSR
296
+ // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
+ packageOutputPath: string = `${cwd()}/publish`,
298
+ ): string {
299
+ if (registryInfos.some(registry => registry.source.trim() === ''))
300
+ throw new Error('The URL for one of the provided NuGet registries was empty or whitespace.');
301
+
302
+ const packCmds = registryInfos.map(
303
+ (nri): string =>
304
+ nri.GetPackCommand(
305
+ { output: packageOutputPath },
306
+ true,
307
+ true,
308
+ ),
309
+ );
310
+
311
+ const pushCmds = registryInfos.map(nri => nri.GetPushCommand({ root: packageOutputPath }, true, true));
312
+
313
+ return [...packCmds, ...pushCmds].join(' && ');
314
+ }
315
+
316
+ /**
317
+ * You should try {@link ../../dotnet/SignAfterPack.targets}!.
318
+ * @param opts A {@link DotnetNugetSignOptions} object to be deconstructed and
319
+ * passed to `dotnet nuget sign` as args.
320
+ * @returns `dotnet nuget sign {...}`
321
+ */
322
+ function formatDotnetNugetSign(
323
+ opts: typeof DotnetNugetSignOptions.inferIn | undefined,
324
+ ): string | undefined {
325
+ if (opts === undefined)
326
+ return undefined;
327
+
328
+ const validOpts = DotnetNugetSignOptions.from(opts);
329
+ const args: ['--timestamper', typeof validOpts.timestamper, '-o', string, ...string[]] = [
330
+ '--timestamper', validOpts.timestamper,
331
+ '-o', validOpts.output ?? ourDefaultPubDir,
332
+ ];
333
+ if (validOpts.certificatePassword)
334
+ args.push('---certificate-password', validOpts.certificatePassword);
335
+ if (validOpts.hashAlgorithm)
336
+ args.push('--hash-algorithm', validOpts.hashAlgorithm);
337
+ if (validOpts.overwrite)
338
+ args.push('--overwrite');
339
+ if (validOpts.timestampHashAlgorithm)
340
+ args.push('--timestamp-hash-algorithm', validOpts.timestampHashAlgorithm);
341
+ if (validOpts.verbosity)
342
+ args.push('-v', validOpts.verbosity);
343
+
344
+ if ('certificatePath' in validOpts)
345
+ args.push('--certificate-path', validOpts.certificatePath);
346
+ else if ('certificateStoreName' in validOpts) {
347
+ SetSubjectNameOrFingerprint();
348
+ args.push('--certificate-store-name', validOpts.certificateStoreName);
349
+ }
350
+ else if ('certificateStoreLocation' in validOpts) {
351
+ SetSubjectNameOrFingerprint();
352
+ args.push('--certificate-store-location', validOpts.certificateStoreLocation);
353
+ }
354
+ else throw new Error('No code signing certificate was specified!');
355
+
356
+ return `dotnet nuget sign ${args.join(' ')} `;
357
+
358
+ // eslint-disable-next-line jsdoc/require-jsdoc
359
+ function SetSubjectNameOrFingerprint() {
360
+ if ('certificateSubjectName' in validOpts)
361
+ args.push('--certificate-subject-name', validOpts.certificateSubjectName);
362
+
363
+ else if ('certificateFingerprint' in validOpts)
364
+ args.push('--certificate-fingerprint', validOpts.certificateFingerprint);
365
+ else throw new Error('If certificateStoreName or certificateStoreLocation is set, either certificateSubjectName or certificateFingerprint must also be set!');
366
+ }
367
+ }
368
+
369
+ const DotnetNugetSignOptions: ObjectType<
370
+ {
371
+ timestamper: Default<string, 'https://rfc3161.ai.moda/'>;
372
+ certificatePassword?: string | undefined;
373
+ hashAlgorithm?: string | undefined;
374
+ output?: string | undefined;
375
+ overwrite?: true | undefined;
376
+ timestampHashAlgorithm?: string | undefined;
377
+ verbosity?: 'q' | 'quiet' | 'm' | 'minimal' | 'n' | 'normal' | 'd' | 'detailed' | 'diag' | 'diagnostic';
378
+ } & ({
379
+ certificatePath: string;
380
+ certificateSubjectName: string;
381
+ } | {
382
+ certificatePath: string;
383
+ certificateFingerprint: string;
384
+ } | {
385
+ certificateStoreName: string;
386
+ certificateSubjectName: string;
387
+ } | {
388
+ certificateStoreName: string;
389
+ certificateFingerprint: string;
390
+ } | {
391
+ certificateStoreLocation: string;
392
+ certificateSubjectName: string;
393
+ } | {
394
+ certificateStoreLocation: string;
395
+ certificateFingerprint: string;
396
+ })> = type({
397
+ /**
398
+ * Password for the certificate, if needed. This option can be used to specify
399
+ * the password for the certificate. The command will throw an error message
400
+ * if certificate is password protected but password is not provided as input.
401
+ */
402
+ 'certificatePassword?': 'string',
403
+ /**
404
+ * Hash algorithm to be used to sign the package. Defaults to SHA256.
405
+ */
406
+ 'hashAlgorithm?': 'string | "SHA256"',
407
+ /**
408
+ * Directory where the signed package(s) should be saved. By default the
409
+ * original package is overwritten by the signed package.
410
+ */
411
+ 'output?': 'string',
412
+ /**
413
+ * Switch to indicate if the current signature should be overwritten. By
414
+ * default the command will fail if the package already has a signature.
415
+ */
416
+ 'overwrite?': 'true',
417
+ /**
418
+ * URL to an RFC 3161 timestamping server.
419
+ */
420
+ timestamper: 'string = "https://rfc3161.ai.moda/"',
421
+ /**
422
+ * Hash algorithm to be used to sign the package. Defaults to SHA256.
423
+ */
424
+ 'timestampHashAlgorithm?': 'string | "SHA256"',
425
+ /**
426
+ * Set the verbosity level of the command. Allowed values are q[uiet],
427
+ * m[inimal], n[ormal], d[etailed], and diag[nostic].
428
+ */
429
+ 'verbosity?': '"q"|"quiet"|"m"|"minimal"|"n"|"normal"|"d"|"detailed"|"diag"|"diagnostic"',
430
+ }).and(
431
+ type({
432
+ /**
433
+ * File path to the certificate to be used while signing the package.
434
+ */
435
+ certificatePath: 'string',
436
+ }).or(
437
+ type({
438
+ /**
439
+ * Name of the X.509 certificate store to use to search for the
440
+ * certificate. Defaults to "My", the X.509 certificate store for personal
441
+ * certificates.
442
+ *
443
+ * This option should be used when specifying the certificate via
444
+ * --certificate-subject-name or --certificate-fingerprint options.
445
+ */
446
+ certificateStoreName: 'string',
447
+ }).or({
448
+ /**
449
+ * Name of the X.509 certificate store use to search for the
450
+ * certificate. Defaults to "CurrentUser", the X.509 certificate store
451
+ * used by the current user.
452
+ *
453
+ * This option should be used when specifying the certificate via
454
+ * --certificate-subject-name or --certificate-fingerprint options.
455
+ */
456
+ certificateStoreLocation: 'string',
457
+ }),
458
+ ).and(
459
+ type({
460
+ /**
461
+ * Subject name of the certificate used to search a local certificate
462
+ * store for the certificate. The search is a case-insensitive string
463
+ * comparison using the supplied value, which will find all certificates
464
+ * with the subject name containing that string, regardless of other
465
+ * subject values. The certificate store can be specified by
466
+ * --certificate-store-name and --certificate-store-location options.
467
+ */
468
+ certificateSubjectName: 'string',
469
+ }).or({
470
+ /**
471
+ * SHA-256, SHA-384 or SHA-512 fingerprint of the certificate used to
472
+ * search a local certificate store for the certificate. The certificate
473
+ * store can be specified by --certificate-store-name and
474
+ * --certificate-store-location options.
475
+ */
476
+ certificateFingerprint: 'string',
477
+ }),
478
+ ),
479
+ );
@@ -0,0 +1,17 @@
1
+ export type * from './GithubNugetRegistryInfo.js';
2
+ export type * from './GitlabNugetRegistryInfo.js';
3
+ export type * from './helpers.js';
4
+ export type * from './IsNextVersionAlreadyPublished.cli.js';
5
+ export type * from './MSBuildProject.js';
6
+ export type * from './MSBuildProjectProperties.js';
7
+ export type * from './NugetProjectProperties.js';
8
+ export type * from './NugetRegistryInfo.js';
9
+
10
+ export * from './GithubNugetRegistryInfo.js';
11
+ export * from './GitlabNugetRegistryInfo.js';
12
+ export * from './helpers.js';
13
+ export * from './IsNextVersionAlreadyPublished.cli.js';
14
+ export * from './MSBuildProject.js';
15
+ export * from './MSBuildProjectProperties.js';
16
+ export * from './NugetProjectProperties.js';
17
+ export * from './NugetRegistryInfo.js';
package/src/dotnet.ts CHANGED
@@ -1,6 +1,2 @@
1
- export * as msbuildProject from "./dotnet/MSBuildProject.js"
2
- export * as msbuildProjectProperties from "./dotnet/MSBuildProjectProperties.js"
3
- export * as createDummyNupkg from './dotnet/createDummyNupkg.js'
4
- export * as dotnetGHPR from "./dotnet/dotnetGHPR.js"
5
- export * as dotnetGLPR from "./dotnet/dotnetGLPR.js"
6
- export * as dotnetHelpers from "./dotnet/dotnetHelpers.js"
1
+ export type * from './dotnet/index.js';
2
+ export * from './dotnet/index.js';