@halospv3/hce.shared-config 2.2.3 → 2.3.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 (89) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE +1 -1
  3. package/README.md +116 -88
  4. package/cjs/commitlintConfig-wrapper.mjs +6 -0
  5. package/cjs/commitlintConfig.cjs +14 -0
  6. package/cjs/commitlintConfig.cjs.map +1 -0
  7. package/cjs/commitlintConfig.d.ts +4 -0
  8. package/cjs/commitlintConfig.d.ts.map +1 -0
  9. package/cjs/dotnet/MSBuildProject.cjs +85 -0
  10. package/cjs/dotnet/MSBuildProject.cjs.map +1 -0
  11. package/cjs/dotnet/MSBuildProject.d.ts +42 -0
  12. package/cjs/dotnet/MSBuildProject.d.ts.map +1 -0
  13. package/cjs/dotnet/MSBuildProjectProperties.cjs +22 -0
  14. package/cjs/dotnet/MSBuildProjectProperties.cjs.map +1 -0
  15. package/cjs/dotnet/MSBuildProjectProperties.d.ts +13 -0
  16. package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
  17. package/cjs/dotnet/dotnetGHPR.cjs +60 -0
  18. package/cjs/dotnet/dotnetGHPR.cjs.map +1 -0
  19. package/cjs/dotnet/dotnetGHPR.d.ts +14 -0
  20. package/cjs/dotnet/dotnetGHPR.d.ts.map +1 -0
  21. package/cjs/dotnet/dotnetGLPR.cjs +41 -0
  22. package/cjs/dotnet/dotnetGLPR.cjs.map +1 -0
  23. package/cjs/dotnet/dotnetGLPR.d.ts +13 -0
  24. package/cjs/dotnet/dotnetGLPR.d.ts.map +1 -0
  25. package/cjs/dotnet/dotnetHelpers.cjs +144 -0
  26. package/cjs/dotnet/dotnetHelpers.cjs.map +1 -0
  27. package/cjs/dotnet/dotnetHelpers.d.ts +26 -0
  28. package/cjs/dotnet/dotnetHelpers.d.ts.map +1 -0
  29. package/cjs/dotnet-wrapper.mjs +6 -0
  30. package/cjs/dotnet.cjs +13 -0
  31. package/cjs/dotnet.cjs.map +1 -0
  32. package/cjs/dotnet.d.ts +6 -0
  33. package/cjs/dotnet.d.ts.map +1 -0
  34. package/cjs/eslintConfig-wrapper.mjs +6 -0
  35. package/cjs/eslintConfig.cjs +55 -0
  36. package/cjs/eslintConfig.cjs.map +1 -0
  37. package/cjs/eslintConfig.d.ts +4 -0
  38. package/cjs/eslintConfig.d.ts.map +1 -0
  39. package/cjs/findStaticConfig-wrapper.mjs +6 -0
  40. package/cjs/findStaticConfig.cjs +34 -0
  41. package/cjs/findStaticConfig.cjs.map +1 -0
  42. package/cjs/findStaticConfig.d.ts +2 -0
  43. package/cjs/findStaticConfig.d.ts.map +1 -0
  44. package/cjs/index.cjs +5 -35
  45. package/cjs/index.cjs.map +1 -1
  46. package/cjs/index.d.ts +2 -5
  47. package/cjs/index.d.ts.map +1 -1
  48. package/cjs/semantic-release__git.d.cjs +2 -0
  49. package/cjs/semantic-release__git.d.cjs.map +1 -0
  50. package/cjs/semanticReleaseConfig-wrapper.mjs +6 -0
  51. package/cjs/semanticReleaseConfig.cjs +16 -0
  52. package/cjs/semanticReleaseConfig.cjs.map +1 -0
  53. package/cjs/semanticReleaseConfig.d.ts +4 -0
  54. package/cjs/semanticReleaseConfig.d.ts.map +1 -0
  55. package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +6 -0
  56. package/cjs/semanticReleaseConfigDotnet.cjs +74 -0
  57. package/cjs/semanticReleaseConfigDotnet.cjs.map +1 -0
  58. package/cjs/semanticReleaseConfigDotnet.d.ts +30 -0
  59. package/cjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
  60. package/cjs/setupGitPluginSpec-wrapper.mjs +6 -0
  61. package/cjs/setupGitPluginSpec.cjs +67 -0
  62. package/cjs/setupGitPluginSpec.cjs.map +1 -0
  63. package/cjs/setupGitPluginSpec.d.ts +18 -0
  64. package/cjs/setupGitPluginSpec.d.ts.map +1 -0
  65. package/dotnet/HCE.Shared.CI.props +8 -0
  66. package/dotnet/HCE.Shared.props +6 -0
  67. package/dotnet/HCE.Shared.targets +9 -0
  68. package/dotnet/PublishAll.targets +43 -0
  69. package/dotnet/ZipPublishDir.targets +20 -9
  70. package/dotnet/dotnet-build.ps1 +67 -0
  71. package/package.json +72 -41
  72. package/src/commitlintConfig.ts +15 -0
  73. package/src/dotnet/MSBuildProject.ts +83 -0
  74. package/src/dotnet/MSBuildProjectProperties.ts +28 -0
  75. package/src/dotnet/dotnetGHPR.ts +76 -0
  76. package/src/dotnet/dotnetGLPR.ts +46 -0
  77. package/src/dotnet/dotnetHelpers.ts +182 -0
  78. package/src/dotnet.ts +5 -0
  79. package/src/eslintConfig.ts +86 -0
  80. package/src/findStaticConfig.ts +31 -0
  81. package/src/index.ts +2 -40
  82. package/src/semantic-release__git.d.ts +67 -0
  83. package/src/semanticReleaseConfig.ts +15 -0
  84. package/src/semanticReleaseConfigDotnet.ts +78 -0
  85. package/src/setupGitPluginSpec.ts +75 -0
  86. package/src/tsconfig.json +10 -0
  87. package/static/.releaserc.yml +2 -3
  88. package/commitlint.config.ts +0 -10
  89. package/dotnet/.releaserc.cjs +0 -77
