@halospv3/hce.shared-config 3.0.0-develop.8 → 3.0.0

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 (45) hide show
  1. package/CHANGELOG.md +372 -63
  2. package/dotnet/.github/workflows/_unit_test.yml +3 -3
  3. package/dotnet/.github/workflows/dotnet-release.yml +3 -3
  4. package/dotnet/.github/workflows/sample-dotnet-build.yml +2 -2
  5. package/dotnet/PublishAll.targets +3 -2
  6. package/dotnet/ZipPublishDir.targets +24 -29
  7. package/dotnet/samples/HCE.Shared.SignAfterPack/sampleCert.samplepfx +0 -0
  8. package/mjs/debug.d.ts +4 -2
  9. package/mjs/debug.d.ts.map +1 -1
  10. package/mjs/debug.mjs +6 -4
  11. package/mjs/debug.mjs.map +1 -1
  12. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +39 -21
  13. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -1
  14. package/mjs/dotnet/MSBuildProject.d.ts +1 -1
  15. package/mjs/dotnet/MSBuildProject.mjs +1 -1
  16. package/mjs/dotnet/helpers.d.ts.map +1 -1
  17. package/mjs/dotnet/helpers.mjs +4 -4
  18. package/mjs/dotnet/helpers.mjs.map +1 -1
  19. package/mjs/dotnet/index.d.ts +0 -8
  20. package/mjs/dotnet/index.d.ts.map +1 -1
  21. package/mjs/dotnet.d.ts +0 -1
  22. package/mjs/dotnet.d.ts.map +1 -1
  23. package/mjs/eslintConfig.d.ts +2 -2
  24. package/mjs/eslintConfig.d.ts.map +1 -1
  25. package/mjs/eslintConfig.mjs +6 -6
  26. package/mjs/eslintConfig.mjs.map +1 -1
  27. package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -1
  28. package/mjs/semanticReleaseConfigDotnet.mjs +6 -5
  29. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -1
  30. package/mjs/utils/env.d.ts.map +1 -1
  31. package/mjs/utils/env.mjs +5 -1
  32. package/mjs/utils/env.mjs.map +1 -1
  33. package/package.json +17 -16
  34. package/src/debug.ts +5 -4
  35. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +53 -36
  36. package/src/dotnet/MSBuildProject.ts +1 -1
  37. package/src/dotnet/helpers.ts +9 -6
  38. package/src/dotnet/index.ts +0 -9
  39. package/src/dotnet.ts +0 -1
  40. package/src/eslintConfig.ts +27 -27
  41. package/src/semanticReleaseConfigDotnet.ts +8 -12
  42. package/src/utils/env.ts +7 -1
  43. package/tsconfig.base.json +54 -0
  44. package/tsconfig.json +22 -0
  45. package/tsconfig.mjs.json +8 -0
@@ -1 +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"}
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;AAM1B;;;;;;;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,CAUvF"}
package/mjs/utils/env.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { config, get } from '@dotenvx/dotenvx';
2
2
  import { env } from 'node:process';
3
3
 
