@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
@@ -1,28 +1,294 @@
1
+ import { strictEqual } from 'node:assert/strict';
1
2
  import { existsSync } from 'node:fs';
2
- import { basename, isAbsolute, resolve } from 'node:path';
3
+ import node_path from 'node:path';
4
+ import { CaseInsensitiveMap } from '../CaseInsensitiveMap.js';
5
+ import type { BaseClass, ClassLike } from '../utils/reflection.js';
3
6
 
4
7
  /**
5
8
  * Known properties. Additional properties may be added upon request.
9
+ *
10
+ * todo: add Reserved properties, Well-Known properties, Common properties, and more. Maybe as sub classes.
11
+ * See:
12
+ * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2022 MSBuild Reserved and Well-known Properties}
13
+ * - {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 Common MSBuild project properties}
14
+ * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props Microsoft.NET.Sdk}
15
+ * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/web-sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json#properties Microsoft.NET.Sdk.Web}
16
+ * - {@link https://learn.microsoft.com/en-us/aspnet/core/razor-pages/sdk?view=aspnetcore-8.0&toc=%2Fdotnet%2Fnavigate%2Ftools-diagnostics%2Ftoc.json&bc=%2Fdotnet%2Fbreadcrumb%2Ftoc.json Microsoft.NET.Sdk.Razor}
17
+ * - {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props-desktop Microsoft.NET.Sdk.Desktop}
6
18
  */
