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

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 (152) hide show
  1. package/CHANGELOG.md +356 -101
  2. package/README.md +100 -87
  3. package/dotnet/.github/workflows/_unit_test.yml +6 -3
  4. package/dotnet/.github/workflows/ci.yml +2 -2
  5. package/dotnet/.github/workflows/dotnet-release.yml +31 -28
  6. package/dotnet/.github/workflows/sample-dotnet-build.yml +16 -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/package.json +72 -73
  22. package/src/CaseInsensitiveMap.ts +34 -0
  23. package/src/commitlintConfig.ts +17 -9
  24. package/src/debug.ts +3 -3
  25. package/src/dotnet/GithubNugetRegistryInfo.ts +60 -0
  26. package/src/dotnet/GitlabNugetRegistryInfo.ts +112 -0
  27. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +44 -0
  28. package/src/dotnet/MSBuildProject.ts +557 -76
  29. package/src/dotnet/MSBuildProjectProperties.ts +280 -15
  30. package/src/dotnet/NugetProjectProperties.ts +608 -0
  31. package/src/dotnet/NugetRegistryInfo.ts +939 -0
  32. package/src/dotnet/helpers.ts +448 -0
  33. package/src/eslintConfig.ts +174 -71
  34. package/src/index.ts +1 -3
  35. package/src/semantic-release__commit-analyzer.d.ts +44 -38
  36. package/src/semantic-release__exec.d.ts +15 -0
  37. package/src/semantic-release__git.d.ts +85 -88
  38. package/src/semantic-release__github.d.ts +139 -139
  39. package/src/semanticReleaseConfig.ts +106 -47
  40. package/src/semanticReleaseConfigDotnet.ts +394 -104
  41. package/src/setupGitPluginSpec.ts +149 -57
  42. package/src/tsconfig.json +8 -8
  43. package/src/utils/Exact.ts +49 -0
  44. package/src/utils/GracefulRecursion.d.ts +12 -0
  45. package/src/utils/env.ts +44 -0
  46. package/src/utils/execAsync.ts +77 -0
  47. package/src/utils/miscTypes.ts +17 -0
  48. package/src/utils/reflection/FunctionLike.d.ts +17 -0
  49. package/src/utils/reflection/GetterDescriptor.d.ts +8 -0
  50. package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +32 -0
  51. package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +20 -0
  52. package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +17 -0
  53. package/src/utils/reflection/OwnKeyOf.d.ts +20 -0
  54. package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +82 -0
  55. package/src/utils/reflection/PropertyDescriptorMap.d.ts +15 -0
  56. package/src/utils/reflection/filterForGetters.ts +59 -0
  57. package/src/utils/reflection/getOwnPropertyDescriptors.ts +52 -0
  58. package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +127 -0
  59. package/src/utils/reflection/getPrototypeChainOf.ts +85 -0
  60. package/src/utils/reflection/getPrototypeOf.ts +12 -0
  61. package/src/utils/reflection/inheritance.ts +262 -0
  62. package/src/utils/reflection/isConstructor.ts +74 -0
  63. package/src/utils/reflection/isGetterDescriptor.ts +11 -0
  64. package/src/utils/reflection/listOwnGetters.ts +80 -0
  65. package/src/utils/reflection.ts +18 -0
  66. package/cjs/commitlintConfig-wrapper.mjs +0 -6
  67. package/cjs/commitlintConfig.cjs +0 -14
  68. package/cjs/commitlintConfig.cjs.map +0 -1
  69. package/cjs/commitlintConfig.d.ts +0 -4
  70. package/cjs/commitlintConfig.d.ts.map +0 -1
  71. package/cjs/debug.cjs +0 -13
  72. package/cjs/debug.cjs.map +0 -1
  73. package/cjs/debug.d.ts +0 -4
  74. package/cjs/debug.d.ts.map +0 -1
  75. package/cjs/dotnet/MSBuildProject.cjs +0 -84
  76. package/cjs/dotnet/MSBuildProject.cjs.map +0 -1
  77. package/cjs/dotnet/MSBuildProject.d.ts +0 -42
  78. package/cjs/dotnet/MSBuildProject.d.ts.map +0 -1
  79. package/cjs/dotnet/MSBuildProjectProperties.cjs +0 -22
  80. package/cjs/dotnet/MSBuildProjectProperties.cjs.map +0 -1
  81. package/cjs/dotnet/MSBuildProjectProperties.d.ts +0 -13
  82. package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +0 -1
  83. package/cjs/dotnet/createDummyNupkg.cjs +0 -26
  84. package/cjs/dotnet/createDummyNupkg.cjs.map +0 -1
  85. package/cjs/dotnet/createDummyNupkg.d.ts +0 -2
  86. package/cjs/dotnet/createDummyNupkg.d.ts.map +0 -1
  87. package/cjs/dotnet/dotnetGHPR.cjs +0 -173
  88. package/cjs/dotnet/dotnetGHPR.cjs.map +0 -1
  89. package/cjs/dotnet/dotnetGHPR.d.ts +0 -37
  90. package/cjs/dotnet/dotnetGHPR.d.ts.map +0 -1
  91. package/cjs/dotnet/dotnetGLPR.cjs +0 -41
  92. package/cjs/dotnet/dotnetGLPR.cjs.map +0 -1
  93. package/cjs/dotnet/dotnetGLPR.d.ts +0 -13
  94. package/cjs/dotnet/dotnetGLPR.d.ts.map +0 -1
  95. package/cjs/dotnet/dotnetHelpers.cjs +0 -141
  96. package/cjs/dotnet/dotnetHelpers.cjs.map +0 -1
  97. package/cjs/dotnet/dotnetHelpers.d.ts +0 -26
  98. package/cjs/dotnet/dotnetHelpers.d.ts.map +0 -1
  99. package/cjs/dotnet-wrapper.mjs +0 -6
  100. package/cjs/dotnet.cjs +0 -15
  101. package/cjs/dotnet.cjs.map +0 -1
  102. package/cjs/dotnet.d.ts +0 -7
  103. package/cjs/dotnet.d.ts.map +0 -1
  104. package/cjs/envUtils-wrapper.mjs +0 -6
  105. package/cjs/envUtils.cjs +0 -37
  106. package/cjs/envUtils.cjs.map +0 -1
  107. package/cjs/envUtils.d.ts +0 -15
  108. package/cjs/envUtils.d.ts.map +0 -1
  109. package/cjs/eslintConfig-wrapper.mjs +0 -6
  110. package/cjs/eslintConfig.cjs +0 -52
  111. package/cjs/eslintConfig.cjs.map +0 -1
  112. package/cjs/eslintConfig.d.ts +0 -3
  113. package/cjs/eslintConfig.d.ts.map +0 -1
  114. package/cjs/findStaticConfig-wrapper.mjs +0 -6
  115. package/cjs/findStaticConfig.cjs +0 -34
  116. package/cjs/findStaticConfig.cjs.map +0 -1
  117. package/cjs/findStaticConfig.d.ts +0 -2
  118. package/cjs/findStaticConfig.d.ts.map +0 -1
  119. package/cjs/index-wrapper.mjs +0 -6
  120. package/cjs/index.cjs +0 -10
  121. package/cjs/index.cjs.map +0 -1
  122. package/cjs/index.d.ts +0 -5
  123. package/cjs/index.d.ts.map +0 -1
  124. package/cjs/semantic-release__commit-analyzer.d.cjs +0 -2
  125. package/cjs/semantic-release__commit-analyzer.d.cjs.map +0 -1
  126. package/cjs/semantic-release__git.d.cjs +0 -2
  127. package/cjs/semantic-release__git.d.cjs.map +0 -1
  128. package/cjs/semantic-release__github.d.cjs +0 -2
  129. package/cjs/semantic-release__github.d.cjs.map +0 -1
  130. package/cjs/semanticReleaseConfig-wrapper.mjs +0 -6
  131. package/cjs/semanticReleaseConfig.cjs +0 -33
  132. package/cjs/semanticReleaseConfig.cjs.map +0 -1
  133. package/cjs/semanticReleaseConfig.d.ts +0 -4
  134. package/cjs/semanticReleaseConfig.d.ts.map +0 -1
  135. package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +0 -7
  136. package/cjs/semanticReleaseConfigDotnet.cjs +0 -112
  137. package/cjs/semanticReleaseConfigDotnet.cjs.map +0 -1
  138. package/cjs/semanticReleaseConfigDotnet.d.ts +0 -51
  139. package/cjs/semanticReleaseConfigDotnet.d.ts.map +0 -1
  140. package/cjs/setupGitPluginSpec-wrapper.mjs +0 -6
  141. package/cjs/setupGitPluginSpec.cjs +0 -67
  142. package/cjs/setupGitPluginSpec.cjs.map +0 -1
  143. package/cjs/setupGitPluginSpec.d.ts +0 -19
  144. package/cjs/setupGitPluginSpec.d.ts.map +0 -1
  145. package/src/dotnet/createDummyNupkg.ts +0 -30
  146. package/src/dotnet/dotnetGHPR.ts +0 -232
  147. package/src/dotnet/dotnetGLPR.ts +0 -46
  148. package/src/dotnet/dotnetHelpers.ts +0 -184
  149. package/src/dotnet.ts +0 -6
  150. package/src/envUtils.ts +0 -36
  151. package/src/findStaticConfig.ts +0 -31
  152. package/static/.releaserc.yml +0 -35
