@halospv3/hce.shared-config 3.0.0-develop.2 → 3.0.0-develop.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +164 -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/dotnet/PublishAll.targets +3 -2
  6. package/dotnet/ZipPublishDir.targets +24 -29
  7. package/mjs/CaseInsensitiveMap.d.ts +12 -0
  8. package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
  9. package/mjs/CaseInsensitiveMap.mjs +33 -0
  10. package/mjs/CaseInsensitiveMap.mjs.map +1 -0
  11. package/mjs/commitlintConfig.d.ts +12 -0
  12. package/mjs/commitlintConfig.d.ts.map +1 -0
  13. package/mjs/commitlintConfig.mjs +13 -0
  14. package/mjs/commitlintConfig.mjs.map +1 -0
  15. package/mjs/debug.d.ts +6 -0
  16. package/mjs/debug.d.ts.map +1 -0
  17. package/mjs/debug.mjs +9 -0
  18. package/mjs/debug.mjs.map +1 -0
  19. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +38 -0
  20. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
  21. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +43 -0
  22. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
  23. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +62 -0
  24. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
  25. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
  26. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
  27. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
  28. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
  29. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +41 -0
  30. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
  31. package/mjs/dotnet/MSBuildProject.d.ts +256 -0
  32. package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
  33. package/mjs/dotnet/MSBuildProject.mjs +447 -0
  34. package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
  35. package/mjs/dotnet/MSBuildProjectProperties.d.ts +170 -0
  36. package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
  37. package/mjs/dotnet/MSBuildProjectProperties.mjs +260 -0
  38. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
  39. package/mjs/dotnet/NugetProjectProperties.d.ts +379 -0
  40. package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
  41. package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
  42. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
  43. package/mjs/dotnet/NugetRegistryInfo.d.ts +384 -0
  44. package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
  45. package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
  46. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
  47. package/mjs/dotnet/helpers.d.ts +63 -0
  48. package/mjs/dotnet/helpers.d.ts.map +1 -0
  49. package/mjs/dotnet/helpers.mjs +354 -0
  50. package/mjs/dotnet/helpers.mjs.map +1 -0
  51. package/mjs/dotnet/index.d.ts +9 -0
  52. package/mjs/dotnet/index.d.ts.map +1 -0
  53. package/mjs/dotnet/index.mjs +9 -0
  54. package/mjs/dotnet/index.mjs.map +1 -0
  55. package/mjs/dotnet.d.ts +2 -0
  56. package/mjs/dotnet.d.ts.map +1 -0
  57. package/mjs/dotnet.mjs +9 -0
  58. package/mjs/dotnet.mjs.map +1 -0
  59. package/mjs/eslintConfig.d.ts +4 -0
  60. package/mjs/eslintConfig.d.ts.map +1 -0
  61. package/mjs/eslintConfig.mjs +98 -0
  62. package/mjs/eslintConfig.mjs.map +1 -0
  63. package/mjs/index.d.ts +3 -0
  64. package/mjs/index.d.ts.map +1 -0
  65. package/mjs/index.mjs +4 -0
  66. package/mjs/index.mjs.map +1 -0
  67. package/mjs/insertPlugins.d.ts +18 -0
  68. package/mjs/insertPlugins.d.ts.map +1 -0
  69. package/mjs/insertPlugins.mjs +73 -0
  70. package/mjs/insertPlugins.mjs.map +1 -0
  71. package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
  72. package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
  73. package/mjs/semantic-release__exec.d.mjs +2 -0
  74. package/mjs/semantic-release__exec.d.mjs.map +1 -0
  75. package/mjs/semantic-release__git.d.mjs +2 -0
  76. package/mjs/semantic-release__git.d.mjs.map +1 -0
  77. package/mjs/semantic-release__github.d.mjs +2 -0
  78. package/mjs/semantic-release__github.d.mjs.map +1 -0
  79. package/mjs/semanticReleaseConfig.d.ts +97 -0
  80. package/mjs/semanticReleaseConfig.d.ts.map +1 -0
  81. package/mjs/semanticReleaseConfig.mjs +63 -0
  82. package/mjs/semanticReleaseConfig.mjs.map +1 -0
  83. package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
  84. package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
  85. package/mjs/semanticReleaseConfigDotnet.mjs +268 -0
  86. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
  87. package/mjs/setupGitPluginSpec.d.ts +22 -0
  88. package/mjs/setupGitPluginSpec.d.ts.map +1 -0
  89. package/mjs/setupGitPluginSpec.mjs +144 -0
  90. package/mjs/setupGitPluginSpec.mjs.map +1 -0
  91. package/mjs/utils/Exact.d.ts +20 -0
  92. package/mjs/utils/Exact.d.ts.map +1 -0
  93. package/mjs/utils/Exact.mjs +75 -0
  94. package/mjs/utils/Exact.mjs.map +1 -0
  95. package/mjs/utils/GracefulRecursion.d.mjs +2 -0
  96. package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
  97. package/mjs/utils/env.d.ts +24 -0
  98. package/mjs/utils/env.d.ts.map +1 -0
  99. package/mjs/utils/env.mjs +39 -0
  100. package/mjs/utils/env.mjs.map +1 -0
  101. package/mjs/utils/execAsync.d.ts +37 -0
  102. package/mjs/utils/execAsync.d.ts.map +1 -0
  103. package/mjs/utils/execAsync.mjs +59 -0
  104. package/mjs/utils/execAsync.mjs.map +1 -0
  105. package/mjs/utils/miscTypes.d.ts +13 -0
  106. package/mjs/utils/miscTypes.d.ts.map +1 -0
  107. package/mjs/utils/miscTypes.mjs +10 -0
  108. package/mjs/utils/miscTypes.mjs.map +1 -0
  109. package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
  110. package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
  111. package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
  112. package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
  113. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
  114. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
  115. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
  116. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
  117. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
  118. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
  119. package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
  120. package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
  121. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
  122. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
  123. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
  124. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
  125. package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
  126. package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
  127. package/mjs/utils/reflection/filterForGetters.mjs +27 -0
  128. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
  129. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
  130. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
  131. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
  132. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
  133. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
  134. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
  135. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
  136. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
  137. package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
  138. package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
  139. package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
  140. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
  141. package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
  142. package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
  143. package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
  144. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
  145. package/mjs/utils/reflection/inheritance.d.ts +180 -0
  146. package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
  147. package/mjs/utils/reflection/inheritance.mjs +148 -0
  148. package/mjs/utils/reflection/inheritance.mjs.map +1 -0
  149. package/mjs/utils/reflection/isConstructor.d.ts +17 -0
  150. package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
  151. package/mjs/utils/reflection/isConstructor.mjs +63 -0
  152. package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
  153. package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
  154. package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
  155. package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
  156. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
  157. package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
  158. package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
  159. package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
  160. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
  161. package/mjs/utils/reflection.d.ts +18 -0
  162. package/mjs/utils/reflection.d.ts.map +1 -0
  163. package/mjs/utils/reflection.mjs +10 -0
  164. package/mjs/utils/reflection.mjs.map +1 -0
  165. package/package.json +17 -17
  166. package/src/debug.ts +5 -4
  167. package/src/dotnet/GithubNugetRegistryInfo.ts +17 -9
  168. package/src/dotnet/GitlabNugetRegistryInfo.ts +19 -5
  169. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +53 -36
  170. package/src/dotnet/MSBuildProject.ts +150 -5
  171. package/src/dotnet/MSBuildProjectProperties.ts +2 -1
  172. package/src/dotnet/NugetProjectProperties.ts +3 -2
  173. package/src/dotnet/NugetRegistryInfo.ts +94 -8
  174. package/src/dotnet/helpers.ts +87 -53
  175. package/src/dotnet/index.ts +8 -0
  176. package/src/dotnet.ts +1 -0
  177. package/src/insertPlugins.ts +116 -0
  178. package/src/semantic-release__exec.d.ts +1 -1
  179. package/src/semanticReleaseConfig.ts +8 -3
  180. package/src/semanticReleaseConfigDotnet.ts +90 -88
  181. package/src/setupGitPluginSpec.ts +4 -1
  182. package/src/tsconfig.json +1 -1
  183. package/src/utils/execAsync.ts +13 -1
  184. package/src/utils/miscTypes.ts +4 -3
  185. package/src/utils/reflection/inheritance.ts +1 -1
  186. package/tsconfig.base.json +54 -0
  187. package/tsconfig.json +22 -0
  188. package/tsconfig.mjs.json +8 -0