@@ -0,0 +1,75 @@
1
+ import type { PluginSpec } from 'semantic-release';
2
+ import type { AssetEntry, Options as GitOptions } from '@semantic-release/git';
3
+
4
+ export const GitPluginId = '@semantic-release/git';
5
+ export const DefaultOptions = {
6
+ assets: ['CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'],
7
+ // eslint-disable-next-line no-template-curly-in-string
8
+ message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
9
+ } satisfies GitOptions;
10
+
11
+ function gitAssetsToArray(assets: AssetEntry | AssetEntry[] | false | undefined) {
12
+ if (assets === undefined || assets === false) return [];
13
+ if (Array.isArray(assets)) return assets;
14
+ if (typeof assets === 'string') return [assets];
15
+ return assets.path === 'string' ? [assets.path] : [];
16
+ }
17
+
18
+ /**
19
+ * https://github.com/semantic-release/git#options
20
+ *
21
+ * This plugin may be deprecated at a later date.
22
+ * Why do you need to commit during release?
23
+ * If you don't need to update a changelog or version in a file, then you don't need this.
24
+ *
25
+ * @returns A {@link PluginSpec} array with {@link PluginSpec<GitOptions>}. If Git plugin not in original array, returns the original array.
26
+ * todo: deprecate for generic or parameterized function
27
+ */
28
+ export function setupGitPluginSpec(plugins: PluginSpec[]): PluginSpec[] {
29
+ let newPlugins = plugins;
30
+ let gitPluginIndex = -1;
31
+
32
+ function pluginSpecIsGit(pluginSpec: PluginSpec, pluginSpecIndex: number) {
33
+ if (pluginSpec === GitPluginId || pluginSpec[0] === GitPluginId) {
34
+ gitPluginIndex = pluginSpecIndex;
35
+ return true;
36
+ }
37
+ return false;
38
+ }
39
+
40
+ // if Git plugin not in load order, return as-is.
41
+ if (!newPlugins.some(pluginSpecIsGit)) return plugins;
42
+
43
+ // if string, replace with tuple with default options.
44
+ newPlugins = newPlugins.map((plugin) =>
45
+ plugin === GitPluginId ? [GitPluginId, DefaultOptions] : plugin,
46
+ );
47
+
48
+ // ensure assets is an array
49
+ (newPlugins[gitPluginIndex][1] as GitOptions).assets = gitAssetsToArray(
50
+ (newPlugins[gitPluginIndex][1] as GitOptions).assets,
51
+ );
52
+
53
+ const discardPile: number[] = [];
54
+
55
+ // de-duplicate Git plugin entries; assign single entry to newPlugins[gitPluginIndex]
56
+ newPlugins.forEach((current, i) => {
57
+ if (i > gitPluginIndex && pluginSpecIsGit(current, gitPluginIndex)) {
58
+ // convert its assets to an array
59
+ const { assets } = newPlugins[i][1] as GitOptions;
60
+ const { message } = newPlugins[i][1] as GitOptions;
61
+ // push unique assets to first entry's assets array
62
+ if (assets !== undefined)
63
+ ((newPlugins[gitPluginIndex][1] as GitOptions).assets as AssetEntry[]).push(
64
+ ...gitAssetsToArray(assets),
65
+ );
66
+ if (message !== undefined) (newPlugins[gitPluginIndex][1] as GitOptions).message = message;
67
+ discardPile.push(i);
68
+ }
69
+ });
70
+ for (const i of discardPile.sort().reverse()) {
71
+ newPlugins.splice(i, 1);
72
+ }
73
+
74
+ return newPlugins;
75
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../baseTsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../_tsout/src",
5
+ "target": "ES5"
6
+ },
7
+ "include": [
8
+ "./**/*"
9
+ ]
10
+ }
@@ -22,7 +22,7 @@ plugins: # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/con
22
22
  - CHANGELOG.md