4
+ /** `get` can return `undefined`. It can also return a `Record`, but that's internal. */
5
+
4
6
  /**
5
7
  * 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
8
  * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.
@@ -31,7 +33,9 @@ function getEnvVarValue(envVar, options) {
31
33
  options ??= {
32
34
  ignore: ['MISSING_KEY', 'MISSING_ENV_FILE']
33
35
  };
34
- const value = String(env[envVar] ?? get(envVar, options)).trim();
36
+ let value = env[envVar];
37
+ const x = get(envVar, options);
38
+ if (typeof x === 'string') value = x;
35
39
  // I hate this. Why is undefined converted to a string?
36
40
  return value === '' || value === 'undefined' ? undefined : value;
37
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","sources":["../../src/utils/env.ts"],"sourcesContent":null,"names":["loadDotenv"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,aAAa,EAAE,SAAS,EAAE;AACjD,EAAEA,MAAU,CAAC,aAAa,CAAC;AAC3B,EAAE,IAAI,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC;AAC9C,EAAE,OAAO,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;AAChD,EAAE,OAAO,KAAK;AACd,IAAI,MAAM,EAAE,CAAC,aAAa,EAAE,kBAAkB;AAC9C,GAAG;AACH,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;AAClE;AACA,EAAE,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,WAAW,GAAG,SAAS,GAAG,KAAK;AAClE;;;;"}
1
+ {"version":3,"file":"env.mjs","sources":["../../src/utils/env.ts"],"sourcesContent":null,"names":["loadDotenv"],"mappings":";;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,aAAa,EAAE,SAAS,EAAE;AACjD,EAAEA,MAAU,CAAC,aAAa,CAAC;AAC3B,EAAE,IAAI,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC;AAC9C,EAAE,OAAO,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;AAChD,EAAE,OAAO,KAAK;AACd,IAAI,MAAM,EAAE,CAAC,aAAa,EAAE,kBAAkB;AAC9C,GAAG;AACH,EAAE,IAAI,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;AACzB,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AAChC,EAAE,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,KAAK,GAAG,CAAC;AACtC;AACA,EAAE,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,WAAW,GAAG,SAAS,GAAG,KAAK;AAClE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halospv3/hce.shared-config",
3
- "version": "3.0.0-develop.8",
3
+ "version": "3.0.0",
4
4
  "description": "Automate commit message quality, changelogs, and CI/CD releases. Exports a semantic-release shareable configuration deserialized from this package's '.releaserc.yml'. Shared resources for .NET projects are also distributed with this package.",
5
5
  "keywords": [
6
6
  "halo",
@@ -26,7 +26,8 @@
26
26
  "dotnet/*",
27
27
  "dotnet/.github/**/*",
28
28
  "mjs/**/*",
29
- "src/**/*"
29
+ "src/**/*",
30
+ "tsconfig*.json"
30
31
  ],
31
32
  "main": "./mjs/index.mjs",
32
33
  "infra": "polyrepo",
@@ -49,27 +50,25 @@
49
50
  "prepare": "husky",
50
51
  "presemantic-release": "npm pack",
51
52
  "semantic-release": "semantic-release",
52
- "test": "npm run build && npm run test:noBuild",
53
+ "pretest": "npm run build && npm run test:cacheSampleProjects",
54
+ "test": "tsx --test --experimental-test-coverage --enable-source-maps --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.txt --test-reporter=junit --test-reporter-destination=junit.xml",
53
55
  "test:cacheSampleProjects": "echo \"START: Cache Sample Projects\" && tsx ./tests/dotnet/MSBuildProject.projects.ts && echo \"DONE: Cache Sample Projects\"",
54
- "pretest:noBuild": "npm run test:cacheSampleProjects",
55
- "test:noBuild": "npm run test:justTest",
56
- "test:justTest": "tsx --test --experimental-test-coverage --enable-source-maps --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.txt --test-reporter=junit --test-reporter-destination=junit.xml",
57
- "test:watch": "npm run test:justTest -- -- --watch",
56
+ "test:watch": "npm run test -- --watch",
58
57
  "type": "tsc --build",
59
58
  "validate": "packemon validate",
60
59
  "watch": "packemon watch --loadConfigs"
61
60
  },