@@ -0,0 +1,268 @@
1
+ import { inspect } from 'node:util';
2
+ import _debug from './debug.mjs';
3
+ import { configurePrepareCmd, configureDotnetNugetPush } from './dotnet/helpers.mjs';
4
+ import { getEnvVarValue } from './utils/env.mjs';
5
+ import { baseConfig } from './semanticReleaseConfig.mjs';
6
+ import { NugetRegistryInfo } from './dotnet/NugetRegistryInfo.mjs';
7
+ import { MSBuildProject } from './dotnet/MSBuildProject.mjs';
8
+ import { insertPlugin } from './insertPlugins.mjs';
9
+
10
+ /**
11
+ * # Semantic-Release Config Factory (dotnet)
12
+ * A functional Semantic-Release configuration for dotnet projects
13
+ *
14
+ * extends {@link baseConfig }
15
+ *
16
+ * <-- TABLE OF CONTENTS -->
17
+ * - configureDotnetRelease
18
+ * - Insert-Edit Plugins
19
+ * - Append Plugins
20
+ *
21
+ */
22
+
23
+ /**
24
+ */
25
+ class SemanticReleaseConfigDotnet {
26
+ options;
27
+ _projectsToPublish;
28
+ _projectsToPackAndPush;
29
+ _evaluatedProjects;
30
+
31
+ /**
32
+ * Creates an instance of SemanticReleaseConfigDotnet.
33
+ * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet` publish, pack, and push.
34
+ *
35
+ * Note: To sign packages, create a Target in the corresponding project(s) e.g.
36
+ * ```xml
37
+ * <Target Name="SignNupkgs" AfterTargets="Pack">
38
+ * <Exec Command="dotnet nuget sign $(PackageOutputPath) [remaining args]" ConsoleToMsBuild="true" />
39
+ * </Target>
40
+ * ```
41
+ * Alternatively, splice your signing commands into the publishCmd string,
42
+ * inserting them before `dotnet nuget push`.
43
+ * If you sign different signatures depending on the NuGet registry,
44
+ * splice your signing command (with "overwrite signature" enabled, if
45
+ * desired) before the corresponding registry's `dotnet nuget push` command.
46
+ * @param projectsToPublish An array of dotnet projects' relative paths. If
47
+ * empty or unspecified, tries getting projects' semi-colon-separated relative
48
+ * paths from the `PROJECTS_TO_PUBLISH` environment variable. If configured as
49
+ * recommended, the projects' publish outputs will be zipped to '$PWD/publish'
50
+ * for use in the `publish` semantic-release step (typically, GitHub release).
51
+ * @param projectsToPackAndPush An array of dotnet projects' relative paths.
52
+ * If empty or unspecified, tries getting projects' semi-colon-separated
53
+ * relative paths from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.
54
+ * Otherwise, no packages will be packed and pushed.
55
+ * If configured as recommended, `dotnet pack` will output the nupkg/snupkg
56
+ * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.
57
+ */
58
+ constructor(projectsToPublish, projectsToPackAndPush) {
59
+ this.options = baseConfig;
60
+ /* normalize PluginSpecs to tuples */
61
+ this.options.plugins = this.options.plugins.map(pluginSpec => typeof pluginSpec === 'string' ? [pluginSpec, {}] : pluginSpec);
62
+ this._projectsToPublish = projectsToPublish;
63
+ if (this._projectsToPublish.length === 0) {
64
+ const p = getEnvVarValue('PROJECTS_TO_PUBLISH')?.split(';');
65
+ if (p && p.length > 0) {
66
+ this._projectsToPublish = p;
67
+ } else if (_debug.enabled) {
68
+ _debug(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));
69
+ }
70
+ }
71
+ this._projectsToPackAndPush = projectsToPackAndPush;
72
+ if (this._projectsToPackAndPush.length === 0) {
73
+ const p = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH')?.split(';');
74
+ if (p && p.length > 0) {
75
+ this._projectsToPackAndPush = p;
76
+ } else if (_debug.enabled) {
77
+ _debug(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));
78
+ }
79
+ }
80
+
81
+ // may be zero-length array
82
+ this._evaluatedProjects = [...this._projectsToPublish.filter(v => v instanceof MSBuildProject), ...this._projectsToPackAndPush.filter(v => v instanceof NugetRegistryInfo).map(v => v.project)];
83
+ }
84
+ get ProjectsToPublish() {
85
+ return this._projectsToPublish;
86
+ }
87
+ get ProjectsToPackAndPush() {
88
+ return this._projectsToPackAndPush;
89
+ }
90
+ get EvaluatedProjects() {
91
+ return this._evaluatedProjects;
92
+ }
93
+ insertPlugin(afterPluginsIDs, insertPluginIDs, beforePluginsIDs) {
94
+ this.options.plugins = insertPlugin(this.options.plugins, afterPluginsIDs, insertPluginIDs, beforePluginsIDs);
95
+ }
96
+
97
+ /**
98
+ * generate dotnet commands for \@semantic-release/exec, appending commands with ' && ' when necessary.
99
+ *
100
+ * Note: All strings in {@link this.ProjectsToPackAndPush} will be converted to basic {@link NugetRegistryInfo} instances with default values.
101
+ * 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.
102
+ * @todo change to builder method? e.g. static async SetupDotnetCommands(this: SemanticReleaseConfigDotnet): Promise<SemanticReleaseConfigDotnet>
103
+ * @todo Add options param to allow users to enable pushing to GitLab, GitHub, NuGet.org with default settings -OR- with entirely custom settings.
104
+ * @see https://github.com/semantic-release/exec#usage
105
+ */
106
+ async setupDotnetCommands() {
107
+ let srExecIndex = this.options.plugins.findIndex(v => v[0] === '@semantic-release/exec');
108
+ if (srExecIndex === -1) {
109
+ const message = `\
110
+ Unable to find\`['@semantic-release/exec', unknown]\` in plugins array!
111
+ Appending it to the end of the array...This may cause an unexpected order of operations!`;
112
+ console.warn(message);
113
+ srExecIndex = this.options.plugins.push(['@semantic-release/exec', {}]) - 1;
114
+ }
115
+ const execOptions = this.options.plugins[srExecIndex];
116
+
117
+ // ensure all packable projects are evaluated
118
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
119
+ this._projectsToPackAndPush = await Promise.all(this._projectsToPackAndPush.map(async project => {
120
+ if (typeof project === 'string') {
121
+ const packableProjects = await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects([project]));
122
+ if (packableProjects.length === 0) throw new Error('No MSBuildProject instances were returned!');
123
+ this._evaluatedProjects.push(...packableProjects);
124
+
125
+ // if the user doesn't want a defaulted NRI, they should pass their own NRI (or derived) instance.
126
+ return packableProjects.map(project => new NugetRegistryInfo({
127
+ project
128
+ }));
129
+ } else return [project];
130
+ })).then(p => p.flat());
131
+
132
+ // todo: double-check token-testing commands. Are they formatted prepended correctly?
133
+ const verifyConditionsCmdAppendix = await Promise.all(this._projectsToPackAndPush.map(async project => await project.PackDummyPackage({}).then(() => project.GetPushDummyCommand({})))).then(cmds => cmds.join(' && '));
134
+ execOptions.verifyConditionsCmd = execOptions.verifyConditionsCmd && execOptions.verifyConditionsCmd.trim().length > 0 ? `${execOptions.verifyConditionsCmd} && ${verifyConditionsCmdAppendix}` : verifyConditionsCmdAppendix;
135
+ const verifyReleaseCmdAppendix = await Promise.all(this.ProjectsToPackAndPush.filter(project => typeof project !== 'string').map(project => project.GetIsNextVersionAlreadyPublishedCommand())).then(cmds => cmds.join(' && '));
136
+ execOptions.verifyReleaseCmd = execOptions.verifyReleaseCmd && execOptions.verifyReleaseCmd.trim().length > 0 ? `${execOptions.verifyReleaseCmd} && ${verifyReleaseCmdAppendix}` : verifyConditionsCmdAppendix;
137
+ const prepareCmdAppendix = await configurePrepareCmd(this._projectsToPublish, this._projectsToPackAndPush);
138
+
139
+ // 'ZipPublishDir' zips each publish folder to ./publish/*.zip
140
+ execOptions.prepareCmd = execOptions.prepareCmd && execOptions.prepareCmd.trim().length > 0 ? `${execOptions.prepareCmd} && ${prepareCmdAppendix}` : prepareCmdAppendix;
141
+
142
+ // FINISHED execOptions.prepareCmd
143
+ // STARTING execOptions.publishCmd
144
+ if (this._projectsToPackAndPush.length > 0) {
145
+ const publishCmdAppendix = configureDotnetNugetPush(this._projectsToPackAndPush);
146
+ execOptions.publishCmd = execOptions.publishCmd && execOptions.publishCmd.trim().length > 0 ? `${execOptions.publishCmd} && ${publishCmdAppendix}` : publishCmdAppendix;
147
+ }
148
+
149
+ // FINISHED execOptions.publishCmd
150
+ }
151
+
152
+ /**
153
+ * Insert a plugin into the plugins array.
154
+ * @deprecated EXPERIMENTAL: needs thorough tests implemented before use in production!
155
+ * @param insertAfterPluginIDs Plugins which should appear BEFORE
156
+ * {@link insertPluginIDs}.
157
+ * @param insertPluginIDs The plugin(s) to insert into the plugins array.
158
+ * @param insertBeforePluginsIDs plugins which should appear AFTER the
159
+ * inserted plugin(s).
160
+ */
161
+ splicePlugin(insertAfterPluginIDs, insertPluginIDs, insertBeforePluginsIDs) {
162
+ const errors = [];
163
+ const pluginIDs = this.options.plugins.map(v => typeof v === 'string' ? v : v[0]);
164
+
165
+ // if any beforePluginIDs are ordered before the last afterPlugin, throw. Impossible to sort.
166
+
167
+ const indexOfLastPreceding = insertAfterPluginIDs.filter(v => pluginIDs.includes(v)).map(v => pluginIDs.indexOf(v)).sort().find((_v, i, obj) => i === obj.length - 1);
168
+ if (!indexOfLastPreceding) throw new ReferenceError('An attempt to get the last element of indexOfLastAfter returned undefined.');
169
+ const indicesOfBefore = insertBeforePluginsIDs.filter(v => pluginIDs.includes(v)).map(v => pluginIDs.indexOf(v)).sort();
170
+ for (const index of indicesOfBefore) {
171
+ if (index <= indexOfLastPreceding) {
172
+ const formattedInsertIds = '[' + insertPluginIDs.map(v => `"${v}"`).join(', ') + ']';
173
+ const formattedAfterIds = '[' + insertAfterPluginIDs.map(v => `"${v}"`).join(', ') + ']';
174
+ const formattedBeforeIds = '[' + insertBeforePluginsIDs.map(v => `"${v}"`).join(', ') + ']';
175
+ errors.push(new Error(`insertPlugin was instructed to insert ${formattedInsertIds} after ${formattedAfterIds} and before ${formattedBeforeIds}, ` + `but ${JSON.stringify(pluginIDs[indexOfLastPreceding])} is ordered after ${JSON.stringify(pluginIDs[index])}!`));
176
+ }
177
+ }
178
+ if (errors.length > 0) throw new AggregateError(errors, 'One or more errors occurred while splicing plugin-option tuples into the Semantic Release config!');
179
+ this.options.plugins.splice(indexOfLastPreceding + 1, 0, ...insertPluginIDs.map(v => [v, {}]));
180
+ }
181
+
182
+ // todo: join result with dummy pack commands
183
+ async getTokenTestingCommands() {
184
+ const promiseProjects = this.ProjectsToPackAndPush.every(nri => nri instanceof NugetRegistryInfo) ? this.ProjectsToPackAndPush.map(nri => nri.project) : await Promise.all(await MSBuildProject.PackableProjectsToMSBuildProjects(this.ProjectsToPackAndPush));
185
+
186
+ /** if a project is not in {@link EvaluatedProjects}, add it */
187
+ for (const project of promiseProjects) {
188
+ if (!this.EvaluatedProjects.includes(project)) this.EvaluatedProjects.push(project);
189
+ }
190
+ const regInfos = promiseProjects.map(p => new NugetRegistryInfo({
191
+ project: p
192
+ }));
193
+ const nupkgPaths = await Promise.all(regInfos.map(async nri => nri.PackDummyPackage({}).then(nupkgs => {
194
+ // this is a full file path.
195
+ const mainNupkg = nupkgs.find(nupkg => new RegExp(/(?<!symbols)\.nupkg$/).test(nupkg));
196
+ if (mainNupkg !== undefined) return {
197
+ nri: nri,
198
+ nupkgPath: mainNupkg
199
+ };
200
+ throw new Error('None of the following dummy packages are non-symbol .nupkg files:\n' + nupkgs.map(nupkg => ` - ${nupkg}`).join('\n') + '\nIf you intended to push only symbol packages, check if a feature request already exists (https://github.com/HaloSPV3/HCE.Shared/issues?q=push+snupkg) and, if one does not exist, create one containing the keywords "push snupkg".');
201
+ })));
202
+ const pushCommands = nupkgPaths.map(pair => pair.nri.GetPushDummyCommand({}));
203
+ return pushCommands.join(' && ');
204
+ }
205
+ toOptions() {
206
+ return this.options;
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Configures {@link baseConfig} with `@semantic-release/exec` to `dotnet`
212
+ * publish, pack, and nuget-push.
213
+ * @param projectsToPublish
214
+ * An array of dotnet projects' relative paths -OR- an array of
215
+ * {@link MSBuildProject} instances.
216
+ * - If `MSBuildProject[]`, the instances will be used as-is.
217
+ * - If `[]`, tries getting projects' semi-colon-separated relative paths from
218
+ * the `PROJECTS_TO_PUBLISH` environment variable.
219
+ * - If configured as recommended, the projects' publish outputs will be zipped
220
+ * to '$PWD/publish' for use in the `publish` semantic-release step e.g. for a
221
+ * GitHub release.
222
+ * @param projectsToPackAndPush An array of dotnet projects' relative paths -OR-
223
+ * an array of instances of {@link NugetRegistryInfo} and/or derived classes.
224
+ * - If `NugetRegistryInfo[]`, no conversions or modifications will occur.
225
+ * - If `string[]`, the project paths will be converted to
226
+ * {@link NugetRegistryInfo} instances with default values. This may be undesired.
227
+ * - If `[]`, `dotnet pack` and `dotnet nuget push` commands will not be configured.
228
+ * - If `undefined`, tries getting projects' semi-colon-separated relative paths
229
+ * from the `PROJECTS_TO_PACK_AND_PUSH` environment variable.
230
+ * With the recommended configuration, `dotnet pack` will write the nupkg/snupkg
231
+ * files to `$PWD/publish` where they will be globbed by `dotnet nuget push`.
232
+ * @returns a semantic-release Options object, based on
233
+ * `@halospv3/hce.shared-config` (our base config), with the
234
+ * `@semantic-release/exec` plugin configured to `dotnet publish`, `pack`, and
235
+ * `push` the specified projects.
236
+ */
237
+ async function getConfig(projectsToPublish, projectsToPackAndPush) {
238
+ if (_debug.enabled) {
239
+ _debug('hce.shared-config:\n' + inspect(baseConfig, false, Infinity, true));
240
+ }
241
+ const errors = [];
242
+ if (projectsToPublish.length === 0) {
243
+ const _ = getEnvVarValue('PROJECTS_TO_PUBLISH');
244
+ if (_ === undefined) errors.push(new Error('projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path.'));else projectsToPublish = _.split(';');
245
+ }
246
+ if (!projectsToPackAndPush) {
247
+ const _ = getEnvVarValue('PROJECTS_TO_PACK_AND_PUSH');
248
+ if (_ === undefined) errors.push(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));else projectsToPackAndPush = _.split(';');
249
+ }
250
+ if (errors.length > 0) {
251
+ throw new Error(['getConfig cannot continue. One or more errors occurred.', ...errors.map(v => v.stack)].join('\n'));
252
+ }
253
+ const config = new SemanticReleaseConfigDotnet(projectsToPublish, projectsToPackAndPush ?? []);
254
+ await config.setupDotnetCommands();
255
+ const options = config.toOptions();
256
+ if (_debug.enabled) {
257
+ _debug('modified plugins array:');
258
+ _debug(inspect(options.plugins, false, Infinity));
259
+ }
260
+ return options;
261
+ }
262
+
263
+ /**
264
+ * @module semanticReleaseConfigDotnet
265
+ */
266
+
267
+ export { SemanticReleaseConfigDotnet, getConfig };
268
+ //# sourceMappingURL=semanticReleaseConfigDotnet.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semanticReleaseConfigDotnet.mjs","sources":["../src/semanticReleaseConfigDotnet.ts"],"sourcesContent":null,"names":["debug"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACO,MAAM,2BAA2B,CAAC;AACzC,EAAE,OAAO;AACT,EAAE,kBAAkB;AACpB,EAAE,sBAAsB;AACxB,EAAE,kBAAkB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,iBAAiB,EAAE,qBAAqB,EAAE;AACxD,IAAI,IAAI,CAAC,OAAO,GAAG,UAAU;AAC7B;AACA,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC;AACjI,IAAI,IAAI,CAAC,kBAAkB,GAAG,iBAAiB;AAC/C,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;AAC9C,MAAM,MAAM,CAAC,GAAG,cAAc,CAAC,qBAAqB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC;AACjE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,QAAQ,IAAI,CAAC,kBAAkB,GAAG,CAAC;AACnC,OAAO,MAAM,IAAIA,MAAK,CAAC,OAAO,EAAE;AAChC,QAAQA,MAAK,CAAC,IAAI,KAAK,CAAC,gJAAgJ,CAAC,CAAC;AAC1K;AACA;AACA,IAAI,IAAI,CAAC,sBA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,MAAM,CAAC,GAAG,cAAc,CAAC,2BAA2B,CAAC;AACzD,IAAI,IAAI,CAAC,KAAK,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,sHAAsH,CAAC,CAAC,CAAC,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;AACjN;AACA,EAAE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,yDAAyD,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxH;AACA,EAAE,MAAM,MAAM,GAAG,IAAI,2BAA2B,CAAC,iBAAiB,EAAE,qBAAqB,IAAI,EAAE,CAAC;AAChG,EAAE,MAAM,MAAM,CAAC,mBAAmB,EAAE;AACpC,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE;AACpC,EAAE,IAAIA,MAAK,CAAC,OAAO,EAAE;AACrB,IAAIA,MAAK,CAAC,yBAAyB,CAAC;AACpC,IAAIA,MAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACpD;AACA,EAAE,OAAO,OAAO;AAChB;;AAEA;AACA;AACA;;;;"}
@@ -0,0 +1,22 @@
1
+ import type { PluginSpecTuple } from './semanticReleaseConfig.js';
2
+ export declare const GitPluginId = "@semantic-release/git";
3
+ /**
4
+ * As specified at https://github.com/semantic-release/git#options
5
+ * To use, assign or create an object with the same (but mutable) properties and deeply-copy to the object
6
+ * @satisfies { GitOptions }
7
+ */
8
+ export declare const DefaultOptions: {
9
+ readonly assets: ['README.md', 'CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'];
10
+ readonly message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}';
11
+ };
12
+ /**
13
+ * https://github.com/semantic-release/git#options
14
+ *
15
+ * This plugin may be deprecated at a later date.
16
+ * Q: Why would I need to commit during release?
17
+ * A: This is for committing your changelog, README, and/or other files updated during the release procedure.
18
+ * @param plugins An ordered array of {@link PluginSpecTuple PluginSpecTuples}.
19
+ * @returns A {@link PluginSpecTuple}[]. Duplicate `@semantic-release/git` plugin entries are merged or overridden. The last entry takes priority e.g. if the last entry is `{assets: false}`, previous entries' assets are ignored.
20
+ */
21
+ export declare function setupGitPluginSpec(plugins: PluginSpecTuple[]): PluginSpecTuple[];
22
+ //# sourceMappingURL=setupGitPluginSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupGitPluginSpec.d.ts","sourceRoot":"","sources":["../src/setupGitPluginSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEnF,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE;IAC3B,QAAQ,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;IAC3G,QAAQ,CAAC,OAAO,EAAE,0EAA0E,CAAC;CAWhE,CAAC;AAuFhC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAkDhF"}
@@ -0,0 +1,144 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ const GitPluginId = '@semantic-release/git';
7
+
8
+ /**
9
+ * As specified at https://github.com/semantic-release/git#options
10
+ * To use, assign or create an object with the same (but mutable) properties and deeply-copy to the object
11
+ * @satisfies { GitOptions }
12
+ */
13
+ const DefaultOptions = {
14
+ assets: ['README.md', 'CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'],
15
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
16
+ };
17
+
18
+ /**
19
+ * Check if {@link unk} is an {@link AssetEntry}.
20
+ * @param unk Anything.
21
+ * @returns `true` if {@link unk} is an {@link AssetEntry}. Else, `false`.
22
+ */
23
+ function isGitAsset(unk) {
24
+ if (typeof unk === 'string') return true;
25
+ // Avoid ending condition with `typeof unk.path === 'string'`.
26
+ // TS narrowing is bugged; requires the check to be performed TWICE!!
27
+ if (typeof unk === 'object' && unk != undefined && 'path' in unk) {
28
+ return typeof unk.path === 'string';
29
+ }
30
+ return false;
31
+ }
32
+
33
+ /**
34
+ * Convert one or more {@link AssetEntry AssetEntries} to a `string[]`.
35
+ * @param assets The `assets` property of a {@link GitOptions} object. This may not be `false`.
36
+ * @returns A `string[]` of the given {@link AssetEntry} objects or strings.
37
+ */
38
+ function gitAssetsToStringArray(assets) {
39
+ if (assets === undefined) return [];
40
+ if (Array.isArray(assets)) {
41
+ return assets.filter(asset => isGitAsset(asset)).map(v => typeof v === 'string' ? v : v.path);
42
+ }
43
+ if (typeof assets === 'string') return [assets];
44
+ if (typeof assets.path === 'string') return [assets.path];else throw new TypeError('assets is not typeof GitOptions[\'assets\'!');
45
+ }
46
+
47
+ /**
48
+ * Sanitize a {@link GitOptions} object so its {@link GitOptions#assets} property is either `false` or a `string[]`.
49
+ * @param opts A {@link GitOptions} object.
50
+ * @returns A {@link GitOptions} object whose {@link GitOptions#assets} is `string[] | false`.
51
+ */
52
+ function sanitizeGitOptions(opts) {
53
+ return _objectSpread(_objectSpread({}, opts), {}, {
54
+ assets: opts.assets === false ? opts.assets : gitAssetsToStringArray(opts.assets)
55
+ });
56
+ }
57
+
58
+ /**
59
+ *Determine if {@link opts} is a {@link GitOptions} object.
60
+ * @param opts Anything.
61
+ * @returns `true` if {@link opts} is a {@link GitOptions} object. Else, `false`.
62
+ */
63
+ function isGitOptions(opts) {
64
+ let isOptions = false;
65
+ if (typeof opts !== 'object' || opts == undefined) return isOptions;
66
+ if ('assets' in opts) {
67
+ isOptions = Array.isArray(opts.assets) ? opts.assets.every(unk => isGitAsset(unk)) : isGitAsset(opts.assets);
68
+ }
69
+ if ('message' in opts) isOptions = typeof opts.message === 'string';
70
+ return isOptions;
71
+ }
72
+
73
+ /**
74
+ * Determine if {@link pluginSpec} includes a {@link GitOptions} object.
75
+ * @param pluginSpec a {@link PluginSpecTuple}.
76
+ * @returns `true` if {@link pluginSpec[1]} is a {@link GitOptions} object. Else, `false`.
77
+ */
78
+ function hasGitOptions(pluginSpec) {
79
+ return isGitOptions(pluginSpec[1]);
80
+ }
81
+ ;
82
+
83
+ /**
84
+ * Determined if the plugin ID in {@link pluginSpec} is {@link GitPluginId}.
85
+ * @param pluginSpec A {@link PluginSpecTuple}
86
+ * @returns `true` if {@link pluginSpec[0]} is {@link GitPluginId}
87
+ */
88
+ function isGitPluginSpecTuple(pluginSpec) {
89
+ return pluginSpec[0] === GitPluginId;
90
+ }
91
+
92
+ /**
93
+ * https://github.com/semantic-release/git#options
94
+ *
95
+ * This plugin may be deprecated at a later date.
96
+ * Q: Why would I need to commit during release?
97
+ * A: This is for committing your changelog, README, and/or other files updated during the release procedure.
98
+ * @param plugins An ordered array of {@link PluginSpecTuple PluginSpecTuples}.
99
+ * @returns A {@link PluginSpecTuple}[]. Duplicate `@semantic-release/git` plugin entries are merged or overridden. The last entry takes priority e.g. if the last entry is `{assets: false}`, previous entries' assets are ignored.
100
+ */
101
+ function setupGitPluginSpec(plugins) {
102
+ /** if Git plugin not in load order, return as-is. */
103
+ const firstGitPluginIndex = plugins.findIndex(plugin => isGitPluginSpecTuple(plugin));
104
+ if (firstGitPluginIndex === -1) return plugins;
105
+
106
+ /**
107
+ * the following two const variables are references--not clones.
108
+ * Modifying them will affect the plugins array.
109
+ */
110
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
111
+ const firstGitPlugin = plugins[firstGitPluginIndex];
112
+ const firstGitOpts = isGitOptions(firstGitPlugin[1]) ? sanitizeGitOptions(firstGitPlugin[1]) : DefaultOptions;
113
+
114
+ /**
115
+ * remove duplicate Git plugin entries;
116
+ * merge extra options into firstGitPlugin's options
117
+ * if `firstGitOpts.assets === false`, do not change it.
118
+ * All duplicate PluginSpecSRGit entries are then reassigned `undefined` and all
119
+ * `undefined` items are filtered from the plugins array.
120
+ */
121
+ return plugins.map((current, index) => {
122
+ // skip everything up to and including the first Git PluginSpec
123
+ if (index <= firstGitPluginIndex || !isGitPluginSpecTuple(current)) return current;
124
+
125
+ /** if another Git PluginSpec is discovered, copy its options to the first Git PluginSpec and return undefined. */
126
+ if (hasGitOptions(current)) {
127
+ const currentGitOpts = sanitizeGitOptions(current[1]);
128
+ if (currentGitOpts.assets === false) {
129
+ firstGitOpts.assets = false;
130
+ } else {
131
+ const assets = gitAssetsToStringArray(currentGitOpts.assets);
132
+ if (Array.isArray(firstGitOpts.assets)) {
133
+ firstGitOpts.assets.push(...assets);
134
+ } else {
135
+ firstGitOpts.assets = assets;
136
+ }
137
+ }
138
+ if (typeof currentGitOpts.message === 'string') firstGitOpts.message = currentGitOpts.message;
139
+ }
140
+ return undefined;
141
+ }).filter(pluginSpec => pluginSpec !== undefined);
142
+ }
143
+ export { DefaultOptions, GitPluginId, setupGitPluginSpec };
144
+ //# sourceMappingURL=setupGitPluginSpec.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupGitPluginSpec.mjs","sources":["../src/setupGitPluginSpec.ts"],"sourcesContent":null,"names":[],"mappings":"AAAY,MAAC,WAAW,GAAG;;AAE3B;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,qBAAqB,CAAC;AACnG,EAAE,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,GAAG,EAAE;AACzB,EAAE,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,OAAO,IAAI;AAC1C;AACA;AACA,EAAE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,SAAS,IAAI,MAAM,IAAI,GAAG,EAAE;AACpE,IAAI,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;AACvC;AACA,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB,CAAC,MAAM,EAAE;AACxC,EAAE,IAAI,MAAM,KAAK,SAAS,EAAE,OAAO,EAAE;AACrC,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC7B,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,GAAG,CA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M;AACf,UAAU,YAAY,CAAC,MAAM,GAAG,MAAM;AACtC;AACA;AACA,MAAM,IAAI,OAAO,cAAc,CAAC,OAAO,KAAK,QAAQ,EAAE,YAAY,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO;AACnG;AACA,IAAI,OAAO,SAAS;AACpB,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,UAAU,KAAK,SAAS,CAAC;AACnD;;;;"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ### `Exact<T, S>`
3
+ *
4
+ * [issue](https://github.com/microsoft/TypeScript/issues/12936#issuecomment-2816928183)\
5
+ * [author](https://github.com/ahrjarrett)\
6
+ * license: unlicensed[!]
7
+ * @see
8
+ * - {@link https://tsplay.dev/NnGG6m}
9
+ */
10
+ export type Exact<T, S> = [keyof T] extends [keyof S] ? [T] extends [S] ? {
11
+ [K in keyof T]: T[K];
12
+ } : S : {
13
+ [K in keyof T as K extends keyof S ? never : K]: TypeError<`Excess: '${Coerce<K>}'`>;
14
+ };
15
+ interface TypeError<Message> {
16
+ [' TypeError']: Message;
17
+ }
18
+ type Coerce<T> = `${T & (string | number)}`;
19
+ export {};
20
+ //# sourceMappingURL=Exact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exact.d.ts","sourceRoot":"","sources":["../../src/utils/Exact.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GACjD,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,GAC9C;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;CAAE,CAAC;AA2B7F,UAAU,SAAS,CAAC,OAAO;IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE;AAGxD,KAAK,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * ### `Exact<T, S>`
3
+ *
4
+ * [issue](https://github.com/microsoft/TypeScript/issues/12936#issuecomment-2816928183)\
5
+ * [author](https://github.com/ahrjarrett)\
6
+ * license: unlicensed[!]
7
+ * @see
8
+ * - {@link https://tsplay.dev/NnGG6m}
9
+ */
10
+
11
+ // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/no-unused-vars
12
+ function exact(x, _y) {
13
+ return x;
14
+ }
15
+ ;
16
+
17
+ // should succeed
18
+ exact({
19
+ a: 1
20
+ }, {
21
+ a: 1
22
+ });
23
+ exact({
24
+ a: 1,
25
+ b: 'two'
26
+ }, {
27
+ a: 1,
28
+ b: 'two'
29
+ });
30
+
31
+ // should raise a TypeError
32
+ try {
33
+ // @ts-expect-error Type 'boolean' is not assignable to type 'TypeError<"Excess: 'c'">'.ts(2322)
34
+ exact({
35
+ a: 1
36
+ }, {
37
+ a: 1,
38
+ b: 'two',
39
+ c: false
40
+ });
41
+ } catch {/* empty */}
42
+ try {
43
+ // @ts-expect-error Type 'number' is not assignable to type 'TypeError<"Excess: 'c'">'.ts(2322)
44
+ exact({
45
+ a: 1,
46
+ b: 2
47
+ }, {
48
+ a: 1,
49
+ b: 2,
50
+ c: 3
51
+ });
52
+ } catch {/* empty */}
53
+ try {
54
+ // @ts-expect-error Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: number; }'. Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: number; }'.ts(2345)
55
+ exact({
56
+ a: 1,
57
+ b: 2
58
+ }, {
59
+ a: 1
60
+ });
61
+ } catch {/* empty */}
62
+
63
+ // prior art: use arktype's ^^^ leading whitespace trick to avoid collisions
64
+
65
+ try {
66
+ // @ts-expect-error Should error
67
+ exact({
68
+ a: 1
69
+ }, {
70
+ a: 1,
71
+ b: 2
72
+ });
73
+ // ^ 🚫 raises a TypeError here
74
+ } catch {/* empty */}
75
+ //# sourceMappingURL=Exact.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exact.mjs","sources":["../../src/utils/Exact.ts"],"sourcesContent":null,"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;AACtB,EAAE,OAAO,CAAC;AACV;AACA;;AAEA;AACA,KAAK,CAAC;AACN,EAAE,CAAC,EAAE;AACL,CAAC,EAAE;AACH,EAAE,CAAC,EAAE;AACL,CAAC,CAAC;AACF,KAAK,CAAC;AACN,EAAE,CAAC,EAAE,CAAC;AACN,EAAE,CAAC,EAAE;AACL,CAAC,EAAE;AACH,EAAE,CAAC,EAAE,CAAC;AACN,EAAE,CAAC,EAAE;AACL,CAAC,CAAC;;AAEF;AACA,IAAI;AACJ;AACA,EAAE,KAAK,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,EAAE;AACL,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE,KAAK;AACZ,IAAI,CAAC,EAAE;AACP,GAAG,CAAC;AACJ,CAAC,CAAC,MAAM;AACR,IAAI;AACJ;AACA,EAAE,KAAK,CAAC;AACR,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,EAAE;AACL,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,CAAC;AACJ,CAAC,CAAC,MAAM;AACR,IAAI;AACJ;AACA,EAAE,KAAK,CAAC;AACR,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,EAAE;AACL,IAAI,CAAC,EAAE;AACP,GAAG,CAAC;AACJ,CAAC,CAAC,MAAM;;AAER;;AAEA,IAAI;AACJ;AACA,EAAE,KAAK,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,EAAE;AACL,IAAI,CAAC,EAAE,CAAC;AACR,IAAI,CAAC,EAAE;AACP,GAAG,CAAC;AACJ;AACA,CAAC,CAAC,MAAM"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=GracefulRecursion.d.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GracefulRecursion.d.mjs","sources":[],"sourcesContent":null,"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { type DotenvConfigOptions, type GetOptions } from '@dotenvx/dotenvx';
2
+ /**
3
+ * A thin wrapper for {@link loadDotenv}. Loads a .env file from {@link process.cwd()} with the given options (or defaults), returns the new value of {@link process.env} with optional overrides.
4
+ * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.
5
+ * @param [overrides] If provided, this {@link NodeJS.ProcessEnv} object is merged into the return value, overriding existing properties where overlap occurs.
6
+ * @returns A {@link NodeJS.ProcessEnv} object whose properties are variables loaded from the
7
+ * process environment, the nearest .env file, and {@link overrides} (if provided). Where
8
+ * overlap occurs, the later source takes priority.
9
+ */
10
+ export declare function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
11
+ /**
12
+ * Get the value from the given env var in the current process or nearby .env file.
13
+ * If found in process environment, its value is returned.
14
+ * Else, try to get it from the nearest .env file.
15
+ * If NOT found, return `undefined`
16
+ * @param envVar The environment variable to lookup.
17
+ * @param [options] Options to pass to {@link get}
18
+ * @returns The string value of the environment variable or `undefined`.
19
+ * `undefined` may be returned when the variable is undefined or its string is
20
+ * empty, whitespace, or appears to have been converted from `null` or
21
+ * `undefined`.
22
+ */
23
+ export declare function getEnvVarValue(envVar: string, options?: GetOptions): string | undefined;
24
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,aAAa,CAAC,EAAE,mBAAmB,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAO5G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAOvF"}
@@ -0,0 +1,39 @@
1
+ import { config, get } from '@dotenvx/dotenvx';
2
+ import { env } from 'node:process';
3
+
4
+ /**
5
+ * A thin wrapper for {@link loadDotenv}. Loads a .env file from {@link process.cwd()} with the given options (or defaults), returns the new value of {@link process.env} with optional overrides.
6
+ * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.
7
+ * @param [overrides] If provided, this {@link NodeJS.ProcessEnv} object is merged into the return value, overriding existing properties where overlap occurs.
8
+ * @returns A {@link NodeJS.ProcessEnv} object whose properties are variables loaded from the
9
+ * process environment, the nearest .env file, and {@link overrides} (if provided). Where
10
+ * overlap occurs, the later source takes priority.
11
+ */
12
+ function getEnv(dotenvOptions, overrides) {
13
+ config(dotenvOptions);
14
+ if (overrides) Object.assign(env, overrides);
15
+ return env;
16
+ }
17
+
18
+ /**
19
+ * Get the value from the given env var in the current process or nearby .env file.
20
+ * If found in process environment, its value is returned.
21
+ * Else, try to get it from the nearest .env file.
22
+ * If NOT found, return `undefined`
23
+ * @param envVar The environment variable to lookup.
24
+ * @param [options] Options to pass to {@link get}
25
+ * @returns The string value of the environment variable or `undefined`.
26
+ * `undefined` may be returned when the variable is undefined or its string is
27
+ * empty, whitespace, or appears to have been converted from `null` or
28
+ * `undefined`.
29
+ */
30
+ function getEnvVarValue(envVar, options) {
31
+ options ??= {
32
+ ignore: ['MISSING_KEY', 'MISSING_ENV_FILE']
33
+ };
34
+ const value = String(env[envVar] ?? get(envVar, options)).trim();
35
+ // I hate this. Why is undefined converted to a string?
36
+ return value === '' || value === 'undefined' ? undefined : value;
37
+ }
38
+ export { getEnv, getEnvVarValue };
39
+ //# sourceMappingURL=env.mjs.map