beachball 2.49.0 → 2.49.1
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/lib/changefile/getQuestionsForPackage.d.ts +15 -0
- package/lib/changefile/getQuestionsForPackage.d.ts.map +1 -0
- package/lib/changefile/getQuestionsForPackage.js +84 -0
- package/lib/changefile/getQuestionsForPackage.js.map +1 -0
- package/lib/changefile/promptForChange.d.ts +0 -11
- package/lib/changefile/promptForChange.d.ts.map +1 -1
- package/lib/changefile/promptForChange.js +3 -70
- package/lib/changefile/promptForChange.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import prompts from 'prompts';
|
|
2
|
+
import { BeachballOptions } from '../types/BeachballOptions';
|
|
3
|
+
import { PackageGroups, PackageInfos } from '../types/PackageInfo';
|
|
4
|
+
/**
|
|
5
|
+
* Build the list of questions to ask the user for this package.
|
|
6
|
+
* Also validates the options and returns undefined if there's an issue.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getQuestionsForPackage(params: {
|
|
9
|
+
pkg: string;
|
|
10
|
+
packageInfos: PackageInfos;
|
|
11
|
+
packageGroups: PackageGroups;
|
|
12
|
+
options: Pick<BeachballOptions, 'message' | 'type'>;
|
|
13
|
+
recentMessages: string[];
|
|
14
|
+
}): prompts.PromptObject[] | undefined;
|
|
15
|
+
//# sourceMappingURL=getQuestionsForPackage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuestionsForPackage.d.ts","sourceRoot":"","sources":["../../src/changefile/getQuestionsForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;IACpD,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAkBrC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getQuestionsForPackage = void 0;
|
|
7
|
+
const semver_1 = __importDefault(require("semver"));
|
|
8
|
+
const getDisallowedChangeTypes_1 = require("./getDisallowedChangeTypes");
|
|
9
|
+
/**
|
|
10
|
+
* Build the list of questions to ask the user for this package.
|
|
11
|
+
* Also validates the options and returns undefined if there's an issue.
|
|
12
|
+
*/
|
|
13
|
+
function getQuestionsForPackage(params) {
|
|
14
|
+
const { pkg, packageInfos, options, recentMessages } = params;
|
|
15
|
+
const packageInfo = packageInfos[pkg];
|
|
16
|
+
const changeTypePrompt = getChangeTypePrompt(params);
|
|
17
|
+
if (!changeTypePrompt) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const defaultPrompt = {
|
|
21
|
+
changeType: !options.type && changeTypePrompt.choices.length > 1 ? changeTypePrompt : undefined,
|
|
22
|
+
description: !options.message ? getDescriptionPrompt(recentMessages) : undefined,
|
|
23
|
+
};
|
|
24
|
+
const questions = packageInfo.combinedOptions.changeFilePrompt?.changePrompt?.(defaultPrompt, pkg) || Object.values(defaultPrompt);
|
|
25
|
+
return questions.filter((q) => !!q);
|
|
26
|
+
}
|
|
27
|
+
exports.getQuestionsForPackage = getQuestionsForPackage;
|
|
28
|
+
function getChangeTypePrompt(params) {
|
|
29
|
+
const { pkg, packageInfos, packageGroups, options } = params;
|
|
30
|
+
const packageInfo = packageInfos[pkg];
|
|
31
|
+
const disallowedChangeTypes = (0, getDisallowedChangeTypes_1.getDisallowedChangeTypes)(pkg, packageInfos, packageGroups) || [];
|
|
32
|
+
if (options.type && disallowedChangeTypes.includes(options.type)) {
|
|
33
|
+
console.error(`Change type "${options.type}" is not allowed for package "${pkg}"`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const showPrereleaseOption = !!semver_1.default.prerelease(packageInfo.version);
|
|
37
|
+
const changeTypeChoices = [
|
|
38
|
+
...(showPrereleaseOption ? [{ value: 'prerelease', title: ' [1mPrerelease[22m - bump prerelease version' }] : []),
|
|
39
|
+
{ value: 'patch', title: ' [1mPatch[22m - bug fixes; no API changes.' },
|
|
40
|
+
{ value: 'minor', title: ' [1mMinor[22m - small feature; backwards compatible API changes.' },
|
|
41
|
+
{
|
|
42
|
+
value: 'none',
|
|
43
|
+
title: ' [1mNone[22m - this change does not affect the published package in any way.',
|
|
44
|
+
},
|
|
45
|
+
{ value: 'major', title: ' [1mMajor[22m - major feature; breaking changes.' },
|
|
46
|
+
].filter(choice => !disallowedChangeTypes?.includes(choice.value));
|
|
47
|
+
if (!changeTypeChoices.length) {
|
|
48
|
+
console.error(`No valid change types available for package "${pkg}"`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
type: 'select',
|
|
53
|
+
name: 'type',
|
|
54
|
+
message: 'Change type',
|
|
55
|
+
choices: changeTypeChoices,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function getDescriptionPrompt(recentMessages) {
|
|
59
|
+
// Do case-insensitive filtering of recent commit messages
|
|
60
|
+
const recentMessageChoices = recentMessages.map(msg => ({ title: msg }));
|
|
61
|
+
const getSuggestions = (input) => input
|
|
62
|
+
? recentMessageChoices.filter(({ title }) => title.toLowerCase().startsWith(input.toLowerCase()))
|
|
63
|
+
: recentMessageChoices;
|
|
64
|
+
return {
|
|
65
|
+
type: 'autocomplete',
|
|
66
|
+
name: 'comment',
|
|
67
|
+
message: 'Describe changes (type or choose one)',
|
|
68
|
+
choices: recentMessageChoices,
|
|
69
|
+
suggest: (input) => Promise.resolve(getSuggestions(input)),
|
|
70
|
+
// prompts doesn't have proper support for "freeform" input (value not in the list), and the
|
|
71
|
+
// previously implemented hack of adding the input to the returned list from `suggest`
|
|
72
|
+
// no longer works. So this new hack adds the current input as the fallback.
|
|
73
|
+
// https://github.com/terkelg/prompts/issues/131
|
|
74
|
+
onState: function (state) {
|
|
75
|
+
// If there are no suggestions, update the value to match the input, and unset the fallback
|
|
76
|
+
// (this.suggestions may be out of date if the user pasted text ending with a newline, so re-calculate)
|
|
77
|
+
if (!getSuggestions(this.input).length) {
|
|
78
|
+
this.value = this.input;
|
|
79
|
+
this.fallback = '';
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=getQuestionsForPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuestionsForPackage.js","sourceRoot":"","sources":["../../src/changefile/getQuestionsForPackage.ts"],"names":[],"mappings":";;;;;;AACA,oDAA4B;AAI5B,yEAAsE;AAGtE;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,MAMtC;IACC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAC9D,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAEtC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,CAAC,gBAAgB,EAAE;QACrB,OAAO;KACR;IAED,MAAM,aAAa,GAAkB;QACnC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,gBAAgB,CAAC,OAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,g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F;QAC5F,sFAAsF;QACtF,4EAA4E;QAC5E,gDAAgD;QAChD,OAAO,EAAE,UAAqB,KAAU;YACtC,2FAA2F;YAC3F,uGAAuG;YACvG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;gBACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBACxB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;aACpB;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -18,17 +18,6 @@ export declare function promptForChange(params: {
|
|
|
18
18
|
email: string | null;
|
|
19
19
|
options: Pick<BeachballOptions, 'message' | 'type' | 'dependentChangeType'>;
|
|
20
20
|
}): Promise<ChangeFileInfo[] | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Build the list of questions to ask the user for this package.
|
|
23
|
-
* @internal exported for testing
|
|
24
|
-
*/
|
|
25
|
-
export declare function _getQuestionsForPackage(params: {
|
|
26
|
-
pkg: string;
|
|
27
|
-
packageInfos: PackageInfos;
|
|
28
|
-
packageGroups: PackageGroups;
|
|
29
|
-
options: Pick<BeachballOptions, 'message' | 'type'>;
|
|
30
|
-
recentMessages: string[];
|
|
31
|
-
}): prompts.PromptObject[] | undefined;
|
|
32
21
|
/**
|
|
33
22
|
* Do the actual prompting.
|
|
34
23
|
* @internal exported for testing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptForChange.d.ts","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"promptForChange.d.ts","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGnE,KAAK,oBAAoB,GAAG;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE;;;GAGG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,MAAM,GAAG,qBAAqB,CAAC,CAAC;CAC7E,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,SAAS,CAAC,CAgCxC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,EACjC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAsB3C;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE;IACrD,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,qBAAqB,CAAC,CAAC;CAC7E,GAAG,cAAc,GAAG,SAAS,CAoC7B"}
|
|
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports._getChangeFileInfoFromResponse = exports._promptForPackageChange = exports.
|
|
6
|
+
exports._getChangeFileInfoFromResponse = exports._promptForPackageChange = exports.promptForChange = void 0;
|
|
7
7
|
const prompts_1 = __importDefault(require("prompts"));
|
|
8
|
-
const semver_1 = require("semver");
|
|
9
8
|
const isValidChangeType_1 = require("../validation/isValidChangeType");
|
|
10
|
-
const
|
|
9
|
+
const getQuestionsForPackage_1 = require("./getQuestionsForPackage");
|
|
11
10
|
/**
|
|
12
11
|
* Uses `prompts` package to prompt for change type and description.
|
|
13
12
|
* (For easier testing, this function does not handle filesystem access.)
|
|
@@ -20,7 +19,7 @@ async function promptForChange(params) {
|
|
|
20
19
|
// Get the questions for each package first, in case one package has a validation issue
|
|
21
20
|
const packageQuestions = {};
|
|
22
21
|
for (const pkg of changedPackages) {
|
|
23
|
-
const questions =
|
|
22
|
+
const questions = (0, getQuestionsForPackage_1.getQuestionsForPackage)({ pkg, ...params });
|
|
24
23
|
if (!questions) {
|
|
25
24
|
return; // validation issue
|
|
26
25
|
}
|
|
@@ -42,72 +41,6 @@ async function promptForChange(params) {
|
|
|
42
41
|
return packageChangeInfo;
|
|
43
42
|
}
|
|
44
43
|
exports.promptForChange = promptForChange;
|
|
45
|
-
/**
|
|
46
|
-
* Build the list of questions to ask the user for this package.
|
|
47
|
-
* @internal exported for testing
|
|
48
|
-
*/
|
|
49
|
-
function _getQuestionsForPackage(params) {
|
|
50
|
-
const { pkg, packageInfos, packageGroups, options, recentMessages } = params;
|
|
51
|
-
const disallowedChangeTypes = (0, getDisallowedChangeTypes_1.getDisallowedChangeTypes)(pkg, packageInfos, packageGroups);
|
|
52
|
-
if (options.type && disallowedChangeTypes?.includes(options.type)) {
|
|
53
|
-
console.error(`Change type "${options.type}" is not allowed for package "${pkg}"`);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const packageInfo = packageInfos[pkg];
|
|
57
|
-
const showPrereleaseOption = !!(0, semver_1.prerelease)(packageInfo.version);
|
|
58
|
-
const changeTypeChoices = [
|
|
59
|
-
...(showPrereleaseOption ? [{ value: 'prerelease', title: ' [1mPrerelease[22m - bump prerelease version' }] : []),
|
|
60
|
-
{ value: 'patch', title: ' [1mPatch[22m - bug fixes; no API changes.' },
|
|
61
|
-
{ value: 'minor', title: ' [1mMinor[22m - small feature; backwards compatible API changes.' },
|
|
62
|
-
{
|
|
63
|
-
value: 'none',
|
|
64
|
-
title: ' [1mNone[22m - this change does not affect the published package in any way.',
|
|
65
|
-
},
|
|
66
|
-
{ value: 'major', title: ' [1mMajor[22m - major feature; breaking changes.' },
|
|
67
|
-
].filter(choice => !disallowedChangeTypes?.includes(choice.value));
|
|
68
|
-
if (!changeTypeChoices.length) {
|
|
69
|
-
console.error(`No valid change types available for package "${pkg}"`);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const changeTypePrompt = {
|
|
73
|
-
type: 'select',
|
|
74
|
-
name: 'type',
|
|
75
|
-
message: 'Change type',
|
|
76
|
-
choices: changeTypeChoices,
|
|
77
|
-
};
|
|
78
|
-
// Do case-insensitive filtering of recent commit messages
|
|
79
|
-
const recentMessageChoices = recentMessages.map(msg => ({ title: msg }));
|
|
80
|
-
const getSuggestions = (input) => input
|
|
81
|
-
? recentMessageChoices.filter(({ title }) => title.toLowerCase().startsWith(input.toLowerCase()))
|
|
82
|
-
: recentMessageChoices;
|
|
83
|
-
const descriptionPrompt = {
|
|
84
|
-
type: 'autocomplete',
|
|
85
|
-
name: 'comment',
|
|
86
|
-
message: 'Describe changes (type or choose one)',
|
|
87
|
-
choices: recentMessageChoices,
|
|
88
|
-
suggest: (input) => Promise.resolve(getSuggestions(input)),
|
|
89
|
-
// prompts doesn't have proper support for "freeform" input (value not in the list), and the
|
|
90
|
-
// previously implemented hack of adding the input to the returned list from `suggest`
|
|
91
|
-
// no longer works. So this new hack adds the current input as the fallback.
|
|
92
|
-
// https://github.com/terkelg/prompts/issues/131
|
|
93
|
-
onState: function (state) {
|
|
94
|
-
// If there are no suggestions, update the value to match the input, and unset the fallback
|
|
95
|
-
// (this.suggestions may be out of date if the user pasted text ending with a newline, so re-calculate)
|
|
96
|
-
if (!getSuggestions(this.input).length) {
|
|
97
|
-
this.value = this.input;
|
|
98
|
-
this.fallback = '';
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
const showChangeTypePrompt = !options.type && changeTypePrompt.choices.length > 1;
|
|
103
|
-
const defaultPrompt = {
|
|
104
|
-
changeType: showChangeTypePrompt ? changeTypePrompt : undefined,
|
|
105
|
-
description: !options.message ? descriptionPrompt : undefined,
|
|
106
|
-
};
|
|
107
|
-
const defaultPrompts = [defaultPrompt.changeType, defaultPrompt.description];
|
|
108
|
-
return (packageInfo.combinedOptions.changeFilePrompt?.changePrompt?.(defaultPrompt, pkg) || defaultPrompts).filter((q) => !!q);
|
|
109
|
-
}
|
|
110
|
-
exports._getQuestionsForPackage = _getQuestionsForPackage;
|
|
111
44
|
/**
|
|
112
45
|
* Do the actual prompting.
|
|
113
46
|
* @internal exported for testing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptForChange.js","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;
|
|
1
|
+
{"version":3,"file":"promptForChange.js","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAG9B,uEAAoE;AAEpE,qEAAkE;AAIlE;;;GAGG;AACI,KAAK,UAAU,eAAe,CAAC,MAOrC;IACC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACnD,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;QAC3B,OAAO;KACR;IAED,uFAAuF;IACvF,MAAM,gBAAgB,GAA8C,EAAE,CAAC;IACvE,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,SAAS,GAAG,IAAA,+CAAsB,EAAC,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC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