23
23
  # Arbitrary shell commands - https://github.com/semantic-release/exec
24
24
  # hint: set 'prepareCmd' to `dotnet publish`.
25
- # Because this is sorted after @semantic-release/git, the new Git tag will
25
+ # Because this is sorted after @semantic-release/git, the new Git tag will
26
26
  # be visible to dotnet (and GitVersion). Dotnet artifacts will be
27
27
  # versioned accordingly.
28
28
  # Plugins' Steps: https://github.com/semantic-release/semantic-release/blob/master/docs/extending/plugins-list.md
@@ -30,7 +30,6 @@ plugins: # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/con
30
30
  - - "@semantic-release/github"
31
31
  - assets:
32
32
  - path: ./publish/*
33
-
34
- ## (OPTIONAL) update static Version strings.
33
+ ## (OPTIONAL) update static Version strings before Git plugin
35
34
  # https://github.com/jpoehnelt/semantic-release-replace-plugin
36
35
  # https://github.com/droidsolutions/semantic-release-update-file
@@ -1,10 +0,0 @@
1
- import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
2
- const commitlint: UserConfig = {
3
- extends: ["@commitlint/config-conventional"],
4
- rules: {
5
- "body-max-line-length": [RuleConfigSeverity.Disabled],
6
- "footer-max-line-length": [RuleConfigSeverity.Disabled],
7
- "header-max-length": [RuleConfigSeverity.Disabled]
8
- }
9
- };
10
- export default commitlint
@@ -1,77 +0,0 @@
1
- /** Semantic-Release configuration for GroupBox.Avalonia
2
- * @extends { hceSharedConfig }
3
- *
4
- * <-- TABLE OF CONTENTS -->
5
- * - Insert-Edit Plugins
6
- * - Append Plugins
7
- */
8
-
9
- /**
10
- * @typedef { object } PluginOptionsGit
11
- * @prop { string } message
12
- * @prop {[ string | [string] | {path:string} ]} assets
13
- */
14
-
15
- /**
16
- * @type {import("semantic-release").Options}
17
- */
18
- const hceSharedConfig = require('@halospv3/hce.shared-config')
19
- if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
20
- console.info("hce.shared-config:\n" + JSON.stringify(hceSharedConfig, null, 2))
21
- }
22
- /**
23
- * @type { typeof hceSharedConfig.plugins }
24
- */
25
- const newPlugins = hceSharedConfig.plugins;
26
-
27
- //#region Insert-Edit Plugins
28
- /* Insert and/or configure plugins. Can be used to load plugin A's Prepare step
29
- before plugin B's Prepare step. or edit a plugin's existing configuration */
30
- for (var i = 0; i < newPlugins.length; i++) {
31
- /** e.g.
32
- //#region Git Options | https://github.com/semantic-release/git#options
33
- // if defined without plugin options, replace with tuple-like array with assets option defined.
34
- if (plugins[i] === "@semantic-release/git") {
35
- plugins[i] = [plugins[i], { assets: ["README.md", "CHANGELOG.md"] }]
36
- }
37
- if (plugins[i][0] === "@semantic-release/git") {
38
- // if assets array undefined, define it
39
- if (!plugins[i][1].assets) {
40
- plugins[i][1].assets = [];
41
- }
42
- // ensure README.md is in assets array
43
- if (!plugins[i][1].assets.some(a => a === "README.md" || a.path === "README.md")) {
44
- plugins[i][1].assets.push("README.md");
45
- }
46
- // ensure CHANGELOG.md is in assets array
47
- if (!plugins[i][1].assets.some(a => a === "CHANGELOG.md" || a.path === "CHANGELOG.md")) {
48
- plugins[i][1].assets.push("CHANGELOG.md");
49
- }
50
- }
51
- //#endregion Git Options
52
- */
53
- }
54
- //#endregion Insert-Edit Plugins
55
-
56
- //#region Append Plugins
57
- newPlugins.push(
58
- // APPEND this array of [pluginName, pluginConfig] to plugins
59
- // https://github.com/semantic-release/exec#usage
60
- ["@semantic-release/exec", {
61
- // 'ZipPublishDir' zips each publish folder to ./publish/*.zip
62
- prepareCmd: "dotnet publish ./GroupBox.Avalonia/GroupBox.Avalonia.csproj && dotnet publish ./GroupBox.Avalonia.Sample/GroupBox.Avalonia.Sample.csproj"
63
- }]
64
- )
65
- //#endregion Append Plugins
66
-
67
- if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
68
- console.info("modified plugins array:\n" + JSON.stringify(newPlugins, null, 2))
69
- }
70
-
71
- /**
72
- * @type {import("semantic-release").Options}
73
- */
74
- module.exports = {
75
- extends: "@halospv3/hce.shared-config",
76
- plugins: newPlugins
77
- };