beachball 2.31.3 → 2.31.4
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/promptForChange.d.ts +44 -3
- package/lib/changefile/promptForChange.d.ts.map +1 -1
- package/lib/changefile/promptForChange.js +153 -116
- package/lib/changefile/promptForChange.js.map +1 -1
- package/lib/commands/change.d.ts.map +1 -1
- package/lib/commands/change.js +26 -1
- package/lib/commands/change.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,48 @@
|
|
|
1
|
-
import
|
|
1
|
+
import prompts from 'prompts';
|
|
2
|
+
import { ChangeFileInfo, ChangeType } from '../types/ChangeInfo';
|
|
2
3
|
import { BeachballOptions } from '../types/BeachballOptions';
|
|
4
|
+
import { PackageGroups, PackageInfos } from '../types/PackageInfo';
|
|
5
|
+
declare type ChangePromptResponse = {
|
|
6
|
+
type?: ChangeType;
|
|
7
|
+
comment?: string;
|
|
8
|
+
};
|
|
3
9
|
/**
|
|
4
|
-
* Uses `prompts` package to prompt for change type and description
|
|
10
|
+
* Uses `prompts` package to prompt for change type and description.
|
|
11
|
+
* (For easier testing, this function does not handle filesystem access.)
|
|
5
12
|
*/
|
|
6
|
-
export declare function promptForChange(
|
|
13
|
+
export declare function promptForChange(params: {
|
|
14
|
+
changedPackages: string[];
|
|
15
|
+
packageInfos: PackageInfos;
|
|
16
|
+
packageGroups: PackageGroups;
|
|
17
|
+
recentMessages: string[];
|
|
18
|
+
email: string | null;
|
|
19
|
+
options: BeachballOptions;
|
|
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: BeachballOptions;
|
|
30
|
+
recentMessages: string[];
|
|
31
|
+
}): prompts.PromptObject[] | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Do the actual prompting.
|
|
34
|
+
* @internal exported for testing
|
|
35
|
+
*/
|
|
36
|
+
export declare function _promptForPackageChange(questions: prompts.PromptObject[], pkg: string): Promise<ChangePromptResponse | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Validate/update the response from the user and return the full change file info.
|
|
39
|
+
* @internal exported for testing
|
|
40
|
+
*/
|
|
41
|
+
export declare function _getChangeFileInfoFromResponse(params: {
|
|
42
|
+
response: ChangePromptResponse;
|
|
43
|
+
pkg: string;
|
|
44
|
+
email: string | null;
|
|
45
|
+
options: BeachballOptions;
|
|
46
|
+
}): ChangeFileInfo | undefined;
|
|
47
|
+
export {};
|
|
7
48
|
//# sourceMappingURL=promptForChange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptForChange.d.ts","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"promptForChange.d.ts","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAI7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE,aAAK,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,gBAAgB,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,SAAS,CAAC,CAgCxC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAyErC;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,gBAAgB,CAAC;CAC3B,GAAG,cAAc,GAAG,SAAS,CAoC7B"}
|
|
@@ -3,137 +3,174 @@ 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.promptForChange = void 0;
|
|
7
|
-
const getChangedPackages_1 = require("./getChangedPackages");
|
|
8
|
-
const workspace_tools_1 = require("workspace-tools");
|
|
6
|
+
exports._getChangeFileInfoFromResponse = exports._promptForPackageChange = exports._getQuestionsForPackage = exports.promptForChange = void 0;
|
|
9
7
|
const prompts_1 = __importDefault(require("prompts"));
|
|
10
|
-
const getPackageInfos_1 = require("../monorepo/getPackageInfos");
|
|
11
8
|
const semver_1 = require("semver");
|
|
12
|
-
const getPackageGroups_1 = require("../monorepo/getPackageGroups");
|
|
13
9
|
const isValidChangeType_1 = require("../validation/isValidChangeType");
|
|
14
10
|
const getDisallowedChangeTypes_1 = require("./getDisallowedChangeTypes");
|
|
15
11
|
/**
|
|
16
|
-
* Uses `prompts` package to prompt for change type and description
|
|
12
|
+
* Uses `prompts` package to prompt for change type and description.
|
|
13
|
+
* (For easier testing, this function does not handle filesystem access.)
|
|
17
14
|
*/
|
|
18
|
-
async function promptForChange(
|
|
19
|
-
|
|
20
|
-
const { branch, path: cwd } = options;
|
|
21
|
-
let { package: specificPackage } = options;
|
|
22
|
-
if (specificPackage && !Array.isArray(specificPackage)) {
|
|
23
|
-
specificPackage = [specificPackage];
|
|
24
|
-
}
|
|
25
|
-
const packageInfos = getPackageInfos_1.getPackageInfos(cwd);
|
|
26
|
-
const changedPackages = specificPackage || getChangedPackages_1.getChangedPackages(options, packageInfos);
|
|
15
|
+
async function promptForChange(params) {
|
|
16
|
+
const { changedPackages, email, options } = params;
|
|
27
17
|
if (!changedPackages.length) {
|
|
28
18
|
return;
|
|
29
19
|
}
|
|
30
|
-
|
|
20
|
+
// Get the questions for each package first, in case one package has a validation issue
|
|
21
|
+
const packageQuestions = {};
|
|
22
|
+
for (const pkg of changedPackages) {
|
|
23
|
+
const questions = _getQuestionsForPackage({ pkg, ...params });
|
|
24
|
+
if (!questions) {
|
|
25
|
+
return; // validation issue
|
|
26
|
+
}
|
|
27
|
+
packageQuestions[pkg] = questions;
|
|
28
|
+
}
|
|
29
|
+
// Now prompt for each package
|
|
31
30
|
const packageChangeInfo = [];
|
|
32
|
-
const packageGroups = getPackageGroups_1.getPackageGroups(packageInfos, options.path, options.groups);
|
|
33
31
|
for (let pkg of changedPackages) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const packageInfo = packageInfos[pkg];
|
|
38
|
-
const showPrereleaseOption = semver_1.prerelease(packageInfo.version);
|
|
39
|
-
const changeTypePrompt = {
|
|
40
|
-
type: 'select',
|
|
41
|
-
name: 'type',
|
|
42
|
-
message: 'Change type',
|
|
43
|
-
choices: [
|
|
44
|
-
...(showPrereleaseOption ? [{ value: 'prerelease', title: ' [1mPrerelease[22m - bump prerelease version' }] : []),
|
|
45
|
-
{ value: 'patch', title: ' [1mPatch[22m - bug fixes; no API changes.' },
|
|
46
|
-
{ value: 'minor', title: ' [1mMinor[22m - small feature; backwards compatible API changes.' },
|
|
47
|
-
{
|
|
48
|
-
value: 'none',
|
|
49
|
-
title: ' [1mNone[22m - this change does not affect the published package in any way.',
|
|
50
|
-
},
|
|
51
|
-
{ value: 'major', title: ' [1mMajor[22m - major feature; breaking changes.' },
|
|
52
|
-
].filter(choice => !(disallowedChangeTypes === null || disallowedChangeTypes === void 0 ? void 0 : disallowedChangeTypes.includes(choice.value))),
|
|
53
|
-
};
|
|
54
|
-
if (changeTypePrompt.choices.length === 0) {
|
|
55
|
-
console.log('No valid changeTypes available, aborting');
|
|
56
|
-
return;
|
|
32
|
+
const response = await _promptForPackageChange(packageQuestions[pkg], pkg);
|
|
33
|
+
if (!response) {
|
|
34
|
+
return; // user cancelled
|
|
57
35
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const descriptionPrompt = {
|
|
63
|
-
type: 'autocomplete',
|
|
64
|
-
name: 'comment',
|
|
65
|
-
message: 'Describe changes (type or choose one)',
|
|
66
|
-
choices: recentMessageChoices,
|
|
67
|
-
suggest: (input) => Promise.resolve(input
|
|
68
|
-
? // do case-insensitive filtering
|
|
69
|
-
recentMessageChoices.filter(({ title }) => title.toLowerCase().startsWith(input.toLowerCase()))
|
|
70
|
-
: recentMessageChoices),
|
|
71
|
-
// prompts doesn't have proper support for "freeform" input (value not in the list), and the
|
|
72
|
-
// previously implemented hack of adding the input to the returned list from `suggest`
|
|
73
|
-
// no longer works. So this new hack adds the current input as the fallback.
|
|
74
|
-
// https://github.com/terkelg/prompts/issues/131
|
|
75
|
-
onState: function () {
|
|
76
|
-
var _a;
|
|
77
|
-
this.fallback = { title: this.input };
|
|
78
|
-
// Check to make sure there are no suggestions so we do not override a suggestion
|
|
79
|
-
if (((_a = this.suggestions) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
80
|
-
this.value = this.input;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
const showChangeTypePrompt = !options.type && changeTypePrompt.choices.length > 1;
|
|
85
|
-
const defaultPrompt = {
|
|
86
|
-
changeType: showChangeTypePrompt ? changeTypePrompt : undefined,
|
|
87
|
-
description: !options.message ? descriptionPrompt : undefined,
|
|
88
|
-
};
|
|
89
|
-
const defaultPrompts = [defaultPrompt.changeType, defaultPrompt.description];
|
|
90
|
-
const questions = (((_b = (_a = packageInfo.combinedOptions.changeFilePrompt) === null || _a === void 0 ? void 0 : _a.changePrompt) === null || _b === void 0 ? void 0 : _b.call(_a, defaultPrompt, pkg)) || defaultPrompts).filter((q) => !!q);
|
|
91
|
-
let response = {
|
|
92
|
-
type: options.type || 'none',
|
|
93
|
-
comment: options.message || '',
|
|
94
|
-
};
|
|
95
|
-
if (questions.length > 0) {
|
|
96
|
-
let isCancelled = false;
|
|
97
|
-
response = (await prompts_1.default(questions, {
|
|
98
|
-
onCancel: () => {
|
|
99
|
-
isCancelled = true;
|
|
100
|
-
},
|
|
101
|
-
}));
|
|
102
|
-
if (isCancelled) {
|
|
103
|
-
console.log('Cancelled, no change files are written');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// if type is absent in the user input, there are two possiblities for
|
|
107
|
-
// proceeding next:
|
|
108
|
-
// 1) if options.type is defined, use that
|
|
109
|
-
// 2) otherwise, we hit the edge case when options.type is undefined
|
|
110
|
-
// and there was only one possible ChangeType to display, 'none'
|
|
111
|
-
// but we didn't display it due to showChangeTypePrompt === false;
|
|
112
|
-
// so set the type to 'none'
|
|
113
|
-
if (!response.type) {
|
|
114
|
-
if (!options.type) {
|
|
115
|
-
console.log("WARN: change type 'none' assumed by default");
|
|
116
|
-
console.log('(Not what you intended? Check the repo-level and package-level beachball configs.)');
|
|
117
|
-
}
|
|
118
|
-
response = { ...response, type: options.type || 'none' };
|
|
119
|
-
}
|
|
120
|
-
// fallback to the options.message if message is absent in the user input
|
|
121
|
-
if (!response.comment && options.message) {
|
|
122
|
-
response = { ...response, comment: options.message };
|
|
123
|
-
}
|
|
124
|
-
if (!isValidChangeType_1.isValidChangeType(response.type)) {
|
|
125
|
-
console.error('Prompt response contains invalid change type.');
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
36
|
+
const change = _getChangeFileInfoFromResponse({ response, pkg, email, options });
|
|
37
|
+
if (!change) {
|
|
38
|
+
return; // validation issue
|
|
128
39
|
}
|
|
129
|
-
packageChangeInfo.push(
|
|
130
|
-
...response,
|
|
131
|
-
packageName: pkg,
|
|
132
|
-
email: workspace_tools_1.getUserEmail(cwd) || 'email not defined',
|
|
133
|
-
dependentChangeType: options.dependentChangeType || (response.type === 'none' ? 'none' : 'patch'),
|
|
134
|
-
});
|
|
40
|
+
packageChangeInfo.push(change);
|
|
135
41
|
}
|
|
136
42
|
return packageChangeInfo;
|
|
137
43
|
}
|
|
138
44
|
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
|
+
var _a, _b;
|
|
51
|
+
const { pkg, packageInfos, packageGroups, options, recentMessages } = params;
|
|
52
|
+
const disallowedChangeTypes = getDisallowedChangeTypes_1.getDisallowedChangeTypes(pkg, packageInfos, packageGroups);
|
|
53
|
+
if (options.type && (disallowedChangeTypes === null || disallowedChangeTypes === void 0 ? void 0 : disallowedChangeTypes.includes(options.type))) {
|
|
54
|
+
console.error(`Change type "${options.type}" is not allowed for package "${pkg}"`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const packageInfo = packageInfos[pkg];
|
|
58
|
+
const showPrereleaseOption = !!semver_1.prerelease(packageInfo.version);
|
|
59
|
+
const changeTypeChoices = [
|
|
60
|
+
...(showPrereleaseOption ? [{ value: 'prerelease', title: ' [1mPrerelease[22m - bump prerelease version' }] : []),
|
|
61
|
+
{ value: 'patch', title: ' [1mPatch[22m - bug fixes; no API changes.' },
|
|
62
|
+
{ value: 'minor', title: ' [1mMinor[22m - small feature; backwards compatible API changes.' },
|
|
63
|
+
{
|
|
64
|
+
value: 'none',
|
|
65
|
+
title: ' [1mNone[22m - this change does not affect the published package in any way.',
|
|
66
|
+
},
|
|
67
|
+
{ value: 'major', title: ' [1mMajor[22m - major feature; breaking changes.' },
|
|
68
|
+
].filter(choice => !(disallowedChangeTypes === null || disallowedChangeTypes === void 0 ? void 0 : disallowedChangeTypes.includes(choice.value)));
|
|
69
|
+
if (!changeTypeChoices.length) {
|
|
70
|
+
console.error(`No valid change types available for package "${pkg}"`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const changeTypePrompt = {
|
|
74
|
+
type: 'select',
|
|
75
|
+
name: 'type',
|
|
76
|
+
message: 'Change type',
|
|
77
|
+
choices: changeTypeChoices,
|
|
78
|
+
};
|
|
79
|
+
// Do case-insensitive filtering of recent commit messages
|
|
80
|
+
const recentMessageChoices = recentMessages.map(msg => ({ title: msg }));
|
|
81
|
+
const getSuggestions = (input) => input
|
|
82
|
+
? recentMessageChoices.filter(({ title }) => title.toLowerCase().startsWith(input.toLowerCase()))
|
|
83
|
+
: recentMessageChoices;
|
|
84
|
+
const descriptionPrompt = {
|
|
85
|
+
type: 'autocomplete',
|
|
86
|
+
name: 'comment',
|
|
87
|
+
message: 'Describe changes (type or choose one)',
|
|
88
|
+
choices: recentMessageChoices,
|
|
89
|
+
suggest: (input) => Promise.resolve(getSuggestions(input)),
|
|
90
|
+
// prompts doesn't have proper support for "freeform" input (value not in the list), and the
|
|
91
|
+
// previously implemented hack of adding the input to the returned list from `suggest`
|
|
92
|
+
// no longer works. So this new hack adds the current input as the fallback.
|
|
93
|
+
// https://github.com/terkelg/prompts/issues/131
|
|
94
|
+
onState: function (state) {
|
|
95
|
+
// If there are no suggestions, update the value to match the input, and unset the fallback
|
|
96
|
+
// (this.suggestions may be out of date if the user pasted text ending with a newline, so re-calculate)
|
|
97
|
+
if (!getSuggestions(this.input).length) {
|
|
98
|
+
this.value = this.input;
|
|
99
|
+
this.fallback = '';
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
const showChangeTypePrompt = !options.type && changeTypePrompt.choices.length > 1;
|
|
104
|
+
const defaultPrompt = {
|
|
105
|
+
changeType: showChangeTypePrompt ? changeTypePrompt : undefined,
|
|
106
|
+
description: !options.message ? descriptionPrompt : undefined,
|
|
107
|
+
};
|
|
108
|
+
const defaultPrompts = [defaultPrompt.changeType, defaultPrompt.description];
|
|
109
|
+
return (((_b = (_a = packageInfo.combinedOptions.changeFilePrompt) === null || _a === void 0 ? void 0 : _a.changePrompt) === null || _b === void 0 ? void 0 : _b.call(_a, defaultPrompt, pkg)) || defaultPrompts).filter((q) => !!q);
|
|
110
|
+
}
|
|
111
|
+
exports._getQuestionsForPackage = _getQuestionsForPackage;
|
|
112
|
+
/**
|
|
113
|
+
* Do the actual prompting.
|
|
114
|
+
* @internal exported for testing
|
|
115
|
+
*/
|
|
116
|
+
async function _promptForPackageChange(questions, pkg) {
|
|
117
|
+
if (!questions.length) {
|
|
118
|
+
// This MUST return an empty object rather than nothing, because returning nothing means the
|
|
119
|
+
// prompt was cancelled and the whole change prompt process should end
|
|
120
|
+
return {};
|
|
121
|
+
}
|
|
122
|
+
console.log('');
|
|
123
|
+
console.log(`Please describe the changes for: ${pkg}`);
|
|
124
|
+
let isCancelled = false;
|
|
125
|
+
const onCancel = () => {
|
|
126
|
+
isCancelled = true;
|
|
127
|
+
};
|
|
128
|
+
// onCancel is missing from the typings
|
|
129
|
+
const response = await prompts_1.default(questions, { onCancel });
|
|
130
|
+
if (isCancelled) {
|
|
131
|
+
console.log('Cancelled, no change files are written');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return response;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports._promptForPackageChange = _promptForPackageChange;
|
|
138
|
+
/**
|
|
139
|
+
* Validate/update the response from the user and return the full change file info.
|
|
140
|
+
* @internal exported for testing
|
|
141
|
+
*/
|
|
142
|
+
function _getChangeFileInfoFromResponse(params) {
|
|
143
|
+
const { pkg, email, options } = params;
|
|
144
|
+
let response = params.response;
|
|
145
|
+
// if type is absent in the user input, there are two possiblities for
|
|
146
|
+
// proceeding next:
|
|
147
|
+
// 1) if options.type is defined, use that
|
|
148
|
+
// 2) otherwise, we hit the edge case when options.type is undefined
|
|
149
|
+
// and there was only one possible ChangeType to display, 'none'
|
|
150
|
+
// but we didn't display it due to showChangeTypePrompt === false;
|
|
151
|
+
// so set the type to 'none'
|
|
152
|
+
if (!response.type) {
|
|
153
|
+
if (!options.type) {
|
|
154
|
+
console.log("WARN: change type 'none' assumed by default");
|
|
155
|
+
console.log('(Not what you intended? Check the repo-level and package-level beachball configs.)');
|
|
156
|
+
}
|
|
157
|
+
response = { ...response, type: options.type || 'none' };
|
|
158
|
+
}
|
|
159
|
+
// fallback to the options.message if message is absent in the user input
|
|
160
|
+
if (!response.comment && options.message) {
|
|
161
|
+
response = { ...response, comment: options.message };
|
|
162
|
+
}
|
|
163
|
+
// prevent invalid change types from being entered via custom prompts
|
|
164
|
+
if (!isValidChangeType_1.isValidChangeType(response.type)) {
|
|
165
|
+
console.error(`Prompt response contains invalid change type "${response.type}"`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
...response,
|
|
170
|
+
packageName: pkg,
|
|
171
|
+
email: email || 'email not defined',
|
|
172
|
+
dependentChangeType: options.dependentChangeType || (response.type === 'none' ? 'none' : 'patch'),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
exports._getChangeFileInfoFromResponse = _getChangeFileInfoFromResponse;
|
|
139
176
|
//# sourceMappingURL=promptForChange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptForChange.js","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"promptForChange.js","sourceRoot":"","sources":["../../src/changefile/promptForChange.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,mCAAoC;AAGpC,uEAAoE;AAEpE,yEAAsE;AAKtE;;;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,uBAAuB,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,CAAC,mBAAmB;SAC5B;QACD,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;KACnC;IAED,8BAA8B;IAC9B,MAAM,iBAAiB,GAAqB,EAAE,CAAC;IAC/C,KAAK,IAAI,GAAG,IAAI,eAAe,EAAE;QAC/B,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAC3E,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,iBAAiB;SAC1B;QAED,MAAM,MAAM,GAAG,8BAA8B,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OA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mB,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;KAClG,CAAC;AACJ,CAAC;AAzCD,wEAyCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/commands/change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/commands/change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,wBAAsB,MAAM,CAAC,OAAO,EAAE,gBAAgB,iBAqCrD"}
|
package/lib/commands/change.js
CHANGED
|
@@ -3,8 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.change = void 0;
|
|
4
4
|
const promptForChange_1 = require("../changefile/promptForChange");
|
|
5
5
|
const writeChangeFiles_1 = require("../changefile/writeChangeFiles");
|
|
6
|
+
const getPackageInfos_1 = require("../monorepo/getPackageInfos");
|
|
7
|
+
const workspace_tools_1 = require("workspace-tools");
|
|
8
|
+
const getChangedPackages_1 = require("../changefile/getChangedPackages");
|
|
9
|
+
const getPackageGroups_1 = require("../monorepo/getPackageGroups");
|
|
6
10
|
async function change(options) {
|
|
7
|
-
const
|
|
11
|
+
const { branch, path: cwd } = options;
|
|
12
|
+
const { package: specificPackage } = options;
|
|
13
|
+
const packageInfos = getPackageInfos_1.getPackageInfos(cwd);
|
|
14
|
+
const packageGroups = getPackageGroups_1.getPackageGroups(packageInfos, cwd, options.groups);
|
|
15
|
+
const changedPackages = typeof specificPackage === 'string'
|
|
16
|
+
? [specificPackage]
|
|
17
|
+
: Array.isArray(specificPackage)
|
|
18
|
+
? specificPackage
|
|
19
|
+
: getChangedPackages_1.getChangedPackages(options, packageInfos);
|
|
20
|
+
if (!changedPackages.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const recentMessages = workspace_tools_1.getRecentCommitMessages(branch, cwd);
|
|
24
|
+
const email = workspace_tools_1.getUserEmail(cwd);
|
|
25
|
+
const changes = await promptForChange_1.promptForChange({
|
|
26
|
+
changedPackages,
|
|
27
|
+
packageInfos,
|
|
28
|
+
packageGroups,
|
|
29
|
+
recentMessages,
|
|
30
|
+
email,
|
|
31
|
+
options,
|
|
32
|
+
});
|
|
8
33
|
if (changes) {
|
|
9
34
|
writeChangeFiles_1.writeChangeFiles({
|
|
10
35
|
changes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/commands/change.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAChE,qEAAkE;
|
|
1
|
+
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/commands/change.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAChE,qEAAkE;AAClE,iEAA8D;AAC9D,qDAAwE;AACxE,yEAAsE;AACtE,mEAAgE;AAEzD,KAAK,UAAU,MAAM,CAAC,OAAyB;IACpD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACtC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,YAAY,GAAG,iCAAe,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,mCAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1E,MAAM,eAAe,GACnB,OAAO,eAAe,KAAK,QAAQ;QACjC,CAAC,CAAC,CAAC,eAAe,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;YAChC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,uCAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAChD,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;QAC3B,OAAO;KACR;IAED,MAAM,cAAc,GAAG,yCAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,8BAAY,CAAC,GAAG,CAAC,CAAC;IAEhC,MAAM,OAAO,GAAG,MAAM,iCAAe,CAAC;QACpC,eAAe;QACf,YAAY;QACZ,aAAa;QACb,cAAc;QACd,KAAK;QACL,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE;QACX,mCAAgB,CAAC;YACf,OAAO;YACP,GAAG,EAAE,OAAO,CAAC,IAAI;YACjB,iBAAiB,EAAE,OAAO,CAAC,MAAM;YACjC,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC,CAAC;KACJ;AACH,CAAC;AArCD,wBAqCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beachball",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.4",
|
|
4
4
|
"description": "The Sunniest Semantic Version Bumper",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"jest": "28.1.3",
|
|
74
74
|
"jest-mock": "28.1.3",
|
|
75
75
|
"prettier": "2.7.1",
|
|
76
|
+
"strip-ansi": "6.0.1",
|
|
76
77
|
"tmp": "0.2.1",
|
|
77
78
|
"ts-jest": "28.0.8",
|
|
78
79
|
"typescript": "4.3.5",
|