7
19
  export class MSBuildProjectProperties {
8
- [Property: string]: string;
20
+ // #region static
9
21
 
10
- FullPath = '';
22
+ /**
23
+ * Resolve the given path if it is not absolute. If the path exists, it is returned. Else, an Error is thrown.
24
+ * @param path The full file path of an MSBuild project.
25
+ * @returns The absolute path to the MSBuild project file.
26
+ * @throws {Error} if the path cannot be resolved to an existing file.
27
+ */
28
+ static GetFullPath(path: string): string {
29
+ if (!node_path.isAbsolute(path))
30
+ path = node_path.resolve(path);
31
+ if (!existsSync(path))
32
+ throw new Error(`${node_path.basename(path)} could not be found at "${path}"`);
33
+ return path;
34
+ }
11
35
 
12
- TargetFramework = '';
36
+ /**
37
+ * Note: This method may remove elements from {@link properties}.\
38
+ * Try to get an element from {@link properties} by its {@link key}.
39
+ * If an element is found, it is removed and the value of the element is returned.
40
+ * Otherwise, `undefined` is returned.
41
+ * @param properties The CaseInsensitiveMap of properties passed to the constructor.
42
+ * @param key The key of the property to get from {@link properties}
43
+ * @returns If found, the value of the `[string, string]` tuple found in {@link properties}. Else, `undefined`.
44
+ */
45
+ protected static getAndForget(
46
+ properties: CaseInsensitiveMap<string, string>,
47
+ key: string,
48
+ ): string | undefined {
49
+ const v: string | undefined = properties.get(key);
50
+ if (v !== undefined)
51
+ properties.delete(key);
52
+ return v;
53
+ }
13
54
 
14
- TargetFrameworks = '';
55
+ // #endregion static
56
+ // #endregion static
15
57
 
16
- RuntimeIdentifier = '';
58
+ // #region private
59
+ private _msbuildProjectFullPath: string | undefined;
60
+ private _assemblyName: string | undefined;
61
+ private _baseIntermediateOutputPath: string | undefined;
62
+ private _baseOutputPath: string | undefined;
63
+ private _description: string | undefined;
64
+ private _intermediateOutputPath: string | undefined;
65
+ private _outDir: string | undefined;
66
+ private _outputPath: string | undefined;
67
+ private _runtimeIdentifier: string | undefined;
68
+ private _runtimeIdentifiers: string | undefined;
69
+ private _targetFramework: string | undefined;
70
+ private _targetFrameworks: string | undefined;
71
+ private _version: string | undefined;
72
+ private _versionPrefix: string | undefined;
73
+ private _versionSuffix: string | undefined;
74
+ // #endregion private
17
75
 
18
- RuntimeIdentifiers = '';
76
+ constructor(
77
+ msbuildProjectFullPath: string,
78
+ properties: CaseInsensitiveMap<string, string>,
79
+ ) {
80
+ // runtime type checks
81
+ strictEqual(
82
+ typeof msbuildProjectFullPath,
83
+ 'string',
84
+ new TypeError(
85
+ `msbuildProjectFullPath should be a string, not ${typeof msbuildProjectFullPath}!`,
86
+ ),
87
+ );
88
+ strictEqual(
89
+ properties instanceof CaseInsensitiveMap,
90
+ true,
91
+ `arg 'properties' should be instanceof ${CaseInsensitiveMap.name}`,
92
+ );
93
+ strictEqual(
94
+ [...properties.keys()].every((v): v is string => typeof v === 'string'),
95
+ true,
96
+ 'all keys in arg \'properties\' should be strings',
97
+ );
19
98
 
20
- constructor(fullPath: string, exists = true) {
21
- this.FullPath = fullPath;
22
- if (!isAbsolute(this.FullPath)) this.FullPath = resolve(this.FullPath);
23
- if (!existsSync(this.FullPath) && exists)
24
- throw new Error(
25
- `Project ${basename(this.FullPath)} could not be found at "${this.FullPath}"`,
26
- );
27
- }
99
+ this._msbuildProjectFullPath = MPP.GetFullPath(msbuildProjectFullPath);
100
+ this._assemblyName = MPP.getAndForget(properties, 'AssemblyName');
101
+ this._description = MPP.getAndForget(properties, 'Description');
102
+ this._outputPath = MPP.getAndForget(properties, 'OutputPath');
103
+ this._runtimeIdentifier = MPP.getAndForget(properties, 'RuntimeIdentifier');
104
+ this._runtimeIdentifiers = MPP.getAndForget(
105
+ properties,
106
+ 'RuntimeIdentifiers',
107
+ );
108
+ this._targetFramework = MPP.getAndForget(properties, 'TargetFramework');
109
+ this._targetFrameworks = MPP.getAndForget(properties, 'TargetFrameworks');
110
+ this._version = MPP.getAndForget(properties, 'Version');
111
+ this._versionPrefix = MPP.getAndForget(properties, 'VersionPrefix');
112
+ this._versionSuffix = MPP.getAndForget(properties, 'VersionSuffix');
113
+ // rest
114
+ for (const key of properties.keys()) {
115
+ const value = MPP.getAndForget(properties, key);
116
+ if (value !== undefined) {
117
+ Object.defineProperty(this, key, {
118
+ value: value,
119
+ writable: false,
120
+ enumerable: true,
121
+ configurable: true,
122
+ });
123
+ }
124
+ }
125
+ }
126
+
127
+ get MSBuildProjectFullPath(): string {
128
+ return this._msbuildProjectFullPath ??= '';
129
+ }
130
+
131
+ /**
132
+ * @returns The name of the assembly.
133
+ *
134
+ * Default: {@link https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties#:~:text=MSBuildProjectDirectory,-Reserved MSBuildProjectDirectory}
135
+ */
136
+ get AssemblyName(): string {
137
+ return this._assemblyName ??= '';
138
+ }
139
+
140
+ /**
141
+ * @returns The top-level folder where all configuration-specific intermediate output
142
+ * folders are created. The default value is `obj\`.
143
+ * @example
144
+ * ```xml
145
+ * <BaseIntermediateOutputPath>c:\xyz\obj\</BaseIntermediateOutputPath>
146
+ * ```
147
+ */
148
+ get BaseIntermediateOutputPath(): string {
149
+ return this._baseIntermediateOutputPath ??= '';
150
+ }
151
+
152
+ /**
153
+ * @returns The base path for the output file.
154
+ * If it's set, MSBuild uses `OutputPath = $(BaseOutputPath)\$(Configuration)\`.
155
+ * @example ```xml
156
+ * <BaseOutputPath>c:\xyz\bin\</BaseOutputPath>
157
+ * ```
158
+ */
159
+ get BaseOutputPath(): string {
160
+ return this._baseOutputPath ??= '';
161
+ }
162
+
163
+ /**
164
+ * A long description for the assembly.
165
+ * If {@link NugetProperties.PackageDescription} is not specified, then this property is also used as the description of the package.
166
+ * @returns The value of the `Description` property.
167
+ */
168
+ get Description(): string {
169
+ return this._description ??= '';
170
+ }
171
+
172
+ /**
173
+ * @returns The full intermediate output path as derived from
174
+ * {@link BaseIntermediateOutputPath}, if no path is specified.
175
+ * @example "obj\\debug\\"
176
+ */
177
+ get IntermediateOutput(): string {
178
+ return this._intermediateOutputPath ??= '';
179
+ }
180
+
181
+ /**
182
+ * @returns The final output location for the project or solution.
183
+ * When you build a solution, OutDir can be used to gather multiple project outputs in one location.
184
+ * In addition, OutDir is included in AssemblySearchPaths used for resolving references.
185
+ * @example
186
+ * `bin/Debug`
187
+ */
188
+ get OutDir(): string {
189
+ return this._outDir ??= '';
190
+ }
191
+
192
+ /**
193
+ * @returns The path to the output directory, relative to the project
194
+ * directory.
195
+ * @example
196
+ * `bin/Debug`
197
+ * /// non-AnyCPU builds
198
+ * `bin/Debug/${Platform}`
199
+ */
200
+ get OutputPath(): string {
201
+ return this._outputPath ??= '';
202
+ }
203
+
204
+ /**
205
+ * Set Version -OR- VersionPrefix.
206
+ * @returns The value of the `Version` property.
207
+ *
208
+ * Default: `"1.0.0"`
209
+ */
210
+ get Version(): string {
211
+ return this._version ??= '1.0.0';
212
+ }
213
+
214
+ /**
215
+ * Set Version -OR- VersionPrefix.\
216
+ * Setting {@link NugetProperties.PackageVersion} overwrites {@link VersionPrefix}
217
+ * @returns The MAJOR.MINOR.PATCH string of the version.
218
+ * @see {@link VersionSuffix}
219
+ */
220
+ get VersionPrefix(): string {
221
+ return this._versionPrefix ??= '';
222
+ }
223
+
224
+ /**
225
+ * The effect of this property on the package version depends on the values of the Version and VersionPrefix properties, as shown in the following table:
226
+ * | Properties with values | Package version |
227
+ * | ---------------------- | --------------- |
228
+ * | None | 1.0.0 |
229
+ * | Version | $(Version) |
230
+ * | VersionPrefix only | $(VersionPrefix) |
231
+ * | VersionSuffix only | 1.0.0-$(VersionSuffix) |
232
+ * | VersionPrefix and VersionSuffix | $(VersionPrefix)-$(VersionSuffix) |
233
+ * \
234
+ * Setting {@link PackageVersion} overwrites {@link VersionSuffix}
235
+ * @returns The string appended to the end of the MAJOR.MINOR.PATCH semver string (i.e. {@link VersionPrefix})
236
+ */
237
+ get VersionSuffix(): string {
238
+ return this._versionSuffix ??= '';
239
+ }
240
+
241
+ /**
242
+ * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframework Target Framework}
243
+ * @see
244
+ * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks
245
+ * https://learn.microsoft.com/en-us/dotnet/standard/frameworks
246
+ */
247
+ get TargetFramework(): string {
248
+ return this._targetFramework ??= '';
249
+ }
250
+
251
+ /**
252
+ * @returns The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframeworks Target Frameworks} (plural)
253
+ * @see
254
+ * https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks
255
+ * https://learn.microsoft.com/en-us/dotnet/standard/frameworks
256
+ */
257
+ get TargetFrameworks(): string {
258
+ return this._targetFrameworks ??= '';
259
+ }
260
+
261
+ /**
262
+ * @returns
263
+ * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifier `Runtime Identifier`} property lets you specify a single runtime
264
+ * > identifier (RID) for the project. The RID enables publishing a
265
+ * > self-contained deployment.
266
+ * @see
267
+ * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
268
+ */
269
+ get RuntimeIdentifier(): string {
270
+ return this._runtimeIdentifier ??= '';
271
+ }
272
+
273
+ /**
274
+ * @returns
275
+ * > The {@link https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifiers `RuntimeIdentifiers`} property lets you specify a
276
+ * > semicolon-delimited list of runtime identifiers (RIDs) for the project.
277
+ * > Use this property if you need to publish for multiple runtimes.
278
+ * > `RuntimeIdentifiers` is used at restore time to ensure the right assets
279
+ * > are in the graph.
280
+ * @see
281
+ * https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
282
+ */
283
+ get RuntimeIdentifiers(): string {
284
+ return this._runtimeIdentifiers ??= '';
285
+ }
28
286
  }
287
+
288
+ const MPP = MSBuildProjectProperties;
289
+ export type Class_MSBPP = ClassLike<BaseClass<typeof MSBuildProjectProperties & {
290
+ // @ts-expect-error Property 'getAndForget' is protected and only accessible within class 'MSBuildProjectProperties' and its subclasses. ts(2445)
291
+ getAndForget: ProtectedMember<typeof MSBuildProjectProperties.getAndForget>;
292
+ }>>;
293
+
294
+ type ProtectedMember<T> = T;