@@ -1,80 +1,183 @@
1
- import eslint from "@eslint/js";
2
- import jsonc from "eslint-plugin-jsonc";
3
- import { createRequire } from "module";
4
- import tseslint, { type ConfigWithExtends } from "typescript-eslint";
1
+ import eslint from '@eslint/js';
2
+ import stylistic, { type RuleOptions } from '@stylistic/eslint-plugin';
3
+ import type { TSESLint } from '@typescript-eslint/utils';
4
+ import jsonc from 'eslint-plugin-jsonc';
5
+ import globals from 'globals/globals.json' with { type: 'json' };
6
+ import tseslint from 'typescript-eslint';
5
7
 
6
- // CJS compatibility; it started transpiling to a top-level await after upgrading from packemon 4.0.1 to 4.1.0
7
- const require = createRequire(import.meta.url);
8
- const globals = require("globals") as typeof import("globals", {with: {type: "json"}});
9
8
  // https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config
10
9
  // https://www.google.com/search?q=javascript+recurse+through+object+and+remove+undefined+properties
11
- const globalIgnores: ConfigWithExtends = {
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
- ]
10
+
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
+ };
30
+
31
+ const json_json = {
32
+ /** jsonc config union types are a pain to work with. Each union member is mutually exclusive to the others */
33
+ ...jsonc.configs['flat/recommended-with-json']
34
+ .map(v => v as JsoncCfgReducerIn)
35
+ .flatMap(a => jsonCfgReducer(a, {}))
36
+ // eslint-disable-next-line unicorn/no-array-reduce
37
+ .reduce((accumulator, element) => jsonCfgReducer(accumulator, element), {} as JsoncCfgReducerOut),
38
+ name: 'flat/recommended-with-json - https://github.com/ota-meshi/eslint-plugin-jsonc' as const,
39
+ files: ['*.json', '**/*.json'] as ['*.json', '**/*.json'],
40
+ ignores: globalIgnores.ignores,
26
41
  };