62
61
  "dependencies": {
63
- "@commitlint/cli": "^19.8.1",
64
- "@commitlint/config-conventional": "^19.8.1",
62
+ "@commitlint/cli": "^20.0.0",
63
+ "@commitlint/config-conventional": "^20.0.0",
65
64
  "@dotenvx/dotenvx": "^1.47.6",
66
65
  "@eslint/js": "^9.31.0",
67
66
  "@semantic-release/changelog": "^6.0.3",
68
67
  "@semantic-release/commit-analyzer": "^13.0.1",
69
68
  "@semantic-release/exec": "^7.1.0",
70
69
  "@semantic-release/git": "^10.0.1",
71
- "@semantic-release/github": "^11.0.3",
72
- "@semantic-release/npm": "^12.0.2",
70
+ "@semantic-release/github": "^12.0.0",
71
+ "@semantic-release/npm": "^13.0.0",
73
72
  "@semantic-release/release-notes-generator": "^14.0.3",
74
73
  "@stylistic/eslint-plugin": "^5.1.0",
75
74
  "@types/node": "~20.11.0",
@@ -77,20 +76,22 @@
77
76
  "chardet": "^2.1.0",
78
77
  "conventional-changelog-conventionalcommits": "^9.1.0",
79
78
  "debug": "^4.4.1",
79
+ "es-main": "^1.3.0",
80
80
  "eslint-plugin-jsonc": "^2.20.1",
81
81
  "globals": "^16.3.0",
82
82
  "husky": "^9.1.7",
83
83
  "sanitize-filename": "^1.6.3",
84
- "semantic-release": "^24.2.7",
84
+ "semantic-release": "^25.0.0",
85
85
  "semantic-release-export-data": "^1.1.0",
86
86
  "ts-essentials": "^10.1.1",
87
87
  "typescript-eslint": "^8.37.0"
88
88
  },
89
89
  "devDependencies": {
90
+ "@amanda-mitchell/semantic-release-npm-multiple": "^3.16.0",
90
91
  "@babel/cli": "^7.28.0",
91
92
  "@babel/core": "^7.28.0",
92
93
  "@babel/eslint-parser": "^7.28.0",
93
- "@commitlint/types": "^19.8.1",
94
+ "@commitlint/types": "^20.0.0",
94
95
  "@eslint/config-inspector": "^1.1.0",
95
96
  "@eslint/markdown": "^7.0.0",
96
97
  "@sebbo2002/semantic-release-jsr": "^3.0.0",
@@ -100,8 +101,8 @@
100
101
  "@types/tmp": "^0.2.6",
101
102
  "conventional-changelog-preset-loader": "^5.0.0",
102
103
  "eslint": "^9.31.0",
103
- "eslint-plugin-jsdoc": "^51.4.0",
104
- "eslint-plugin-unicorn": "^60.0.0",
104
+ "eslint-plugin-jsdoc": "^61.0.0",
105
+ "eslint-plugin-unicorn": "^61.0.0",
105
106
  "packemon": "^4.1.2",
106
107
  "tmp": "^0.2.3",
107
108
  "tslib": "^2.8.1",
@@ -137,5 +138,5 @@
137
138
  "setupGitPluginSpec": "src/setupGitPluginSpec.ts"
138
139
  }
139
140
  },
140
- "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
141
+ "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34"
141
142
  }
package/src/debug.ts CHANGED
@@ -1,9 +1,10 @@
1
- import debug from 'debug';
1
+ // note: @types/debug is incorrect. There is no .log function!
2
+ import createDebugger, { type Debugger } from 'debug';
2
3
 
3
- const _debug: ReturnType<typeof debug> = debug('@halospv3/hce.shared-config');
4
+ const _debug = createDebugger('@halospv3/hce.shared-config') as Debugger & { log: never };
4
5
 
