@storm-software/git-tools 2.121.3 → 2.122.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.
- package/README.md +2 -1
- package/bin/{chunk-N5U2S3QK.cjs → chunk-5SPAQH6A.cjs} +10 -15
- package/bin/{chunk-QBJQH2IK.js → chunk-LBURTJLB.js} +10 -10
- package/bin/git.cjs +405 -476
- package/bin/git.js +342 -413
- package/bin/post-checkout.cjs +9 -9
- package/bin/post-checkout.js +1 -1
- package/bin/post-commit.cjs +9 -9
- package/bin/post-commit.js +1 -1
- package/bin/post-merge.cjs +9 -9
- package/bin/post-merge.js +1 -1
- package/bin/pre-commit.cjs +9 -9
- package/bin/pre-commit.js +1 -1
- package/bin/pre-install.cjs +9 -9
- package/bin/pre-install.js +1 -1
- package/bin/pre-push.cjs +13 -13
- package/bin/pre-push.js +1 -1
- package/bin/prepare.cjs +7 -7
- package/bin/prepare.js +1 -1
- package/bin/version-warning.cjs +5 -5
- package/bin/version-warning.js +1 -1
- package/dist/chunk-3GGWHKRP.js +274 -0
- package/dist/chunk-4VPJA7YJ.cjs +274 -0
- package/dist/chunk-5XU2KBM6.js +14 -0
- package/dist/chunk-F7OO6L26.cjs +78 -0
- package/dist/{chunk-RG47FAF4.cjs → chunk-GOKUSEH3.cjs} +5 -3
- package/dist/chunk-JCEVFJCA.js +42 -0
- package/dist/chunk-KZRVQ5RZ.js +78 -0
- package/dist/chunk-NY53WLGC.cjs +42 -0
- package/dist/chunk-YBAE6I5L.cjs +14 -0
- package/dist/{chunk-2IQTQBAX.js → chunk-YCEUZFMU.js} +5 -3
- package/dist/commit/minimal.cjs +4 -12
- package/dist/commit/minimal.d.cts +249 -7
- package/dist/commit/minimal.d.ts +249 -7
- package/dist/commit/minimal.js +5 -13
- package/dist/commit/monorepo.cjs +7 -3
- package/dist/commit/monorepo.d.cts +269 -4
- package/dist/commit/monorepo.d.ts +269 -4
- package/dist/commit/monorepo.js +6 -2
- package/dist/commitlint/minimal.cjs +2 -3
- package/dist/commitlint/minimal.d.cts +27 -6
- package/dist/commitlint/minimal.d.ts +27 -6
- package/dist/commitlint/minimal.js +3 -4
- package/dist/commitlint/monorepo.cjs +2 -3
- package/dist/commitlint/monorepo.d.cts +28 -6
- package/dist/commitlint/monorepo.d.ts +28 -6
- package/dist/commitlint/monorepo.js +3 -4
- package/dist/index.cjs +6 -19
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +9 -22
- package/dist/release/config.cjs +6 -3
- package/dist/release/config.d.cts +2 -1
- package/dist/release/config.d.ts +2 -1
- package/dist/release/config.js +5 -2
- package/dist/types.cjs +2 -20
- package/dist/types.d.cts +3 -250
- package/dist/types.d.ts +3 -250
- package/dist/types.js +3 -21
- package/package.json +5 -5
- package/dist/chunk-25G45MG4.js +0 -19
- package/dist/chunk-2RKFQIWE.cjs +0 -19
- package/dist/chunk-2SHAD3P5.cjs +0 -301
- package/dist/chunk-GRCMQK4Q.js +0 -301
package/bin/git.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { run } from './chunk-54Q5U5WW.js';
|
|
3
|
-
import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, findWorkspaceRootSafe, writeFatal, getWorkspaceConfig, joinPaths, writeDebug, defu, isVerbose, writeWarning, writeTrace, STORM_DEFAULT_RELEASE_BANNER, __require } from './chunk-
|
|
3
|
+
import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, findWorkspaceRootSafe, writeFatal, getWorkspaceConfig, joinPaths, writeDebug, defu, isVerbose, writeWarning, writeTrace, STORM_DEFAULT_RELEASE_BANNER, __require } from './chunk-LBURTJLB.js';
|
|
4
4
|
import TOML from '@ltd/j-toml';
|
|
5
5
|
import { Command, Option } from 'commander';
|
|
6
6
|
import { select, confirm, input } from '@inquirer/prompts';
|
|
7
7
|
import shellescape from 'any-shell-escape';
|
|
8
8
|
import chalkTemplate from 'chalk-template';
|
|
9
9
|
import fs, { readFile as readFile$1, writeFile } from 'node:fs/promises';
|
|
10
|
+
import createBasePreset from 'conventional-changelog-conventionalcommits';
|
|
11
|
+
import { readCachedProjectGraph, createProjectGraphAsync as createProjectGraphAsync$1, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph$1 } from 'nx/src/project-graph/project-graph';
|
|
10
12
|
import { existsSync } from 'fs';
|
|
11
13
|
import { readFile } from 'fs/promises';
|
|
12
14
|
import childProcess, { execSync } from 'node:child_process';
|
|
13
|
-
import { createJiti } from 'jiti';
|
|
14
|
-
import { existsSync as existsSync$1, rmSync, readdirSync, readFileSync, writeFileSync, statSync, promises } from 'node:fs';
|
|
15
15
|
import defaultRules from '@commitlint/rules';
|
|
16
16
|
import 'stream';
|
|
17
|
-
import util from 'util';
|
|
18
|
-
import {
|
|
17
|
+
import util from 'node:util';
|
|
18
|
+
import { existsSync as existsSync$1, rmSync, readdirSync, readFileSync, writeFileSync, statSync, promises } from 'node:fs';
|
|
19
19
|
import wrap from 'word-wrap';
|
|
20
20
|
import Path, { join as join$1, extname } from 'node:path';
|
|
21
21
|
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph.js';
|
|
@@ -77,7 +77,7 @@ function stringifyCargoToml(cargoToml) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// ../conventional-changelog/src/commit-types.ts
|
|
80
|
-
var
|
|
80
|
+
var DEFAULT_COMMIT_TYPES = {
|
|
81
81
|
/* --- Bumps version when selected --- */
|
|
82
82
|
"chore": {
|
|
83
83
|
"description": "Other changes that don't modify src or test files",
|
|
@@ -208,255 +208,217 @@ var COMMIT_TYPES = {
|
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
// ../conventional-changelog/src/utilities/constants.ts
|
|
211
|
-
var
|
|
212
|
-
(
|
|
213
|
-
ret[key]
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
211
|
+
var CHANGELOG_COMMIT_TYPES_OBJECT = Object.freeze(
|
|
212
|
+
Object.entries(DEFAULT_COMMIT_TYPES).reduce(
|
|
213
|
+
(ret, [key, commitType]) => {
|
|
214
|
+
ret[key] = {
|
|
215
|
+
...commitType.changelog,
|
|
216
|
+
type: key,
|
|
217
|
+
section: commitType.changelog?.title || commitType.title,
|
|
218
|
+
hidden: commitType.changelog?.hidden
|
|
219
|
+
};
|
|
220
|
+
return ret;
|
|
221
|
+
},
|
|
222
|
+
{}
|
|
223
|
+
)
|
|
222
224
|
);
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
225
|
+
var CHANGELOG_COMMIT_TYPES = [
|
|
226
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.feat,
|
|
227
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.fix,
|
|
228
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.chore,
|
|
229
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.deps,
|
|
230
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.docs,
|
|
231
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.style,
|
|
232
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.refactor,
|
|
233
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.perf,
|
|
234
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.build,
|
|
235
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.ci,
|
|
236
|
+
CHANGELOG_COMMIT_TYPES_OBJECT.test
|
|
235
237
|
];
|
|
236
|
-
|
|
238
|
+
CHANGELOG_COMMIT_TYPES.map(
|
|
237
239
|
(entry) => entry.type
|
|
238
240
|
);
|
|
239
|
-
|
|
240
|
-
(entry) => entry.
|
|
241
|
+
CHANGELOG_COMMIT_TYPES.map(
|
|
242
|
+
(entry) => entry.section
|
|
241
243
|
);
|
|
242
|
-
var MINIMAL_PARSER_DEFAULT_OPTIONS = {
|
|
243
|
-
headerPattern: /^(\w*): (.*)$/,
|
|
244
|
-
breakingHeaderPattern: /^(\w*): (.*)$/,
|
|
245
|
-
headerCorrespondence: ["type", "subject"],
|
|
246
|
-
noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
|
|
247
|
-
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
248
|
-
revertCorrespondence: ["header", "hash"],
|
|
249
|
-
issuePrefixes: ["#"]
|
|
250
|
-
};
|
|
251
|
-
var MONOREPO_PARSER_DEFAULT_OPTIONS = {
|
|
252
|
-
headerPattern: /^(\w*)(?:\((.*)\))!?: (.*)$/,
|
|
253
|
-
breakingHeaderPattern: /^(\w*)(?:\((.*)\))!: (.*)$/,
|
|
254
|
-
headerCorrespondence: ["type", "scope", "subject"],
|
|
255
|
-
noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
|
|
256
|
-
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
257
|
-
revertCorrespondence: ["header", "hash"],
|
|
258
|
-
issuePrefixes: ["#"]
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
// ../conventional-changelog/src/parser.ts
|
|
262
|
-
function createParserOpts(variant) {
|
|
263
|
-
return variant === "minimal" ? MINIMAL_PARSER_DEFAULT_OPTIONS : MONOREPO_PARSER_DEFAULT_OPTIONS;
|
|
264
|
-
}
|
|
265
244
|
|
|
266
|
-
// src/
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
).reduce((ret, type) => {
|
|
275
|
-
ret[type] = COMMIT_TYPES[type];
|
|
276
|
-
return ret;
|
|
277
|
-
}, {}),
|
|
278
|
-
defaultValue: "chore",
|
|
279
|
-
maxLength: 20,
|
|
280
|
-
minLength: 3
|
|
281
|
-
},
|
|
282
|
-
subject: {
|
|
283
|
-
type: "input",
|
|
284
|
-
title: "Commit Subject",
|
|
285
|
-
description: "Write a short, imperative tense description of the change",
|
|
286
|
-
maxLength: 150,
|
|
287
|
-
minLength: 3
|
|
288
|
-
},
|
|
289
|
-
body: {
|
|
290
|
-
type: "input",
|
|
291
|
-
title: "Commit Body",
|
|
292
|
-
description: "Provide a longer description of the change",
|
|
293
|
-
maxLength: 600
|
|
294
|
-
},
|
|
295
|
-
isBreaking: {
|
|
296
|
-
type: "confirm",
|
|
297
|
-
title: "Breaking Changes",
|
|
298
|
-
description: "Are there any breaking changes as a result of this commit?",
|
|
299
|
-
defaultValue: false
|
|
300
|
-
},
|
|
301
|
-
breakingBody: {
|
|
302
|
-
type: "input",
|
|
303
|
-
title: "Breaking Changes (Details)",
|
|
304
|
-
description: "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
|
|
305
|
-
when: (answers) => answers.isBreaking === true,
|
|
306
|
-
maxLength: 600,
|
|
307
|
-
minLength: 3
|
|
308
|
-
},
|
|
309
|
-
isIssueAffected: {
|
|
310
|
-
type: "confirm",
|
|
311
|
-
title: "Open Issue Affected",
|
|
312
|
-
description: "Does this change impact any open issues?",
|
|
313
|
-
defaultValue: false
|
|
314
|
-
},
|
|
315
|
-
issuesBody: {
|
|
316
|
-
type: "input",
|
|
317
|
-
title: "Open Issue Affected (Details)",
|
|
318
|
-
description: "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
|
|
319
|
-
when: (answers) => answers.isIssueAffected === true,
|
|
320
|
-
maxLength: 600,
|
|
321
|
-
minLength: 3
|
|
245
|
+
// ../conventional-changelog/src/configs/minimal.ts
|
|
246
|
+
var changelogs = {
|
|
247
|
+
props: {
|
|
248
|
+
ignoreCommits: void 0,
|
|
249
|
+
types: CHANGELOG_COMMIT_TYPES,
|
|
250
|
+
bumpStrict: true,
|
|
251
|
+
scope: void 0,
|
|
252
|
+
scopeOnly: false
|
|
322
253
|
}
|
|
323
254
|
};
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
255
|
+
var commitlint = {
|
|
256
|
+
helpUrl: "https://developer.stormsoftware.com/commitlint/minimal",
|
|
257
|
+
rules: {
|
|
258
|
+
"body-leading-blank": [1 /* Warning */, "always"],
|
|
259
|
+
"body-max-length": [2 /* Error */, "always", 600],
|
|
260
|
+
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
261
|
+
"footer-max-line-length": [2 /* Error */, "always", 150],
|
|
262
|
+
"header-max-length": [2 /* Error */, "always", 150],
|
|
263
|
+
"header-trim": [2 /* Error */, "always"],
|
|
264
|
+
"subject-case": [2 /* Error */, "always", ["sentence-case"]],
|
|
265
|
+
"subject-empty": [2 /* Error */, "never"],
|
|
266
|
+
"subject-full-stop": [2 /* Error */, "never", "."],
|
|
267
|
+
"subject-max-length": [2 /* Error */, "always", 150],
|
|
268
|
+
"subject-min-length": [2 /* Error */, "always", 3],
|
|
269
|
+
"type-case": [2 /* Error */, "always", "kebab-case"],
|
|
270
|
+
"type-empty": [2 /* Error */, "never"],
|
|
271
|
+
"type-enum": [
|
|
272
|
+
2 /* Error */,
|
|
273
|
+
"always",
|
|
274
|
+
Object.keys(DEFAULT_COMMIT_TYPES)
|
|
275
|
+
],
|
|
276
|
+
"type-max-length": [2 /* Error */, "always", 20],
|
|
277
|
+
"type-min-length": [2 /* Error */, "always", 3],
|
|
278
|
+
"scope-empty": [2 /* Error */, "always"]
|
|
334
279
|
},
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
var DEFAULT_COMMIT_PROMPT_MESSAGES = {
|
|
343
|
-
skip: "press enter to skip",
|
|
344
|
-
max: "must be %d chars at most",
|
|
345
|
-
min: "must be %d chars at least",
|
|
346
|
-
emptyWarning: "can not be empty",
|
|
347
|
-
upperLimitWarning: "%s is %d characters longer than the upper limit",
|
|
348
|
-
lowerLimitWarning: "%s is %d characters less than the lower limit",
|
|
349
|
-
closedIssueMessage: "Closes: "
|
|
350
|
-
};
|
|
351
|
-
var DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT = "{type}: {emoji}{subject}";
|
|
352
|
-
var DEFAULT_MINIMAL_COMMIT_SETTINGS = {
|
|
353
|
-
enableMultipleScopes: false,
|
|
354
|
-
disableEmoji: true,
|
|
355
|
-
breakingChangePrefix: "\u{1F4A3} ",
|
|
356
|
-
closedIssuePrefix: "\u2705 ",
|
|
357
|
-
format: DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT
|
|
358
|
-
};
|
|
359
|
-
var DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT = "{type}({scope}): {emoji}{subject}";
|
|
360
|
-
var DEFAULT_MONOREPO_COMMIT_SETTINGS = {
|
|
361
|
-
enableMultipleScopes: false,
|
|
362
|
-
disableEmoji: true,
|
|
363
|
-
breakingChangePrefix: "\u{1F4A3} ",
|
|
364
|
-
closedIssuePrefix: "\u2705 ",
|
|
365
|
-
format: DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT
|
|
366
|
-
};
|
|
367
|
-
var DEFAULT_MINIMAL_COMMIT_RULES = {
|
|
368
|
-
"body-leading-blank": [1 /* Warning */, "always"],
|
|
369
|
-
"body-max-length": [2 /* Error */, "always", 600],
|
|
370
|
-
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
371
|
-
"footer-max-line-length": [2 /* Error */, "always", 150],
|
|
372
|
-
"header-max-length": [2 /* Error */, "always", 150],
|
|
373
|
-
"header-trim": [2 /* Error */, "always"],
|
|
374
|
-
"subject-case": [2 /* Error */, "always", ["sentence-case"]],
|
|
375
|
-
"subject-empty": [2 /* Error */, "never"],
|
|
376
|
-
"subject-full-stop": [2 /* Error */, "never", "."],
|
|
377
|
-
"subject-max-length": [2 /* Error */, "always", 150],
|
|
378
|
-
"subject-min-length": [2 /* Error */, "always", 3],
|
|
379
|
-
"type-case": [2 /* Error */, "always", "kebab-case"],
|
|
380
|
-
"type-empty": [2 /* Error */, "never"],
|
|
381
|
-
"type-enum": [
|
|
382
|
-
2 /* Error */,
|
|
383
|
-
"always",
|
|
384
|
-
Object.keys(COMMIT_TYPES)
|
|
385
|
-
],
|
|
386
|
-
"type-max-length": [2 /* Error */, "always", 20],
|
|
387
|
-
"type-min-length": [2 /* Error */, "always", 3],
|
|
388
|
-
"scope-empty": 0 /* Disabled */,
|
|
389
|
-
"scope-case": 0 /* Disabled */,
|
|
390
|
-
"scope-enum": 0 /* Disabled */
|
|
391
|
-
};
|
|
392
|
-
var DEFAULT_MONOREPO_COMMIT_RULES = {
|
|
393
|
-
"body-leading-blank": [1 /* Warning */, "always"],
|
|
394
|
-
"body-max-length": [2 /* Error */, "always", 600],
|
|
395
|
-
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
396
|
-
"footer-max-line-length": [2 /* Error */, "always", 150],
|
|
397
|
-
"header-max-length": [2 /* Error */, "always", 150],
|
|
398
|
-
"header-trim": [2 /* Error */, "always"],
|
|
399
|
-
"subject-case": [2 /* Error */, "always", ["sentence-case"]],
|
|
400
|
-
"subject-empty": [2 /* Error */, "never"],
|
|
401
|
-
"subject-full-stop": [2 /* Error */, "never", "."],
|
|
402
|
-
"subject-max-length": [2 /* Error */, "always", 150],
|
|
403
|
-
"subject-min-length": [2 /* Error */, "always", 3],
|
|
404
|
-
"type-case": [2 /* Error */, "always", "kebab-case"],
|
|
405
|
-
"type-empty": [2 /* Error */, "never"],
|
|
406
|
-
"type-enum": [
|
|
407
|
-
2 /* Error */,
|
|
408
|
-
"always",
|
|
409
|
-
Object.keys(COMMIT_TYPES)
|
|
410
|
-
],
|
|
411
|
-
"type-max-length": [2 /* Error */, "always", 20],
|
|
412
|
-
"type-min-length": [2 /* Error */, "always", 3],
|
|
413
|
-
"scope-case": [2 /* Error */, "always", ["kebab-case"]],
|
|
414
|
-
"scope-empty": [2 /* Error */, "never"]
|
|
280
|
+
settings: {
|
|
281
|
+
enableMultipleScopes: false,
|
|
282
|
+
disableEmoji: true,
|
|
283
|
+
breakingChangePrefix: "\u{1F4A3} ",
|
|
284
|
+
closedIssuePrefix: "\u2705 ",
|
|
285
|
+
format: "{type}: {emoji}{subject}"
|
|
286
|
+
}
|
|
415
287
|
};
|
|
416
|
-
|
|
417
|
-
// src/commitlint/config/minimal.ts
|
|
418
288
|
var config = {
|
|
419
|
-
|
|
420
|
-
|
|
289
|
+
types: DEFAULT_COMMIT_TYPES,
|
|
290
|
+
changelogs,
|
|
291
|
+
commitlint
|
|
421
292
|
};
|
|
422
293
|
var minimal_default = config;
|
|
423
294
|
|
|
424
|
-
// src/
|
|
295
|
+
// ../conventional-changelog/src/configs/monorepo.ts
|
|
296
|
+
var changelogs2 = {
|
|
297
|
+
props: {
|
|
298
|
+
ignoreCommits: void 0,
|
|
299
|
+
types: CHANGELOG_COMMIT_TYPES,
|
|
300
|
+
bumpStrict: true,
|
|
301
|
+
scope: ["monorepo"],
|
|
302
|
+
scopeOnly: true
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
var commitlint2 = {
|
|
306
|
+
helpUrl: "https://developer.stormsoftware.com/commitlint/monorepo",
|
|
307
|
+
rules: {
|
|
308
|
+
"body-leading-blank": [1 /* Warning */, "always"],
|
|
309
|
+
"body-max-length": [2 /* Error */, "always", 600],
|
|
310
|
+
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
311
|
+
"footer-max-line-length": [2 /* Error */, "always", 150],
|
|
312
|
+
"header-max-length": [2 /* Error */, "always", 150],
|
|
313
|
+
"header-trim": [2 /* Error */, "always"],
|
|
314
|
+
"subject-case": [2 /* Error */, "always", ["sentence-case"]],
|
|
315
|
+
"subject-empty": [2 /* Error */, "never"],
|
|
316
|
+
"subject-full-stop": [2 /* Error */, "never", "."],
|
|
317
|
+
"subject-max-length": [2 /* Error */, "always", 150],
|
|
318
|
+
"subject-min-length": [2 /* Error */, "always", 3],
|
|
319
|
+
"type-case": [2 /* Error */, "always", "kebab-case"],
|
|
320
|
+
"type-empty": [2 /* Error */, "never"],
|
|
321
|
+
"type-enum": [
|
|
322
|
+
2 /* Error */,
|
|
323
|
+
"always",
|
|
324
|
+
Object.keys(DEFAULT_COMMIT_TYPES)
|
|
325
|
+
],
|
|
326
|
+
"type-max-length": [2 /* Error */, "always", 20],
|
|
327
|
+
"type-min-length": [2 /* Error */, "always", 3],
|
|
328
|
+
"scope-case": [2 /* Error */, "always", ["kebab-case"]],
|
|
329
|
+
"scope-empty": [2 /* Error */, "never"]
|
|
330
|
+
},
|
|
331
|
+
settings: {
|
|
332
|
+
enableMultipleScopes: false,
|
|
333
|
+
disableEmoji: true,
|
|
334
|
+
breakingChangePrefix: "\u{1F4A3} ",
|
|
335
|
+
closedIssuePrefix: "\u2705 ",
|
|
336
|
+
format: "{type}({scope}): {emoji}{subject}"
|
|
337
|
+
}
|
|
338
|
+
};
|
|
425
339
|
var config2 = {
|
|
426
|
-
|
|
427
|
-
|
|
340
|
+
types: DEFAULT_COMMIT_TYPES,
|
|
341
|
+
changelogs: changelogs2,
|
|
342
|
+
commitlint: commitlint2
|
|
428
343
|
};
|
|
429
344
|
var monorepo_default = config2;
|
|
430
345
|
|
|
431
|
-
// src/
|
|
432
|
-
var
|
|
433
|
-
async function
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
);
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
346
|
+
// ../conventional-changelog/src/configs/index.ts
|
|
347
|
+
var COMMIT_CONFIGS = { minimal: minimal_default, monorepo: monorepo_default };
|
|
348
|
+
async function getNxScopes(context) {
|
|
349
|
+
let projectGraph;
|
|
350
|
+
try {
|
|
351
|
+
projectGraph = readCachedProjectGraph();
|
|
352
|
+
} catch {
|
|
353
|
+
await createProjectGraphAsync$1();
|
|
354
|
+
projectGraph = readCachedProjectGraph();
|
|
355
|
+
}
|
|
356
|
+
if (!projectGraph) {
|
|
357
|
+
throw new Error(
|
|
358
|
+
"The commit process failed because the project graph is not available. Please run the build command again."
|
|
444
359
|
);
|
|
445
360
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
361
|
+
const projectConfigs = readProjectsConfigurationFromProjectGraph$1(projectGraph);
|
|
362
|
+
const result = Object.entries(projectConfigs.projects || {}).map(([name, project]) => ({
|
|
363
|
+
name,
|
|
364
|
+
...project
|
|
365
|
+
})).filter(
|
|
366
|
+
(project) => project.name && project.root && project.root !== "." && project.root !== context.config.workspaceRoot && !project.name.includes("e2e")
|
|
367
|
+
).filter((project) => project.targets).map((project) => project.name).filter(Boolean).sort((a, b) => a.localeCompare(b));
|
|
368
|
+
result.unshift("monorepo");
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
function getScopeEnum(context) {
|
|
372
|
+
return getNxScopes(context);
|
|
373
|
+
}
|
|
374
|
+
function getRuleFromScopeEnum(scopeEnum) {
|
|
375
|
+
if (!scopeEnum?.filter(Boolean).length) {
|
|
376
|
+
throw new Error("No scopes found in the Storm workspace.");
|
|
377
|
+
}
|
|
378
|
+
return [
|
|
379
|
+
2 /* Error */,
|
|
380
|
+
"always",
|
|
381
|
+
scopeEnum.filter(Boolean)
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// ../conventional-changelog/src/index.ts
|
|
386
|
+
async function createPreset(variant = "monorepo") {
|
|
387
|
+
const workspaceConfig = await getWorkspaceConfig();
|
|
388
|
+
if (variant === "minimal") {
|
|
389
|
+
return defu(
|
|
390
|
+
await createBasePreset({ ...COMMIT_CONFIGS.minimal.changelogs.props }),
|
|
391
|
+
{
|
|
392
|
+
...COMMIT_CONFIGS.minimal,
|
|
393
|
+
commitlint: {
|
|
394
|
+
...COMMIT_CONFIGS.minimal.commitlint,
|
|
395
|
+
regex: new RegExp(
|
|
396
|
+
`(${Object.keys(DEFAULT_COMMIT_TYPES).join("|")})!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
}
|
|
451
400
|
);
|
|
452
|
-
config5 = JSON.parse(configContent);
|
|
453
|
-
} else {
|
|
454
|
-
config5 = await jiti.import(jiti.esmResolve(configPath), { default: true });
|
|
455
401
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
402
|
+
const nxScopes = await getNxScopes({ config: workspaceConfig });
|
|
403
|
+
return defu(
|
|
404
|
+
await createBasePreset({
|
|
405
|
+
...COMMIT_CONFIGS.monorepo.changelogs.props,
|
|
406
|
+
scope: nxScopes
|
|
407
|
+
}),
|
|
408
|
+
{
|
|
409
|
+
...COMMIT_CONFIGS.monorepo,
|
|
410
|
+
commitlint: {
|
|
411
|
+
...COMMIT_CONFIGS.monorepo.commitlint,
|
|
412
|
+
rules: {
|
|
413
|
+
...COMMIT_CONFIGS.monorepo.commitlint.rules,
|
|
414
|
+
["scope-enum"]: getRuleFromScopeEnum(nxScopes)
|
|
415
|
+
},
|
|
416
|
+
regex: new RegExp(
|
|
417
|
+
`(${Object.keys(DEFAULT_COMMIT_TYPES).join("|")})\\((${nxScopes.join("|")})\\)!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
);
|
|
460
422
|
}
|
|
461
423
|
|
|
462
424
|
// ../../node_modules/.pnpm/conventional-commits-parser@6.2.0/node_modules/conventional-commits-parser/dist/regex.js
|
|
@@ -874,8 +836,8 @@ ${body}` : message;
|
|
|
874
836
|
${footer}` : message;
|
|
875
837
|
return message || "";
|
|
876
838
|
};
|
|
877
|
-
async function lint(message,
|
|
878
|
-
const parser = new CommitParser(
|
|
839
|
+
async function lint(message, config5) {
|
|
840
|
+
const parser = new CommitParser(config5.parser || {});
|
|
879
841
|
const parsed = parser.parse(message);
|
|
880
842
|
if (parsed.header === null && parsed.body === null && parsed.footer === null) {
|
|
881
843
|
return {
|
|
@@ -886,7 +848,7 @@ async function lint(message, commitlintConfig) {
|
|
|
886
848
|
};
|
|
887
849
|
}
|
|
888
850
|
const allRules = new Map(Object.entries(defaultRules));
|
|
889
|
-
const missing = Object.keys(
|
|
851
|
+
const missing = Object.keys(config5.commitlint.rules).filter(
|
|
890
852
|
(name) => typeof allRules.get(name) !== "function"
|
|
891
853
|
);
|
|
892
854
|
if (missing.length > 0) {
|
|
@@ -898,19 +860,19 @@ async function lint(message, commitlintConfig) {
|
|
|
898
860
|
].join("\n")
|
|
899
861
|
);
|
|
900
862
|
}
|
|
901
|
-
const invalid = Object.entries(
|
|
902
|
-
if (!Array.isArray(
|
|
863
|
+
const invalid = Object.entries(config5.commitlint.rules).map(([name, config6]) => {
|
|
864
|
+
if (!Array.isArray(config6)) {
|
|
903
865
|
return new Error(
|
|
904
866
|
`config for rule ${name} must be array, received ${util.inspect(
|
|
905
|
-
|
|
906
|
-
)} of type ${typeof
|
|
867
|
+
config6
|
|
868
|
+
)} of type ${typeof config6}`
|
|
907
869
|
);
|
|
908
870
|
}
|
|
909
|
-
const [level] =
|
|
910
|
-
if (level === 0 /* Disabled */ &&
|
|
871
|
+
const [level] = config6;
|
|
872
|
+
if (level === 0 /* Disabled */ && config6.length === 1) {
|
|
911
873
|
return null;
|
|
912
874
|
}
|
|
913
|
-
const [, when] =
|
|
875
|
+
const [, when] = config6;
|
|
914
876
|
if (typeof level !== "number" || isNaN(level)) {
|
|
915
877
|
return new Error(
|
|
916
878
|
`level for rule ${name} must be number, received ${util.inspect(
|
|
@@ -918,11 +880,11 @@ async function lint(message, commitlintConfig) {
|
|
|
918
880
|
)} of type ${typeof level}`
|
|
919
881
|
);
|
|
920
882
|
}
|
|
921
|
-
if (
|
|
883
|
+
if (config6.length < 2 || config6.length > 3) {
|
|
922
884
|
return new Error(
|
|
923
885
|
`config for rule ${name} must be 2 or 3 items long, received ${util.inspect(
|
|
924
|
-
|
|
925
|
-
)} of length ${
|
|
886
|
+
config6
|
|
887
|
+
)} of length ${config6.length}`
|
|
926
888
|
);
|
|
927
889
|
}
|
|
928
890
|
if (level < 0 || level > 2) {
|
|
@@ -952,10 +914,10 @@ async function lint(message, commitlintConfig) {
|
|
|
952
914
|
throw new Error(invalid.map((i) => i.message).join("\n"));
|
|
953
915
|
}
|
|
954
916
|
const pendingResults = Object.entries(
|
|
955
|
-
|
|
956
|
-
).filter(([,
|
|
957
|
-
const [name,
|
|
958
|
-
const [level, when, value] =
|
|
917
|
+
config5.commitlint.rules
|
|
918
|
+
).filter(([, config6]) => !!config6 && config6.length && config6[0] > 0).map(async (entry) => {
|
|
919
|
+
const [name, config6] = entry;
|
|
920
|
+
const [level, when, value] = config6;
|
|
959
921
|
const rule = allRules.get(name);
|
|
960
922
|
if (!rule) {
|
|
961
923
|
throw new Error(`Could not find rule implementation for ${name}`);
|
|
@@ -986,45 +948,6 @@ async function lint(message, commitlintConfig) {
|
|
|
986
948
|
input: buildCommitMessage(parsed)
|
|
987
949
|
};
|
|
988
950
|
}
|
|
989
|
-
async function getNxScopes(context) {
|
|
990
|
-
let projectGraph;
|
|
991
|
-
try {
|
|
992
|
-
projectGraph = readCachedProjectGraph();
|
|
993
|
-
} catch {
|
|
994
|
-
await createProjectGraphAsync$1();
|
|
995
|
-
projectGraph = readCachedProjectGraph();
|
|
996
|
-
}
|
|
997
|
-
if (!projectGraph) {
|
|
998
|
-
throw new Error(
|
|
999
|
-
"The commit process failed because the project graph is not available. Please run the build command again."
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
const projectConfigs = readProjectsConfigurationFromProjectGraph$1(projectGraph);
|
|
1003
|
-
const result = Object.entries(projectConfigs.projects || {}).map(([name, project]) => ({
|
|
1004
|
-
name,
|
|
1005
|
-
...project
|
|
1006
|
-
})).filter(
|
|
1007
|
-
(project) => project.name && project.root && project.root !== "." && project.root !== context.config.workspaceRoot && !project.name.includes("e2e")
|
|
1008
|
-
).filter((project) => project.targets).map((project) => project.name).filter(Boolean).sort((a, b) => a.localeCompare(b));
|
|
1009
|
-
result.unshift("monorepo");
|
|
1010
|
-
return result;
|
|
1011
|
-
}
|
|
1012
|
-
function getScopeEnumUtil(context) {
|
|
1013
|
-
return () => getScopeEnum(context);
|
|
1014
|
-
}
|
|
1015
|
-
function getScopeEnum(context) {
|
|
1016
|
-
return getNxScopes(context);
|
|
1017
|
-
}
|
|
1018
|
-
function getRuleFromScopeEnum(scopeEnum) {
|
|
1019
|
-
if (!scopeEnum?.filter(Boolean).length) {
|
|
1020
|
-
throw new Error("No scopes found in the Storm workspace.");
|
|
1021
|
-
}
|
|
1022
|
-
return [
|
|
1023
|
-
2 /* Error */,
|
|
1024
|
-
"always",
|
|
1025
|
-
scopeEnum.filter(Boolean)
|
|
1026
|
-
];
|
|
1027
|
-
}
|
|
1028
951
|
|
|
1029
952
|
// src/commitlint/run.ts
|
|
1030
953
|
var COMMIT_EDITMSG_PATH = ".git/COMMIT_EDITMSG";
|
|
@@ -1079,31 +1002,9 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
1079
1002
|
return;
|
|
1080
1003
|
}
|
|
1081
1004
|
}
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
);
|
|
1086
|
-
let commitlintRegex;
|
|
1087
|
-
const allowedTypes = commitlintConfig.rules["type-enum"] ?? COMMIT_TYPES;
|
|
1088
|
-
let allowedScopes = [];
|
|
1089
|
-
if (workspaceConfig.variant !== "minimal" && commitlintConfig.rules["scope-empty"] && commitlintConfig.rules["scope-empty"][0] !== 0 /* Disabled */) {
|
|
1090
|
-
allowedScopes = await getNxScopes({
|
|
1091
|
-
config: workspaceConfig
|
|
1092
|
-
});
|
|
1093
|
-
commitlintConfig.rules["scope-enum"] = getRuleFromScopeEnum(allowedScopes);
|
|
1094
|
-
commitlintRegex = new RegExp(
|
|
1095
|
-
`(${Object.keys(allowedTypes).join("|")})\\((${allowedScopes})\\)!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
1096
|
-
);
|
|
1097
|
-
} else {
|
|
1098
|
-
commitlintRegex = new RegExp(
|
|
1099
|
-
`(${Object.keys(allowedTypes).join("|")})!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
1100
|
-
);
|
|
1101
|
-
}
|
|
1102
|
-
const report = await lint(commitMessage, {
|
|
1103
|
-
...commitlintConfig,
|
|
1104
|
-
parserOpts: createParserOpts(workspaceConfig.variant)
|
|
1105
|
-
});
|
|
1106
|
-
if (!commitlintRegex.test(commitMessage) || report.errors.length || report.warnings.length) {
|
|
1005
|
+
const preset = await createPreset(workspaceConfig.variant);
|
|
1006
|
+
const report = await lint(commitMessage, preset);
|
|
1007
|
+
if (!preset.commitlint.regex.test(commitMessage) || report.errors.length || report.warnings.length) {
|
|
1107
1008
|
writeSuccess(
|
|
1108
1009
|
`Commit was processing completed successfully!`,
|
|
1109
1010
|
workspaceConfig
|
|
@@ -1112,14 +1013,16 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
1112
1013
|
let errorMessage = " Oh no! Your commit message: \n-------------------------------------------------------------------\n" + commitMessage + `
|
|
1113
1014
|
-------------------------------------------------------------------
|
|
1114
1015
|
|
|
1115
|
-
Does not follow the
|
|
1116
|
-
errorMessage +=
|
|
1016
|
+
Does not follow the \`${workspaceConfig.variant}\` commit message convention specified by the ${(typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name) || "Storm Software"} team.`;
|
|
1017
|
+
errorMessage += preset.changelogs.props.scope?.length ? "\ntype(scope): subject \n BLANK LINE \n body" : "\ntype: subject \n BLANK LINE \n body";
|
|
1117
1018
|
errorMessage += "\n";
|
|
1118
1019
|
errorMessage += `
|
|
1119
|
-
Possible types: ${
|
|
1120
|
-
|
|
1020
|
+
Possible types: ${preset.changelogs.props.types.map(
|
|
1021
|
+
(type) => `${type.section} (${type.type})`
|
|
1022
|
+
)}`;
|
|
1023
|
+
if (preset.changelogs.props.scope?.length) {
|
|
1121
1024
|
errorMessage += `
|
|
1122
|
-
Possible scopes: ${
|
|
1025
|
+
Possible scopes: ${preset.changelogs.props.scope} (if unsure use "monorepo")`;
|
|
1123
1026
|
}
|
|
1124
1027
|
errorMessage += "\n\nEXAMPLE: \nfeat(my-lib): add an option to generate lazy-loadable modules\nfix(monorepo)!: breaking change should have exclamation mark\n";
|
|
1125
1028
|
errorMessage += `
|
|
@@ -1130,86 +1033,116 @@ CommitLint Warnings: ${report.warnings.length ? report.warnings.map((warning) =>
|
|
|
1130
1033
|
errorMessage += "\n\nPlease fix the commit message and rerun storm-commit.";
|
|
1131
1034
|
errorMessage += `
|
|
1132
1035
|
|
|
1133
|
-
More details about the Storm Software commit message specification can be found at: ${
|
|
1036
|
+
More details about the Storm Software commit message specification can be found at: ${preset.commitlint.helpUrl}`;
|
|
1134
1037
|
throw new Error(errorMessage);
|
|
1135
1038
|
}
|
|
1136
1039
|
return report.input;
|
|
1137
1040
|
}
|
|
1138
1041
|
|
|
1042
|
+
// src/types.ts
|
|
1043
|
+
var DEFAULT_COMMIT_PROMPT_MESSAGES = {
|
|
1044
|
+
skip: "press enter to skip",
|
|
1045
|
+
max: "must be %d chars at most",
|
|
1046
|
+
min: "must be %d chars at least",
|
|
1047
|
+
emptyWarning: "can not be empty",
|
|
1048
|
+
upperLimitWarning: "%s is %d characters longer than the upper limit",
|
|
1049
|
+
lowerLimitWarning: "%s is %d characters less than the lower limit",
|
|
1050
|
+
closedIssueMessage: "Closes: "
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1139
1053
|
// src/commit/config/minimal.ts
|
|
1054
|
+
var DEFAULT_MINIMAL_COMMIT_QUESTIONS = {
|
|
1055
|
+
type: {
|
|
1056
|
+
type: "select",
|
|
1057
|
+
title: "Commit Type",
|
|
1058
|
+
description: "Select the commit type that best describes your changes",
|
|
1059
|
+
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
|
|
1060
|
+
(type) => DEFAULT_COMMIT_TYPES[type].hidden !== true
|
|
1061
|
+
).reduce((ret, type) => {
|
|
1062
|
+
ret[type] = DEFAULT_COMMIT_TYPES[type];
|
|
1063
|
+
return ret;
|
|
1064
|
+
}, {}),
|
|
1065
|
+
defaultValue: "chore",
|
|
1066
|
+
maxLength: 20,
|
|
1067
|
+
minLength: 3
|
|
1068
|
+
},
|
|
1069
|
+
subject: {
|
|
1070
|
+
type: "input",
|
|
1071
|
+
title: "Commit Subject",
|
|
1072
|
+
description: "Write a short, imperative tense description of the change",
|
|
1073
|
+
maxLength: 150,
|
|
1074
|
+
minLength: 3
|
|
1075
|
+
},
|
|
1076
|
+
body: {
|
|
1077
|
+
type: "input",
|
|
1078
|
+
title: "Commit Body",
|
|
1079
|
+
description: "Provide a longer description of the change",
|
|
1080
|
+
maxLength: 600
|
|
1081
|
+
},
|
|
1082
|
+
isBreaking: {
|
|
1083
|
+
type: "confirm",
|
|
1084
|
+
title: "Breaking Changes",
|
|
1085
|
+
description: "Are there any breaking changes as a result of this commit?",
|
|
1086
|
+
defaultValue: false
|
|
1087
|
+
},
|
|
1088
|
+
breakingBody: {
|
|
1089
|
+
type: "input",
|
|
1090
|
+
title: "Breaking Changes (Details)",
|
|
1091
|
+
description: "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
|
|
1092
|
+
when: (answers) => answers.isBreaking === true,
|
|
1093
|
+
maxLength: 600,
|
|
1094
|
+
minLength: 3
|
|
1095
|
+
},
|
|
1096
|
+
isIssueAffected: {
|
|
1097
|
+
type: "confirm",
|
|
1098
|
+
title: "Open Issue Affected",
|
|
1099
|
+
description: "Does this change impact any open issues?",
|
|
1100
|
+
defaultValue: false
|
|
1101
|
+
},
|
|
1102
|
+
issuesBody: {
|
|
1103
|
+
type: "input",
|
|
1104
|
+
title: "Open Issue Affected (Details)",
|
|
1105
|
+
description: "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
|
|
1106
|
+
when: (answers) => answers.isIssueAffected === true,
|
|
1107
|
+
maxLength: 600,
|
|
1108
|
+
minLength: 3
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1140
1111
|
var config3 = {
|
|
1141
|
-
settings:
|
|
1112
|
+
settings: COMMIT_CONFIGS.minimal.commitlint.settings,
|
|
1142
1113
|
messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
|
|
1143
1114
|
questions: DEFAULT_MINIMAL_COMMIT_QUESTIONS,
|
|
1144
|
-
types:
|
|
1115
|
+
types: DEFAULT_COMMIT_TYPES
|
|
1145
1116
|
};
|
|
1146
1117
|
var minimal_default2 = config3;
|
|
1147
1118
|
|
|
1148
1119
|
// src/commit/config/monorepo.ts
|
|
1120
|
+
var DEFAULT_MONOREPO_COMMIT_QUESTIONS = {
|
|
1121
|
+
type: DEFAULT_MINIMAL_COMMIT_QUESTIONS.type,
|
|
1122
|
+
scope: {
|
|
1123
|
+
type: "select",
|
|
1124
|
+
title: "Commit Scope",
|
|
1125
|
+
description: "Select the project that's the most impacted by this change",
|
|
1126
|
+
enum: {},
|
|
1127
|
+
defaultValue: "monorepo",
|
|
1128
|
+
maxLength: 50,
|
|
1129
|
+
minLength: 1
|
|
1130
|
+
},
|
|
1131
|
+
subject: DEFAULT_MINIMAL_COMMIT_QUESTIONS.subject,
|
|
1132
|
+
body: DEFAULT_MINIMAL_COMMIT_QUESTIONS.body,
|
|
1133
|
+
isBreaking: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isBreaking,
|
|
1134
|
+
breakingBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.breakingBody,
|
|
1135
|
+
isIssueAffected: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isIssueAffected,
|
|
1136
|
+
issuesBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.issuesBody
|
|
1137
|
+
};
|
|
1149
1138
|
var config4 = {
|
|
1150
|
-
settings:
|
|
1139
|
+
settings: COMMIT_CONFIGS.monorepo.commitlint.settings,
|
|
1151
1140
|
messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
|
|
1152
1141
|
questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
|
|
1153
|
-
types:
|
|
1142
|
+
types: DEFAULT_COMMIT_TYPES
|
|
1154
1143
|
};
|
|
1155
1144
|
var monorepo_default2 = config4;
|
|
1156
1145
|
|
|
1157
|
-
// src/commit/helpers.ts
|
|
1158
|
-
function resolveMinimalCommitOptions(config5 = minimal_default2) {
|
|
1159
|
-
return {
|
|
1160
|
-
parserPreset: "conventional-changelog-storm-software",
|
|
1161
|
-
prompt: {
|
|
1162
|
-
settings: config5.settings,
|
|
1163
|
-
messages: config5.messages,
|
|
1164
|
-
questions: config5.questions
|
|
1165
|
-
}
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
function resolveMonorepoCommitOptions(workspaceConfig, config5 = monorepo_default2) {
|
|
1169
|
-
return {
|
|
1170
|
-
utils: { getScopeEnum: getScopeEnumUtil({ config: workspaceConfig }) },
|
|
1171
|
-
parserPreset: "conventional-changelog-storm-software",
|
|
1172
|
-
prompt: {
|
|
1173
|
-
settings: config5.settings,
|
|
1174
|
-
messages: config5.messages,
|
|
1175
|
-
questions: config5.questions
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
var jiti2 = createJiti(import.meta.url, { importMeta: import.meta });
|
|
1180
|
-
async function resolveCommitConfig(workspaceConfig, configPath) {
|
|
1181
|
-
if (configPath && configPath !== "@storm-software/git-tools/commit/minimal" && configPath !== "@storm-software/git-tools/commit/monorepo") {
|
|
1182
|
-
writeInfo(
|
|
1183
|
-
`Using custom commit config file: ${configPath}`,
|
|
1184
|
-
workspaceConfig
|
|
1185
|
-
);
|
|
1186
|
-
} else {
|
|
1187
|
-
configPath = workspaceConfig?.variant === "minimal" ? "@storm-software/git-tools/commit/minimal" : "@storm-software/git-tools/commit/monorepo";
|
|
1188
|
-
writeInfo(
|
|
1189
|
-
`Using standard commit config file: ${configPath}`,
|
|
1190
|
-
workspaceConfig
|
|
1191
|
-
);
|
|
1192
|
-
}
|
|
1193
|
-
let config5 = {};
|
|
1194
|
-
if ((configPath.endsWith(".json") || configPath.endsWith(".jsonc")) && !existsSync$1(jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot))) {
|
|
1195
|
-
const configContent = await readFile$1(
|
|
1196
|
-
jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot),
|
|
1197
|
-
"utf8"
|
|
1198
|
-
);
|
|
1199
|
-
config5 = JSON.parse(configContent);
|
|
1200
|
-
} else {
|
|
1201
|
-
config5 = await jiti2.import(jiti2.esmResolve(configPath), { default: true });
|
|
1202
|
-
}
|
|
1203
|
-
const mergedConfig = {
|
|
1204
|
-
...config5 ?? {},
|
|
1205
|
-
...workspaceConfig.variant === "minimal" ? minimal_default2 : monorepo_default2
|
|
1206
|
-
};
|
|
1207
|
-
return workspaceConfig.variant === "minimal" ? resolveMinimalCommitOptions(mergedConfig) : resolveMonorepoCommitOptions(
|
|
1208
|
-
workspaceConfig,
|
|
1209
|
-
mergedConfig
|
|
1210
|
-
);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1146
|
// src/commit/commit-state.ts
|
|
1214
1147
|
function getGitDir() {
|
|
1215
1148
|
const devNull = process.platform === "win32" ? " nul" : "/dev/null";
|
|
@@ -1230,34 +1163,33 @@ async function createState(workspaceConfig, configPath) {
|
|
|
1230
1163
|
}
|
|
1231
1164
|
const state = {
|
|
1232
1165
|
variant: workspaceConfig.variant,
|
|
1233
|
-
config:
|
|
1166
|
+
config: workspaceConfig.variant === "minimal" ? minimal_default2 : monorepo_default2,
|
|
1234
1167
|
root,
|
|
1235
1168
|
answers: {}
|
|
1236
1169
|
};
|
|
1237
|
-
if (state.config.
|
|
1238
|
-
state.config.
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
);
|
|
1170
|
+
if (state.config.questions.type && state.config.questions.type.enum) {
|
|
1171
|
+
state.config.questions.type.enum = Object.keys(
|
|
1172
|
+
state.config.questions.type.enum
|
|
1173
|
+
).reduce((ret, key) => {
|
|
1174
|
+
if (state.config.questions.type.enum) {
|
|
1175
|
+
ret[key] = {
|
|
1176
|
+
...state.config.questions.type.enum[key],
|
|
1177
|
+
title: chalkTemplate`${state.config.questions.type.enum[key]?.emoji ? `${state.config.questions.type.enum[key]?.emoji} ` : ""}{bold ${key}} ${state.config.questions.type.enum[key]?.title && state.config.questions.type.enum[key]?.title !== key ? `- ${state.config.questions.type.enum[key]?.title}` : ""}${state.config.questions.type.enum[key]?.semverBump ? ` (version bump: ${state.config.questions.type.enum[key]?.semverBump})` : ""}`,
|
|
1178
|
+
hidden: false
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
return ret;
|
|
1182
|
+
}, {});
|
|
1251
1183
|
}
|
|
1252
|
-
if (workspaceConfig.variant === "monorepo" && (!state.config.
|
|
1253
|
-
state.config.
|
|
1184
|
+
if (workspaceConfig.variant === "monorepo" && (!state.config.questions?.scope || !state.config.questions?.scope.enum || Object.keys(
|
|
1185
|
+
state.config.questions?.scope.enum
|
|
1254
1186
|
).length === 0)) {
|
|
1255
1187
|
const scopes = await getScopeEnum({
|
|
1256
1188
|
config: workspaceConfig
|
|
1257
1189
|
});
|
|
1258
1190
|
for (const scope of scopes) {
|
|
1259
1191
|
if (scope === "monorepo") {
|
|
1260
|
-
state.config.
|
|
1192
|
+
state.config.questions.scope.enum[scope] = {
|
|
1261
1193
|
title: chalkTemplate`{bold monorepo} - workspace root`,
|
|
1262
1194
|
description: "The base workspace package (workspace root)",
|
|
1263
1195
|
hidden: false,
|
|
@@ -1291,7 +1223,7 @@ async function createState(workspaceConfig, configPath) {
|
|
|
1291
1223
|
const packageJson = JSON.parse(packageJsonFile);
|
|
1292
1224
|
description = packageJson.description || description;
|
|
1293
1225
|
}
|
|
1294
|
-
state.config.
|
|
1226
|
+
state.config.questions.scope.enum[scope] = {
|
|
1295
1227
|
title: chalkTemplate`{bold ${project.name}} - ${project.root}`,
|
|
1296
1228
|
description,
|
|
1297
1229
|
hidden: false,
|
|
@@ -1301,7 +1233,7 @@ async function createState(workspaceConfig, configPath) {
|
|
|
1301
1233
|
}
|
|
1302
1234
|
}
|
|
1303
1235
|
}
|
|
1304
|
-
state.answers = Object.keys(state.config.
|
|
1236
|
+
state.answers = Object.keys(state.config.questions).reduce(
|
|
1305
1237
|
(ret, key) => {
|
|
1306
1238
|
ret[key] = "";
|
|
1307
1239
|
return ret;
|
|
@@ -1331,14 +1263,11 @@ var formatCommitMessage = (state, workspaceConfig) => {
|
|
|
1331
1263
|
const scope = workspaceConfig.variant !== "minimal" && typeof answers.scope === "string" && answers.scope ? answers.scope.trim() : "";
|
|
1332
1264
|
const subject = answers.subject?.trim();
|
|
1333
1265
|
const type = answers.type;
|
|
1334
|
-
const format2 = config5.
|
|
1266
|
+
const format2 = config5.settings.format || (workspaceConfig.variant !== "minimal" ? "{type}({scope}): {emoji}{subject}" : "{type}: {emoji}{subject}");
|
|
1335
1267
|
const body = answers.body && typeof answers.body === "string" ? wrap(answers.body || "", wrapOptions) : "";
|
|
1336
1268
|
const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap(answers.breakingBody || "", wrapOptions) : "";
|
|
1337
1269
|
const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap(answers.issuesBody || "", wrapOptions) : "";
|
|
1338
|
-
const head = format2.replace(
|
|
1339
|
-
/\{emoji\}/g,
|
|
1340
|
-
config5.prompt.settings.disableEmoji ? "" : `${emoji} `
|
|
1341
|
-
).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
|
|
1270
|
+
const head = format2.replace(/\{emoji\}/g, config5.settings.disableEmoji ? "" : `${emoji} `).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
|
|
1342
1271
|
let msg = head;
|
|
1343
1272
|
if (body) {
|
|
1344
1273
|
msg += `
|
|
@@ -1346,16 +1275,16 @@ var formatCommitMessage = (state, workspaceConfig) => {
|
|
|
1346
1275
|
${body}`;
|
|
1347
1276
|
}
|
|
1348
1277
|
if (breaking) {
|
|
1349
|
-
const breakingEmoji = config5.
|
|
1278
|
+
const breakingEmoji = config5.settings.disableEmoji ? "" : config5.settings.breakingChangePrefix;
|
|
1350
1279
|
msg += `
|
|
1351
1280
|
|
|
1352
1281
|
BREAKING CHANGE: ${breakingEmoji}${breaking}`;
|
|
1353
1282
|
}
|
|
1354
1283
|
if (issues) {
|
|
1355
|
-
const closedIssueEmoji = config5.
|
|
1284
|
+
const closedIssueEmoji = config5.settings.disableEmoji ? "" : config5.settings.closedIssuePrefix;
|
|
1356
1285
|
msg += `
|
|
1357
1286
|
|
|
1358
|
-
${closedIssueEmoji}${config5.
|
|
1287
|
+
${closedIssueEmoji}${config5.settings.closedIssueMessage}${issues}`;
|
|
1359
1288
|
}
|
|
1360
1289
|
return msg;
|
|
1361
1290
|
};
|
|
@@ -1363,7 +1292,7 @@ ${closedIssueEmoji}${config5.prompt.settings.closedIssueMessage}${issues}`;
|
|
|
1363
1292
|
// src/commit/run.ts
|
|
1364
1293
|
async function runCommit(commitizenFile, dryRun = false) {
|
|
1365
1294
|
const workspaceConfig = await getWorkspaceConfig();
|
|
1366
|
-
const state = await createState(workspaceConfig
|
|
1295
|
+
const state = await createState(workspaceConfig);
|
|
1367
1296
|
if (dryRun) {
|
|
1368
1297
|
writeInfo("Running in dry mode.", workspaceConfig);
|
|
1369
1298
|
}
|
|
@@ -1400,11 +1329,11 @@ async function runCommit(commitizenFile, dryRun = false) {
|
|
|
1400
1329
|
}
|
|
1401
1330
|
async function askQuestions(state) {
|
|
1402
1331
|
let index = 0;
|
|
1403
|
-
for (const key of Object.keys(state.config.
|
|
1404
|
-
if (state.config.
|
|
1332
|
+
for (const key of Object.keys(state.config.questions)) {
|
|
1333
|
+
if (state.config.questions[key] && !state.config.questions[key].hidden && (!state.config.questions[key].when || state.config.questions[key].when(state.answers))) {
|
|
1405
1334
|
state.answers[key] = await askQuestion(
|
|
1406
1335
|
index,
|
|
1407
|
-
state.config.
|
|
1336
|
+
state.config.questions[key]
|
|
1408
1337
|
);
|
|
1409
1338
|
index++;
|
|
1410
1339
|
}
|
|
@@ -4252,7 +4181,7 @@ ${workspaceConfig.release.footer}
|
|
|
4252
4181
|
// src/release/config.ts
|
|
4253
4182
|
var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
|
|
4254
4183
|
questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
|
|
4255
|
-
types:
|
|
4184
|
+
types: DEFAULT_COMMIT_TYPES
|
|
4256
4185
|
};
|
|
4257
4186
|
var DEFAULT_RELEASE_GROUP_CONFIG = {
|
|
4258
4187
|
projectsRelationship: "independent",
|