42
+ const json_json5 = {
43
+ /** jsonc config union types are a pain to work with. Each union member is mutually exclusive to the others */
44
+ ...jsonc.configs['flat/recommended-with-json5']
45
+ .map(v => v as JsoncCfgReducerIn)
46
+ .flatMap(a => jsonCfgReducer(a, {}))
47
+ // eslint-disable-next-line unicorn/no-array-reduce
48
+ .reduce((accumulator, element) => jsonCfgReducer(accumulator, element), {} as JsoncCfgReducerOut),
49
+ name: 'flat/recommended-with-json5 - https://github.com/ota-meshi/eslint-plugin-jsonc' as const,
50
+ files: ['*.json5', '**/*.json5'] as ['*.json5', '**/*.json5'],
51
+ ignores: globalIgnores.ignores,
52
+ };
53
+ const json_jsonc = {
54
+ /** jsonc config union types are a pain to work with. Each union member is mutually exclusive to the others */
55
+ ...jsonc.configs['flat/recommended-with-jsonc']
56
+ .map(v => v as JsoncCfgReducerIn)
57
+ .flatMap(a => jsonCfgReducer(a, {}))
58
+ // eslint-disable-next-line unicorn/no-array-reduce
59
+ .reduce((accumulator, element) => jsonCfgReducer(accumulator, element), {} as JsoncCfgReducerOut),
60
+ name: 'flat/recommended-with-jsonc - https://github.com/ota-meshi/eslint-plugin-jsonc' as const,
61
+ files: ['*.jsonc', '**/*.jsonc'] as ['*.jsonc', '**/*.jsonc'],
62
+ ignores: globalIgnores.ignores,
63
+ };
64
+
65
+ const stylisticWarn = stylistic.configs.customize({
66
+ quoteProps: 'as-needed',
67
+ semi: true,
68
+ 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.
71
+ for (const key in stylisticWarn.rules) {
72
+ const element = stylisticWarn.rules[key];
73
+ if (Array.isArray(element) && (element[0] === 2 || element[0] === 'error'))
74
+ element[0] = 'warn';
75
+ else if (element === 2 || element === 'error') {
76
+ stylisticWarn.rules[key] = 'warn' satisfies TSESLint.SharedConfig.RuleLevel;
77
+ }
78
+ }
27
79
 
28
- export default tseslint.config(
29
- {
30
- name: "flat/recommended-with-json - https://github.com/ota-meshi/eslint-plugin-jsonc",
31
- extends: jsonc.configs["flat/recommended-with-json"],
32
- files: [
33
- "*.json",
34
- "**/*.json"
35
- ],
36
- ignores: globalIgnores.ignores
80
+ stylisticWarn.rules['@stylistic/no-extra-parens'] = [
81
+ 'warn',
82
+ 'all',
83
+ {
84
+ allowParensAfterCommentPattern: '@type|@satisfies',
85
+ nestedBinaryExpressions: false,
86
+ },
87
+ ];
88
+
89
+ stylisticWarn.rules['@stylistic/semi'] = [
90
+ 'warn',
91
+ 'always',
92
+ {
93
+ omitLastInOneLineBlock: false,
94
+ omitLastInOneLineClassBody: false,
95
+ },
96
+ ] satisfies TSESLint.SharedConfig.RuleEntry | [TSESLint.SharedConfig.RuleLevelAndOptions, RuleOptions['@stylistic/semi'][0], RuleOptions['@stylistic/semi'][1]];
97
+
98
+ const config: TSESLint.FlatConfig.ConfigArray = tseslint.config(
99
+ json_json,
100
+ json_json5,
101
+ json_jsonc,
102
+ {
103
+ name: 'TSJS',
104
+ extends: [
105
+ eslint.configs.recommended,
106
+ ...tseslint.configs.strictTypeChecked,
107
+ ...tseslint.configs.stylisticTypeChecked,
108
+ stylisticWarn,
109
+ ],
110
+ files: [
111
+ '**/*.ts',
112
+ '**/*.cts',
113
+ '**/*.mts',
114
+ '**/*.js',
115
+ '**/*.cjs',
116
+ '**/*.mjs',
117
+ '**/*.jsx',
118
+ '**/*.tsx',
119
+ ],
120
+ ignores: globalIgnores.ignores,
121
+ languageOptions: {
122
+ parserOptions: {
123
+ projectService: true,
124
+ },
125
+ globals: globals.node,
37
126
  },
38
- {
39
- name: "flat/recommended-with-json5 - https://github.com/ota-meshi/eslint-plugin-jsonc",
40
- extends: jsonc.configs["flat/recommended-with-json5"],
41
- files: [
42
- "*.json5",
43
- "**/*.json5"
44
- ],
45
- ignores: globalIgnores.ignores
127
+ },
128
+ globalIgnores,
129
+ );
130
+ export default config;
131
+
132
+ type JsoncCfgReducerIn = Partial<typeof jsonc.configs['flat/recommended-with-jsonc'][number]>
133
+ | Partial<typeof jsonc.configs['flat/recommended-with-json5'][number]>;
134
+
135
+ interface JsoncCfgReducerOut {
136
+ files: NonNullable<(typeof jsonc.configs)['flat/base'][number]['files']> | ['*.json', '**/*.json', '*.json5', '**/*.json5', '*.jsonc', '**/*.jsonc'];
137
+ plugins: typeof jsonc.configs['flat/base'][number]['plugins'];
138
+ languageOptions: {
139
+ parser: typeof import('jsonc-eslint-parser');
140
+ };
141
+ rules: NonNullable<
142
+ typeof jsonc['configs']['flat/recommended-with-json5'][number]['rules']
143
+ | typeof jsonc.configs['flat/recommended-with-jsonc'][number]['rules']
144
+ >;
145
+ }
146
+
147
+ /**
148
+ * Merge erroneously mutually-exclusive configs from `eslint-plugin-jsonc`.
149
+ * @param a A config exported by `eslint-plugin-jsonc` -OR- the output of this function.
150
+ * @param b A config exported by `eslint-plugin-jsonc` -OR- the output of this function.
151
+ * @returns A merged combination of {@link a} and {@link b}.
152
+ */
153
+ function jsonCfgReducer(
154
+ a: JsoncCfgReducerIn | JsoncCfgReducerOut,
155
+ b: JsoncCfgReducerIn | JsoncCfgReducerOut,
156
+ ): JsoncCfgReducerOut {
157
+ const baseRules = jsonc.configs['flat/base']
158
+ .find(
159
+ v => v.rules !== undefined,
160
+ )?.rules ?? (() => { throw new Error('Unable to find jsonc base rules'); })();
161
+
162
+ return {
163
+ files: jsonc.configs['flat/base']
164
+ .filter(v => v.files !== undefined)
165
+ .flatMap(v => v.files),
166
+ plugins: {
167
+ jsonc: jsonc.configs['flat/base']
168
+ .find(v =>
169
+ v.plugins?.jsonc !== undefined,
170
+ )?.plugins?.jsonc ?? (() => { throw new Error('Unable to find jsonc plugin'); })(),
46
171
  },
47
- {
48
- name: "flat/recommended-with-jsonc - https://github.com/ota-meshi/eslint-plugin-jsonc",
49
- extends: jsonc.configs["flat/recommended-with-jsonc"],
50
- files: [
51
- "*.jsonc",
52
- "**/*.jsonc"
53
- ],
54
- ignores: globalIgnores.ignores
172
+ languageOptions: {
173
+ parser: jsonc.configs['flat/base']
174
+ .find(v => v.languageOptions?.parser)
175
+ ?.languageOptions?.parser ?? (() => { throw new Error('Unable to find jsonc parser'); })(),
55
176
  },
56
- {
57
- name: "TSJS",
58
- extends: [
59
- eslint.configs.recommended as ConfigWithExtends,
60
- ...tseslint.configs.strict,
61
- ...tseslint.configs.stylistic
62
- ],
63
- files: [
64
- "**/*.ts",
65
- "**/*.cts",
66
- "**/*.mts",
67
- "**/*.js",
68
- "**/*.cjs",
69
- "**/*.mjs"
70
- ],
71
- ignores: globalIgnores.ignores,
72
- languageOptions: {
73
- parserOptions: {
74
- useProjectService: true
75
- },
76
- globals: globals.node
77
- }
177
+ rules: {
178
+ ...a.rules,
179
+ ...b.rules,
180
+ ...baseRules,
78
181
  },
79
- globalIgnores
80
- );
182
+ };
183
+ }
package/src/index.ts CHANGED
@@ -1,4 +1,2 @@
1
- /**
2
- * Runs HCE.Shared and returns a semantic-release "shareable configuration" object.
3
- */
1
+ /** Runs HCE.Shared and returns a semantic-release "shareable configuration" object. */
4
2
  export { baseConfig as default } from './semanticReleaseConfig.js';
@@ -1,44 +1,50 @@
1
1
  declare module '@semantic-release/commit-analyzer' {
2
2
 
3
- interface RuleObject {
4
- type?: string,
5
- scope?: string,
6
- release: string
7
- }
3
+ interface RuleObject {
4
+ type?: string;
5
+ scope?: string;
6
+ release: string;
7
+ }
8
8
 
9
- type AnyRecord = Record<keyof unknown, unknown>;
10
-
11
- export interface CommitAnalyzerConfig {
12
- preset?: string,
13
- config?: string,
14
- parserOpts?: AnyRecord,
15
- releaseRules?: string | RuleObject[],
16
- presetConfig?: AnyRecord
17
- }
9
+ type AnyRecord = Record<keyof unknown, unknown>;
18
10
 
11
+ export interface CommitAnalyzerConfig {
12
+ preset?: string;
13
+ config?: string;
14
+ parserOpts?: AnyRecord;
19
15
  /**
20
- * Determine the type of release to create based on a list of commits.
21
- *
22
- * @param {Object} pluginConfig The plugin configuration.
23
- * @param {String} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
24
- * @param {String} pluginConfig.config Requireable npm package with a custom conventional-changelog preset
25
- * @param {String|Array} pluginConfig.releaseRules A `String` to load an external module or an `Array` of rules.
26
- * @param {Object} pluginConfig.parserOpts Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
27
- * @param {Object} context The semantic-release context.
28
- * @param {Array<Object>} context.commits The commits to analyze.
29
- * @param {String} context.cwd The current working directory.
30
- *
31
- * @returns {Promise<String|null>} the type of release to create based on the list of commits or `null` if no release has to be done.
32
- *
33
- * @see 'file://./../node_modules/@semantic-release/commit-analyzer/index.js'
16
+ * Can be a string only if the string is a path to a modules whose default export provides {@link RuleObject}[].
17
+ * See https://github.com/semantic-release/commit-analyzer?tab=readme-ov-file#external-package--file
34
18
  */
35
- export function analyzeCommits(pluginConfig: {
36
- preset: string;
37
- config: string;
38
- releaseRules: string | AnyRecord[];
39
- parserOpts: unknown;
40
- }, context: {
41
- commits: unknown[];
42
- cwd: string;
43
- }): Promise<string | null>;
44
- }
19
+ releaseRules?: string | RuleObject[];
20
+ presetConfig?: AnyRecord;
21
+ }
22
+
23
+ export type Options = CommitAnalyzerConfig;
24
+
25
+ /**
26
+ * Determine the type of release to create based on a list of commits.
27
+ * @param pluginConfig The plugin configuration.
28
+ * @param pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
29
+ * @param pluginConfig.config Require-able npm package with a custom conventional-changelog preset
30
+ * @param pluginConfig.releaseRules A `String` to load an external module or an `Array` of rules.
31
+ * @param pluginConfig.parserOpts Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
32
+ * @param context The semantic-release context.
33
+ * @param context.commits The commits to analyze.
34
+ * @param context.cwd The current working directory.
35
+ * @returns the type of release to create based on the list of commits or `null` if no release has to be done.
36
+ * @see 'file://./../node_modules/@semantic-release/commit-analyzer/index.js'
37
+ */
38
+ export function analyzeCommits(
39
+ pluginConfig: {
40
+ preset: string;
41
+ config: string;
42
+ releaseRules: string | AnyRecord[];
43
+ parserOpts: unknown;
44
+ },
45
+ context: {
46
+ commits: object[];
47
+ cwd: string;
48
+ },
49
+ ): Promise<string | null>;
50
+ }
@@ -0,0 +1,15 @@
1
+ declare module '@semantic-release/exec' {
2
+ interface Options {
3
+ verifyConditionsCmd?: string;
4
+ analyzeCommitsCmd?: string;
5
+ verifyReleaseCmd?: string;
6
+ generateNotesCmd?: string;
7
+ prepareCmd?: string;
8
+ addChannelCmd?: string;
9
+ publishCmd?: string;
10
+ successCmd?: string;
11
+ failCmd?: string;
12
+ shell?: string;
13
+ execCwd?: string;
14
+ }
15
+ }
@@ -1,91 +1,88 @@
1
- /** @see 'file://./../node_modules/@semantic-release/git/index.js' */
1
+ /* eslint-disable jsdoc/tag-lines, jsdoc/require-param, jsdoc/require-returns */
2
+ /**
3
+ * @see {@link ../node_modules/@semantic-release/git/index.js}
4
+ */
2
5
  declare module '@semantic-release/git' {
3
- import type { Options as SemanticReleaseOptions } from "semantic-release";
4
- export type MicromatchGlob = string;
5
- export interface AssetObject {
6
- path: MicromatchGlob;
7
- }
8
- export type AssetEntry = AssetObject | MicromatchGlob;
9
- export interface Options {
10
- /**
11
- * Files to include in the release commit. Set to `false` to disable adding files to the release commit.
12
- * @default ['CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json']
13
- * @description
14
- * Can be an Array or a single entry. Each entry can be either:
15
- * - a glob
16
- * - or an Object with a path property containing a glob.
17
- *
18
- * Each entry in the assets Array is globbed individually. A glob can be a String ("dist/\*\*\/\*.js" or "dist/mylib.js") or an Array of Strings that will be globbed together (["dist/\*\*", "!\*\*\/\*.css"]).
19
- *
20
- * If a directory is configured, all the files under this directory and its children will be included.
21
- *
22
- * Note: If a file has a match in assets it will be included even if it also has a match in .gitignore.
23
- *
24
- * @example
25
- * // include all js files in the dist directory, but not in its sub-directories.
26
- * 'dist/*.js'
27
- * // include all js files in the dist directory and its sub-directories.
28
- * 'dist/**\/*.js'
29
- * // include all files in the dist directory and its sub-directories excluding the css files.
30
- * [['dist', '!**\/*.css']]
31
- * // include package.json and all files in the dist directory and its sub-directories excluding the css files.
32
- * [['dist', '!**\/*.css'], 'package.json']
33
- * // include all js and css files in the dist directory and its sub-directories excluding the minified version.
34
- * [['dist/**\/*.{js,css}', '!**\/*.min.*']]
35
- */
36
- assets?: AssetEntry | AssetEntry[] | false;
37
- /**
38
- * The message for the release commit.
39
- * @default `chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}`
40
- * @description
41
- * The message for the release commit is generated with Lodash template. The following variables are available:
42
- * | Parameter | Description |
43
- * | ----------------- | ----------- |
44
- * | branch | The branch from which the release is done. |
45
- * | branch.name | The branch name. |
46
- * | branch.type | The type of branch. |
47
- * | branch.channel | The distribution channel on which to publish releases from this branch. |
48
- * | branch.range | The range of semantic versions to support on this branch. |
49
- * | branch.prerelease | The pre-release detonation to append to semantic versions released from this branch. |
50
- * | lastRelease | Object with version, gitTag and gitHead of the last release. |
51
- * | nextRelease | Object with version, gitTag, gitHead and notes of the release being done. |
52
- *
53
- * Note: It is recommended to include `[skip ci]` in the commit message to not trigger a new build. Some CI service support the `[skip ci]` keyword only in the subject of the message.
54
- *
55
- * #### `message` examples
56
- * The `message` `Release <%= nextRelease.version %> - <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> [skip ci]\n\n<%= nextRelease.notes %>` will generate the commit message:
57
- * > Release v1.0.0 - Oct. 21, 2015 1:24 AM [skip ci]
58
- * >
59
- * > ## 1.0.0
60
- * >
61
- * > ### Features
62
- * > * Generate 1.21 gigawatts of electricity
63
- * >
64
- * > ...
65
- *
66
- */
67
- message?: string;
68
- }
6
+ import type { GlobalConfig, PrepareContext, VerifyConditionsContext } from 'semantic-release';
7
+ export type MicromatchGlob = string;
8
+ export interface AssetObject {
9
+ path: MicromatchGlob;
10
+ }
11
+ export type AssetEntry = AssetObject | MicromatchGlob;
12
+ export interface Options {
13
+ /**
14
+ * Files to include in the release commit. Set to `false` to disable adding files to the release commit.
15
+ * @default ['CHANGELOG.md','package.json','package-lock.json','npm-shrinkwrap.json']
16
+ * @description
17
+ * Can be an Array or a single entry. Each entry can be either:
18
+ * - a glob
19
+ * - or an Object with a path property containing a glob.
20
+ *
21
+ * Each entry in the assets Array is globbed individually. A glob can be a String ("dist/\*\*\/\*.js" or "dist/mylib.js") or an Array of Strings that will be globbed together (["dist/\*\*", "!\*\*\/\*.css"]).
22
+ *
23
+ * If a directory is configured, all the files under this directory and its children will be included.
24
+ *
25
+ * Note: If a file has a match in assets it will be included even if it also has a match in .gitignore.
26
+ *
27
+ * @example
28
+ * // include all js files in the dist directory, but not in its sub-directories.
29
+ * 'dist/*.js'
30
+ * // include all js files in the dist directory and its sub-directories.
31
+ * 'dist/**\/*.js'
32
+ * // include all files in the dist directory and its sub-directories excluding the css files.
33
+ * [['dist', '!**\/*.css']]
34
+ * // include package.json and all files in the dist directory and its sub-directories excluding the css files.
35
+ * [['dist', '!**\/*.css'], 'package.json']
36
+ * // include all js and css files in the dist directory and its sub-directories excluding the minified version.
37
+ * [['dist/**\/*.{js,css}', '!**\/*.min.*']]
38
+ */
39
+ assets?: AssetEntry | AssetEntry[] | false;
40
+ /**
41
+ * The message for the release commit.
42
+ * @default `chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}`
43
+ * @description
44
+ * The message for the release commit is generated with Lodash template. The following variables are available:
45
+ * | Parameter | Description |
46
+ * | ----------------- | ----------- |
47
+ * | branch | The branch from which the release is done. |
48
+ * | branch.name | The branch name. |
49
+ * | branch.type | The type of branch. |
50
+ * | branch.channel | The distribution channel on which to publish releases from this branch. |
51
+ * | branch.range | The range of semantic versions to support on this branch. |
52
+ * | branch.prerelease | The pre-release detonation to append to semantic versions released from this branch. |
53
+ * | lastRelease | Object with version, gitTag and gitHead of the last release. |
54
+ * | nextRelease | Object with version, gitTag, gitHead and notes of the release being done. |
55
+ *
56
+ * Note: It is recommended to include `[skip ci]` in the commit message to not trigger a new build. Some CI service support the `[skip ci]` keyword only in the subject of the message.
57
+ *
58
+ * #### `message` examples
59
+ * The `message` `Release <%= nextRelease.version %> - <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> [skip ci]\n\n<%= nextRelease.notes %>` will generate the commit message:
60
+ * > Release v1.0.0 - Oct. 21, 2015 1:24 AM [skip ci]
61
+ * >
62
+ * > ## 1.0.0
63
+ * >
64
+ * > ### Features
65
+ * > * Generate 1.21 gigawatts of electricity
66
+ * >
67
+ * > ...
68
+ *
69
+ */
70
+ message?: string;
71
+ }
69
72
 
70
- function verifyConditions(
71
- pluginConfig: Options,
72
- context: {
73
- options: {
74
- prepare: unknown
75
- }
76
- }
77
- ): void;
78
- async function prepare(
79
- pluginConfig: Options,
80
- context: {
81
- env,
82
- cwd: string,
83
- branch: { name: string },
84
- options: SemanticReleaseOptions,
85
- lastRelease,
86
- nextRelease: { version, notes, gitTag },
87
- logger: { log(_0: string, _1: unknown | number): void },
88
- }
89
- ): Promise<void>;
90
- export { prepare, verifyConditions };
73
+ function verifyConditions(
74
+ pluginConfig: Options,
75
+ context: VerifyConditionsContext & {
76
+ options: {
77
+ prepare: unknown;
78
+ };
79
+ },
80
+ ): void;
81
+ function prepare(
82
+ pluginConfig: Options,
83
+ context: PrepareContext & {
84
+ options: GlobalConfig;
85
+ },
86
+ ): Promise<void>;
87
+ export { prepare, verifyConditions };
91
88
  }