5
- if (process.argv.some(v => v.includes('--debug')) || debug.enabled('@halospv3/hce.shared-config')) {
6
- debug.enable(_debug.namespace);
6
+ if (process.argv.some(v => v.includes('--debug')) || createDebugger.enabled('@halospv3/hce.shared-config')) {
7
+ createDebugger.enable(_debug.namespace);
7
8
  }
8
9
 
9
10
  export default _debug;
@@ -1,44 +1,61 @@
1
1
  import { NugetRegistryInfo, getGithubOutput } from './NugetRegistryInfo.js';
2
+ import esMain from 'es-main';
2
3
 
3
- const args = process.argv.slice(2);
4
-
5
- // Parse command-line arguments - https://stackoverflow.com/a/76298476/14894786
6
- const options: {
7
- packageId?: string;
8
- source?: string;
9
- } & Record<string, string> = {};
10
- for (let i = 0; i < args.length; i += 2) {
11
- const argName = args[i];
12
- const argValue = args[i + 1];
13
- if (argValue !== undefined && argName?.startsWith('--') === true && options[argName.slice(2)] !== undefined) {
14
- options[argName.slice(2)] = argValue;
4
+ /**
5
+ * @returns if successful
6
+ * @throws {Error} if...
7
+ * - {@link process.argv} does not include...
8
+ * - `--packageId [string]`
9
+ * - `--source [string]`
10
+ * - Value of `await getGithubOutput())['new-release-version']`...
11
+ * - is not a valid Version
12
+ * - already exists at `source`
13
+ */
14
+ async function main(): Promise<0> {
15
+ const args = process.argv.slice(2);
16
+ // Parse command-line arguments - https://stackoverflow.com/a/76298476/14894786
17
+ const options: {
18
+ packageId: string | undefined;
19
+ source: string | undefined;
20
+ } & Record<string, string | undefined> = { packageId: undefined, source: undefined };
21
+ for (let i = 0; i < args.length; i += 2) {
22
+ const argName = args[i];
23
+ const argValue = args[i + 1];
24
+ if (argValue !== undefined && argName?.startsWith('--') === true) {
25
+ options[argName.slice(2)] = argValue;
26
+ }
15
27
  }
16
- }
17
28
 
18
- if (typeof options.packageId !== 'string')
19
- throw new Error('packageId must be a string');
20
- if (typeof options.source !== 'string')
21
- throw new Error('source must be a string');
29
+ if (typeof options.packageId !== 'string')
30
+ throw new Error('packageId must be a string');
31
+ if (typeof options.source !== 'string')
32
+ throw new Error('source must be a string');
33
+
34
+ const packageId = options.packageId,
35
+ source = options.source,
36
+ versionPattern = new RegExp(/\d+\.\d+\.\d+([-+].+)?/);
37
+ const ghOutput = await getGithubOutput() ?? {};
38
+ const matches = versionPattern.exec(ghOutput['new-release-version'] ?? '');
39
+ if (matches === null || matches.length === 0)
40
+ throw new Error(
41
+ 'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',
42
+ );
22
43
 
23
- const packageId = options.packageId,
24
- source = options.source,
25
- versionPattern = new RegExp(/\d+\.\d+\.\d+([-+].+)?/);
26
- const ghOutput = await getGithubOutput() ?? {};
27
- const matches = versionPattern.exec(ghOutput['new-release-version'] ?? '');
28
- if (matches === null || matches.length === 0)
29
- throw new Error(
30
- 'The variable new-release-version is not present in the GITHUB_OUTPUT env file or its value contains invalid characters.',
44
+ const nextVersion = matches[0];
45
+ const isPublished = await NugetRegistryInfo.IsNextVersionAlreadyPublished(
46
+ source,
47
+ packageId,
48
+ nextVersion,
31
49
  );
32
50
 
33
- const nextVersion = matches[0];
34
- const isPublished = await NugetRegistryInfo.IsNextVersionAlreadyPublished(
35
- source,
36
- packageId,
37
- nextVersion,
38
- );
51
+ if (typeof isPublished !== 'boolean')
52
+ throw new Error('isPublished is not a boolean');
53
+ if (isPublished)
54
+ throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);
55
+ console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);
56
+
57
+ return 0;
58
+ }
39
59
 
40
- if (typeof isPublished !== 'boolean')
41
- throw new Error('isPublished is not a boolean');
42
- if (isPublished)
43
- throw new Error(`${packageId}@${nextVersion} already exists at ${source}.`);
44
- console.log(`OK: ${packageId}@${nextVersion} does NOT yet exist at ${source}. Yay.`);
60
+ if (esMain(import.meta))
61
+ await main();
@@ -331,7 +331,7 @@ export class MSBuildProject {
331
331
  * target is specified. If you choose Pack, you must do ['Restore', 'Pack'].
332
332
  * @param options The result of {@link EvaluationOptions.from}.
333
333
  * @returns A promised {@link MSBuildProject} instance.
334
- * @throws if the exec command fails -OR- the JSON parse fails -OR-
334
+ * @throws {Error} if the exec command fails -OR- the JSON parse fails -OR-
335
335
  * MSBuildProject's constructor fails.
336
336
  * @see {@link PackableProjectsToMSBuildProjects} for most use-cases.
337
337
  */
@@ -67,7 +67,7 @@ export async function configurePrepareCmd(
67
67
  * paths.
68
68
  * @returns A Promise of a string. This string contains one or more `dotnet publish`
69
69
  * commands conjoined by " && ". It may also include one or more
70
- * `dotnet msbuild ${...} -t:PublishAll` commands.
70
+ * `dotnet msbuild ${...} -t:PublishAll -p:Configuration=Release` commands.
71
71
  */
72
72
  async function formatDotnetPublish(
73
73
  projectsToPublish: string[] | MSBuildProject[],
@@ -138,7 +138,7 @@ export async function configurePrepareCmd(
138
138
  * runtime-framework combinations.
139
139
  * @returns If {@link proj} imports {@link ../../dotnet/PublishAll.targets}...
140
140
  * ```
141
- * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll`]
141
+ * [`${proj.Properties.MSBuildProjectFullPath} -t:PublishAll -p:Configuration=Release`]
142
142
  * ```
143
143
  * Else, an array of `dotnet publish` arguments permutations e.g.
144
144
  * ```
@@ -163,7 +163,7 @@ export async function configurePrepareCmd(
163
163
  * return publishCmdArray.join(' && ');
164
164
  */
165
165
  function getPublishArgsPermutations(proj: MSBuildProject):
166
- ([`"${typeof proj.Properties.MSBuildProjectFullPath}" -t:PublishAll`])
166
+ ([`"${typeof proj.Properties.MSBuildProjectFullPath}" -t:PublishAll -p:Configuration=Release`])
167
167
  | ([`"${typeof proj.Properties.MSBuildProjectFullPath}"`])
168
168
  | (`"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string} --framework ${string}`)[]
169
169
  | (`"${typeof proj.Properties.MSBuildProjectFullPath}" --runtime ${string}`)[]
@@ -173,7 +173,7 @@ export async function configurePrepareCmd(
173
173
  * permutation, return the appropriate command line.
174
174
  */
175
175
  if (proj.Targets.includes('PublishAll'))
176
- return [`"${proj.Properties.MSBuildProjectFullPath}" -t:PublishAll`];
176
+ return [`"${proj.Properties.MSBuildProjectFullPath}" -t:PublishAll -p:Configuration=Release`];
177
177
 
178
178
  // #region formatFrameworksAndRuntimes
179
179
  const tfmRidPermutations: `--runtime ${string} --framework ${string}`[]
@@ -220,7 +220,7 @@ export async function configurePrepareCmd(
220
220
  // #endregion formatFrameworksAndRuntimes
221
221
  }
222
222
 
223
- const publishCmds: (`dotnet publish "${string}"` | `dotnet publish "${string}" ${string}` | `dotnet msbuild "${string}" -t:PublishAll`)[] = [];
223
+ const publishCmds: (`dotnet publish "${string}"` | `dotnet publish "${string}" ${string}` | `dotnet msbuild "${string}" -t:PublishAll -p:Configuration=Release`)[] = [];
224
224
  /** convert {@link evaluatedPublishProjects} to sets of space-separated CLI args. */
225
225
  const argsSets = evaluatedPublishProjects.map(
226
226
  proj => getPublishArgsPermutations(proj),
@@ -231,7 +231,10 @@ export async function configurePrepareCmd(
231
231
  for (const permutation of args) {
232
232
  if (typeof permutation === 'string' && permutation.length === 1)
233
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}`);
234
+ if (/".+" -t:PublishAll -p:Configuration=Release/.test(permutation))
235
+ publishCmds.push(`dotnet msbuild ${permutation as `"${string}" -t:PublishAll -p:Configuration=Release`}`);
236
+ else
237
+ publishCmds.push(`dotnet publish ${permutation}`);
235
238
  }
236
239
  }
237
240
 
@@ -1,12 +1,3 @@
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
1
  export * from './GithubNugetRegistryInfo.js';
11
2
  export * from './GitlabNugetRegistryInfo.js';
12
3
  export * from './helpers.js';
package/src/dotnet.ts CHANGED
@@ -1,2 +1 @@
1
- export type * from './dotnet/index.js';
2
1
  export * from './dotnet/index.js';
@@ -1,6 +1,7 @@
1
1
  import eslint from '@eslint/js';
2
+ import { defineConfig, globalIgnores as setGlobalIgnores } from 'eslint/config';
3
+ import { type Linter } from 'eslint';
2
4
  import stylistic, { type RuleOptions } from '@stylistic/eslint-plugin';
3
- import type { TSESLint } from '@typescript-eslint/utils';
4
5
  import jsonc from 'eslint-plugin-jsonc';
5
6
  import globals from 'globals/globals.json' with { type: 'json' };
6
7
  import tseslint from 'typescript-eslint';
@@ -8,25 +9,22 @@ import tseslint from 'typescript-eslint';
8
9
  // https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config
9
10
  // https://www.google.com/search?q=javascript+recurse+through+object+and+remove+undefined+properties
10
11
 
11
- const globalIgnores: TSESLint.FlatConfig.Config = {
12
- name: 'global ignores',
13
- ignores: [
14
- '_tsout/**/*',
15
- '_tsout/*',
16
- '_tsout/',
17
- 'cjs/**/*',
18
- 'cjs/*/*',
19
- 'cjs/*',
20
- 'mjs/**/*',
21
- 'mjs/*',
22
- 'mjs/',
23
- 'node_modules/**/*',
24
- '**/node_modules/**/*',
25
- '**/*.tsbuildinfo',
26
- '**/bin/**/*',
27
- '**/obj/**/*',
28
- ],
29
- };
12
+ const globalIgnores: ReturnType<typeof setGlobalIgnores> = setGlobalIgnores([
13
+ '_tsout/**/*',
14
+ '_tsout/*',
15
+ '_tsout/',
16
+ 'cjs/**/*',
17
+ 'cjs/*/*',
18
+ 'cjs/*',
19
+ 'mjs/**/*',
20
+ 'mjs/*',
21
+ 'mjs/',
22
+ 'node_modules/**/*',
23
+ '**/node_modules/**/*',
24
+ '**/*.tsbuildinfo',
25
+ '**/bin/**/*',
26
+ '**/obj/**/*',
27
+ ]);
30
28
 
31
29
  const json_json = {
32
30
  /** jsonc config union types are a pain to work with. Each union member is mutually exclusive to the others */
@@ -62,18 +60,20 @@ const json_jsonc = {
62
60
  ignores: globalIgnores.ignores,
63
61
  };
64
62
 
65
- const stylisticWarn = stylistic.configs.customize({
63
+ const stylisticWarn: Linter.Config = stylistic.configs.customize({
66
64
  quoteProps: 'as-needed',
67
65
  semi: true,
68
66
  indent: 2,
69
- }) as TSESLint.FlatConfig.Config & { rules: { [K in keyof RuleOptions]: TSESLint.SharedConfig.RuleLevel | [TSESLint.SharedConfig.RuleLevel, ...RuleOptions[K]] } };
70
- // change all stylistic error-severity to warn-severity. Style violations should not denote code errors.
67
+ });
68
+ stylisticWarn.rules ??= {};
69
+
70
+ // change all stylistic error-severity to warn-severity. Style violations should not imply code errors.
71
71
  for (const key in stylisticWarn.rules) {
72
72
  const element = stylisticWarn.rules[key];
73
73
  if (Array.isArray(element) && (element[0] === 2 || element[0] === 'error'))
74
74
  element[0] = 'warn';
75
75
  else if (element === 2 || element === 'error') {
76
- stylisticWarn.rules[key] = 'warn' satisfies TSESLint.SharedConfig.RuleLevel;
76
+ stylisticWarn.rules[key] = 'warn';
77
77
  }
78
78
  }
79
79
 
@@ -84,7 +84,7 @@ stylisticWarn.rules['@stylistic/no-extra-parens'] = [
84
84
  allowParensAfterCommentPattern: '@type|@satisfies',
85
85
  nestedBinaryExpressions: false,
86
86
  },
87
- ];
87
+ ] satisfies Linter.RuleEntry<RuleOptions['@stylistic/no-extra-parens']>;
88
88
 
89
89
  stylisticWarn.rules['@stylistic/semi'] = [
90
90
  'warn',
@@ -93,9 +93,9 @@ stylisticWarn.rules['@stylistic/semi'] = [
93
93
  omitLastInOneLineBlock: false,
94
94
  omitLastInOneLineClassBody: false,
95
95
  },
96
- ] satisfies TSESLint.SharedConfig.RuleEntry | [TSESLint.SharedConfig.RuleLevelAndOptions, RuleOptions['@stylistic/semi'][0], RuleOptions['@stylistic/semi'][1]];
96
+ ] satisfies Linter.RuleEntry<RuleOptions['@stylistic/semi']>;
97
97
 
98
- const config: TSESLint.FlatConfig.ConfigArray = tseslint.config(
98
+ const config: ReturnType<typeof defineConfig> = defineConfig(
99
99
  json_json,
100
100
  json_json5,
101
101
  json_jsonc,
@@ -80,7 +80,7 @@ export class SemanticReleaseConfigDotnet {
80
80
  this._projectsToPublish = p;
81
81
  }
82
82
  else if (debug.enabled) {
83
- debug.log(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));
83
+ debug(new Error('At least one project must be published. `projectsToPackAndPush` is empty and environment variable `PROJECTS_TO_PUBLISH` is undefined or empty.'));
84
84
  }
85
85
  }
86
86
 
@@ -91,7 +91,7 @@ export class SemanticReleaseConfigDotnet {
91
91
  this._projectsToPackAndPush = p;
92
92
  }
93
93
  else if (debug.enabled) {
94
- debug.log(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));
94
+ debug(new Error('projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path.'));
95
95
  }
96
96
  }
97
97
 
@@ -185,16 +185,13 @@ Appending it to the end of the array...This may cause an unexpected order of ope
185
185
  ? `${execOptions.verifyConditionsCmd} && ${verifyConditionsCmdAppendix}`
186
186
  : verifyConditionsCmdAppendix;
187
187
 
188
- const verifyReleaseCmdAppendix = await Promise.all(
189
- this.ProjectsToPackAndPush
188
+ const verifyReleaseCmdAppendix
189
+ = this.ProjectsToPackAndPush
190
190
  .filter(project =>
191
191
  typeof project !== 'string',
192
192
  ).map(project =>
193
193
  project.GetIsNextVersionAlreadyPublishedCommand(),
194
- ),
195
- ).then(cmds =>
196
- cmds.join(' && '),
197
- );
194
+ ).join(' && ');
198
195
  execOptions.verifyReleaseCmd
199
196
  = execOptions.verifyReleaseCmd && execOptions.verifyReleaseCmd.trim().length > 0
200
197
  ? `${execOptions.verifyReleaseCmd} && ${verifyReleaseCmdAppendix}`
@@ -364,7 +361,7 @@ export async function getConfig(
364
361
  projectsToPackAndPush?: string[] | NugetRegistryInfo[],
365
362
  ): Promise<Options> {
366
363
  if (debug.enabled) {
367
- debug.log(
364
+ debug(
368
365
  'hce.shared-config:\n' + inspect(baseConfig, false, Infinity, true),
369
366
  );
370
367
  }
@@ -410,9 +407,8 @@ export async function getConfig(
410
407
 
411
408
  const options: Options = config.toOptions();
412
409
  if (debug.enabled) {
413
- console.debug(
414
- `modified plugins array:\n${inspect(options.plugins, false, Infinity)}`,
415
- );
410
+ debug('modified plugins array:');
411
+ debug(inspect(options.plugins, false, Infinity));
416
412
  }
417
413
 
418
414
  return options;
package/src/utils/env.ts CHANGED
@@ -5,6 +5,9 @@ import { get,
5
5
  } from '@dotenvx/dotenvx';
6
6
  import { env } from 'node:process';
7
7
 
8
+ /** `get` can return `undefined`. It can also return a `Record`, but that's internal. */
9
+ type Get = (key: string, options?: GetOptions) => string | undefined;
10
+
8
11
  /**
9
12
  * 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.
10
13
  * @param [dotenvOptions] An optional {@link DotenvConfigOptions} object to pass to {@link loadDotenv}.
@@ -36,7 +39,10 @@ export function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.P
36
39
  */
37
40
  export function getEnvVarValue(envVar: string, options?: GetOptions): string | undefined {
38
41
  options ??= { ignore: ['MISSING_KEY', 'MISSING_ENV_FILE'] };
39
- const value = String(env[envVar] ?? get(envVar, options)).trim();
42
+ let value = env[envVar];
43
+ const x = (get as Get)(envVar, options);
44
+ if (typeof x === 'string')
45
+ value = x;
40
46
  // I hate this. Why is undefined converted to a string?
41
47
  return value === '' || value === 'undefined'
42
48
  ? undefined
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig#",
3
+ "//": {
4
+ "Typescript Node.js Target Mapping": "https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping",
5
+ "Node.js ECMAScript Mapping": "https://node.green/",
6
+ "vscode-versions": "https://github.com/ewanharris/vscode-versions",
7
+ "Recommended TSConfig Bases": "https://github.com/tsconfig/bases?tab=readme-ov-file#table-of-tsconfigs",
8
+ "Available/Latest GitHub Runner Images": "https://github.com/actions/runner-images/tree/main?tab=readme-ov-file#available-images",
9
+ "Node.js versions in GitHub Runner Images": {
10
+ "Ubuntu 2404 - Node.js version(s)": {
11
+ "installed": "https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#language-and-runtime",
12
+ "cached": "https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#nodejs"
13
+ },
14
+ "macOS 14": {
15
+ "installed": "https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#language-and-runtime",
16
+ "cached": "https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#nodejs"
17
+ },
18
+ "Windows Server 2022": {
19
+ "!note!": "[Windows 19 and 22] Node.js version 16 will be removed from Windows images on 2025-05-05. See https://github.com/actions/runner-images/issues/11710",
20
+ "installed": "https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#language-and-runtime",
21
+ "cached": "https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#nodejs"
22
+ }
23
+ }
24
+ },
25
+ "compileOnSave": true,
26
+ "extends": "./node_modules/@tsconfig/node20/tsconfig.json",
27
+ "compilerOptions": {
28
+ "composite": true,
29
+ "declarationMap": true,
30
+ "emitDeclarationOnly": true,
31
+ "forceConsistentCasingInFileNames": true,
32
+ "isolatedDeclarations": true,
33
+ "isolatedModules": true,
34
+ "module": "Node18",
35
+ "noEmitOnError": true,
36
+ "noErrorTruncation": true,
37
+ "noFallthroughCasesInSwitch": true,
38
+ "noImplicitOverride": true,
39
+ "noImplicitReturns": true,
40
+ "noPropertyAccessFromIndexSignature": true,
41
+ "noUncheckedIndexedAccess": true,
42
+ "noUnusedLocals": true,
43
+ "noUnusedParameters": true,
44
+ "resolveJsonModule": true,
45
+ "skipLibCheck": true,
46
+ "sourceMap": true,
47
+ "verbatimModuleSyntax": true
48
+ },
49
+ "exclude": [
50
+ "**/node_modules/**",
51
+ "**/tsconfig.json",
52
+ "**/tsconfig.*.json"
53
+ ]
54
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "allowImportingTsExtensions": true,
5
+ "outDir": "_tsout",
6
+ "target": "es2020",
7
+ "erasableSyntaxOnly": true
8
+ },
9
+ "include": [
10
+ "./*.cts",
11
+ "./*.mts",
12
+ "./*.ts"
13
+ ],
14
+ "references": [
15
+ {
16
+ "path": "./tests/tsconfig.json"
17
+ },
18
+ {
19
+ "path": "./src/tsconfig.json"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./src/tsconfig.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./mjs/",
5
+ "outDir": "./mjs/",
6
+ "rootDir": "./src/"
7
+ }
8
+ }