beachball 2.29.1 → 2.30.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/lib/bump/gatherBumpInfo.d.ts.map +1 -1
- package/lib/bump/gatherBumpInfo.js +2 -24
- package/lib/bump/gatherBumpInfo.js.map +1 -1
- package/lib/bump/performBump.js +26 -39
- package/lib/bump/performBump.js.map +1 -1
- package/lib/changefile/getPackageChangeTypes.js +4 -1
- package/lib/changefile/getPackageChangeTypes.js.map +1 -1
- package/lib/changefile/promptForChange.js +96 -102
- package/lib/changefile/promptForChange.js.map +1 -1
- package/lib/changefile/readChangeFiles.d.ts +11 -0
- package/lib/changefile/readChangeFiles.d.ts.map +1 -1
- package/lib/changefile/readChangeFiles.js +37 -20
- package/lib/changefile/readChangeFiles.js.map +1 -1
- package/lib/changelog/getPackageChangelogs.js +9 -13
- package/lib/changelog/getPackageChangelogs.js.map +1 -1
- package/lib/changelog/renderChangelog.js +38 -46
- package/lib/changelog/renderChangelog.js.map +1 -1
- package/lib/changelog/renderPackageChangelog.js +49 -72
- package/lib/changelog/renderPackageChangelog.js.map +1 -1
- package/lib/changelog/writeChangelog.js +90 -105
- package/lib/changelog/writeChangelog.js.map +1 -1
- package/lib/cli.js +6 -15
- package/lib/cli.js.map +1 -1
- package/lib/commands/bump.js +3 -14
- package/lib/commands/bump.js.map +1 -1
- package/lib/commands/canary.js +25 -36
- package/lib/commands/canary.js.map +1 -1
- package/lib/commands/change.js +10 -21
- package/lib/commands/change.js.map +1 -1
- package/lib/commands/init.js +23 -34
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/publish.js +70 -81
- package/lib/commands/publish.js.map +1 -1
- package/lib/commands/sync.js +18 -29
- package/lib/commands/sync.js.map +1 -1
- package/lib/options/getCliOptions.js +11 -13
- package/lib/options/getCliOptions.js.map +1 -1
- package/lib/options/getOptions.js +1 -1
- package/lib/options/getOptions.js.map +1 -1
- package/lib/options/getPackageOptions.js +6 -1
- package/lib/options/getPackageOptions.js.map +1 -1
- package/lib/packageManager/listPackageVersions.js +37 -52
- package/lib/packageManager/listPackageVersions.js.map +1 -1
- package/lib/packageManager/npm.js +23 -22
- package/lib/packageManager/npm.js.map +1 -1
- package/lib/publish/bumpAndPush.js +56 -67
- package/lib/publish/bumpAndPush.js.map +1 -1
- package/lib/publish/getNewPackages.js +14 -25
- package/lib/publish/getNewPackages.js.map +1 -1
- package/lib/publish/publishToRegistry.js +79 -90
- package/lib/publish/publishToRegistry.js.map +1 -1
- package/lib/publish/validatePackageVersions.js +21 -32
- package/lib/publish/validatePackageVersions.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherBumpInfo.d.ts","sourceRoot":"","sources":["../../src/bump/gatherBumpInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"gatherBumpInfo.d.ts","sourceRoot":"","sources":["../../src/bump/gatherBumpInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA+BpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,GAAG,QAAQ,CAK9F"}
|
|
@@ -1,39 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.gatherBumpInfo = void 0;
|
|
7
4
|
const getPackageChangeTypes_1 = require("../changefile/getPackageChangeTypes");
|
|
8
5
|
const readChangeFiles_1 = require("../changefile/readChangeFiles");
|
|
9
6
|
const bumpInPlace_1 = require("./bumpInPlace");
|
|
10
7
|
const getScopedPackages_1 = require("../monorepo/getScopedPackages");
|
|
11
|
-
const paths_1 = require("../paths");
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
8
|
function gatherPreBumpInfo(options, packageInfos) {
|
|
14
|
-
const { path: cwd } = options;
|
|
15
9
|
// Collate the changes per package
|
|
16
10
|
const changes = readChangeFiles_1.readChangeFiles(options, packageInfos);
|
|
17
|
-
const changePath = paths_1.getChangePath(cwd);
|
|
18
11
|
// const dependentChangeTypes: BumpInfo['dependentChangeTypes'] = {};
|
|
19
12
|
const groupOptions = {};
|
|
20
|
-
// Clear changes for non-existent and accidental private packages
|
|
21
|
-
// NOTE: likely these are from the same PR that deleted or modified the private flag
|
|
22
|
-
const filteredChanges = changes.filter(({ changeFile, change }) => {
|
|
23
|
-
const errorType = !packageInfos[change.packageName]
|
|
24
|
-
? 'nonexistent'
|
|
25
|
-
: packageInfos[change.packageName].private
|
|
26
|
-
? 'private'
|
|
27
|
-
: undefined;
|
|
28
|
-
if (errorType) {
|
|
29
|
-
const resolution = options.groupChanges ? 'remove the entry from this file' : 'delete this file';
|
|
30
|
-
console.warn(`Change detected for ${errorType} package ${change.packageName}; ${resolution}: "${path_1.default.resolve(changePath, changeFile)}"`);
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
});
|
|
35
13
|
// Clear non-existent packages from changefiles infos
|
|
36
|
-
const calculatedChangeTypes = getPackageChangeTypes_1.initializePackageChangeInfo(
|
|
14
|
+
const calculatedChangeTypes = getPackageChangeTypes_1.initializePackageChangeInfo(changes);
|
|
37
15
|
Object.keys(calculatedChangeTypes).forEach(packageName => {
|
|
38
16
|
if (!packageInfos[packageName]) {
|
|
39
17
|
delete calculatedChangeTypes[packageName];
|
|
@@ -43,7 +21,7 @@ function gatherPreBumpInfo(options, packageInfos) {
|
|
|
43
21
|
calculatedChangeTypes,
|
|
44
22
|
packageInfos,
|
|
45
23
|
packageGroups: {},
|
|
46
|
-
changeFileChangeInfos:
|
|
24
|
+
changeFileChangeInfos: changes,
|
|
47
25
|
modifiedPackages: new Set(),
|
|
48
26
|
newPackages: new Set(),
|
|
49
27
|
scopedPackages: new Set(getScopedPackages_1.getScopedPackages(options, packageInfos)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherBumpInfo.js","sourceRoot":"","sources":["../../src/bump/gatherBumpInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gatherBumpInfo.js","sourceRoot":"","sources":["../../src/bump/gatherBumpInfo.ts"],"names":[],"mappings":";;;AAAA,+EAAkH;AAClH,mEAAgE;AAEhE,+CAA4C;AAE5C,qEAAkE;AAGlE,SAAS,iBAAiB,CAAC,OAAyB,EAAE,YAA0B;IAC9E,kCAAkC;IAClC,MAAM,OAAO,GAAG,iCAAe,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAEvD,qEAAqE;IACrE,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,qDAAqD;IACrD,MAAM,qBAAqB,GAAG,mDAA4B,CAAC,OAAO,CAAC,CAAC;IACpE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACvD,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YAC9B,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,qBAAqB;QACrB,YAAY;QACZ,aAAa,EAAE,EAAE;QACjB,qBAAqB,EAAE,OAAO;QAC9B,gBAAgB,EAAE,IAAI,GAAG,EAAU;QACnC,WAAW,EAAE,IAAI,GAAG,EAAU;QAC9B,cAAc,EAAE,IAAI,GAAG,CAAC,qCAAiB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjE,kBAAkB,EAAE,EAAE;QACtB,YAAY;QACZ,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED,SAAgB,cAAc,CAAC,OAAyB,EAAE,YAA0B;IAClF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE1D,yBAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,QAAQ,CAAC;AAClB,CAAC;AALD,wCAKC"}
|
package/lib/bump/performBump.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -62,42 +53,38 @@ exports.updatePackageLock = updatePackageLock;
|
|
|
62
53
|
*
|
|
63
54
|
* deletes change files, update package.json, and changelogs
|
|
64
55
|
*/
|
|
65
|
-
function performBump(bumpInfo, options) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return bumpInfo;
|
|
81
|
-
});
|
|
56
|
+
async function performBump(bumpInfo, options) {
|
|
57
|
+
const { modifiedPackages, packageInfos, changeFileChangeInfos, dependentChangedBy, calculatedChangeTypes } = bumpInfo;
|
|
58
|
+
await callHook('prebump', bumpInfo, options);
|
|
59
|
+
writePackageJson(modifiedPackages, packageInfos);
|
|
60
|
+
updatePackageLock(options.path);
|
|
61
|
+
if (options.generateChangelog) {
|
|
62
|
+
// Generate changelog
|
|
63
|
+
await writeChangelog_1.writeChangelog(options, changeFileChangeInfos, calculatedChangeTypes, dependentChangedBy, packageInfos);
|
|
64
|
+
}
|
|
65
|
+
if (!options.keepChangeFiles) {
|
|
66
|
+
// Unlink changelogs
|
|
67
|
+
unlinkChangeFiles_1.unlinkChangeFiles(changeFileChangeInfos, packageInfos, options.path);
|
|
68
|
+
}
|
|
69
|
+
await callHook('postbump', bumpInfo, options);
|
|
70
|
+
return bumpInfo;
|
|
82
71
|
}
|
|
83
72
|
exports.performBump = performBump;
|
|
84
73
|
/**
|
|
85
74
|
* Calls a specified hook for each package being bumped
|
|
86
75
|
*/
|
|
87
|
-
function callHook(hookName, bumpInfo, options) {
|
|
76
|
+
async function callHook(hookName, bumpInfo, options) {
|
|
88
77
|
var _a;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
yield hookRet;
|
|
99
|
-
}
|
|
78
|
+
const hook = (_a = options.hooks) === null || _a === void 0 ? void 0 : _a[hookName];
|
|
79
|
+
if (!hook) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const packageName of bumpInfo.modifiedPackages) {
|
|
83
|
+
const packageInfo = bumpInfo.packageInfos[packageName];
|
|
84
|
+
const hookRet = hook(path_1.default.dirname(packageInfo.packageJsonPath), packageName, packageInfo.version);
|
|
85
|
+
if (hookRet instanceof Promise) {
|
|
86
|
+
await hookRet;
|
|
100
87
|
}
|
|
101
|
-
}
|
|
88
|
+
}
|
|
102
89
|
}
|
|
103
90
|
//# sourceMappingURL=performBump.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performBump.js","sourceRoot":"","sources":["../../src/bump/performBump.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"performBump.js","sourceRoot":"","sources":["../../src/bump/performBump.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AACxB,uEAAoE;AACpE,gEAA6D;AAI7D,qDAAkD;AAClD,+CAA4C;AAE5C,SAAgB,gBAAgB,CAAC,gBAA6B,EAAE,YAA0B;IACxF,KAAK,MAAM,OAAO,IAAI,gBAAgB,EAAE;QACtC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,WAAW,GAAG,kBAAE,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAE1D,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAEnC,CAAC,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACxE,mGAAmG;YACnG,MAAM,mBAAmB,GAA6B,IAAY,CAAC,OAAO,CAAC,CAAC;YAC5E,IAAI,mBAAmB,EAAE;gBACvB,wFAAwF;gBACxF,2FAA2F;gBAC3F,qCAAqC;gBACrC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAE/F,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;oBAC9B,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE;wBACrD,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,mBAAmB,CA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AAC,OAAO,CAAC,eAAe,EAAE;QAC5B,oBAAoB;QACpB,qCAAiB,CAAC,qBAAqB,EAAE,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;KACtE;IAED,MAAM,QAAQ,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO,QAAQ,CAAC;AAClB,CAAC;AArBD,kCAqBC;AAED;;GAEG;AACH,KAAK,UAAU,QAAQ,CAAC,QAA4B,EAAE,QAAkB,EAAE,OAAyB;;IACjG,MAAM,IAAI,GAAG,MAAA,OAAO,CAAC,KAAK,0CAAG,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,gBAAgB,EAAE;QACnD,MAAM,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;QAClG,IAAI,OAAO,YAAY,OAAO,EAAE;YAC9B,MAAM,OAAO,CAAC;SACf;KACF;AACH,CAAC"}
|
|
@@ -52,7 +52,10 @@ function getAllowedChangeType(changeType, disallowedChangeTypes) {
|
|
|
52
52
|
}
|
|
53
53
|
exports.getAllowedChangeType = getAllowedChangeType;
|
|
54
54
|
function updateChangeInfoWithMaxType(changeInfo, inputA, inputB, disallowedChangeTypes) {
|
|
55
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
...changeInfo,
|
|
57
|
+
type: getMaxChangeType(inputA, inputB, disallowedChangeTypes),
|
|
58
|
+
};
|
|
56
59
|
}
|
|
57
60
|
exports.updateChangeInfoWithMaxType = updateChangeInfoWithMaxType;
|
|
58
61
|
function getMaxChangeType(inputA, inputB, disallowedChangeTypes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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ACZ,OAAO,MAAM,CAAC;KACf;IAED,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,CAAC,CAAC;KACV;IAED,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,CAAC,CAAC;KACV;IAED,IAAI,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QAC7B,OAAO,CAAC,CAAC;KACV;SAAM;QACL,OAAO,CAAC,CAAC;KACV;AACH,CAAC;AArBD,4CAqBC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -24,107 +15,110 @@ const getDisallowedChangeTypes_1 = require("./getDisallowedChangeTypes");
|
|
|
24
15
|
/**
|
|
25
16
|
* Uses `prompts` package to prompt for change type and description, fills in git user.email and scope
|
|
26
17
|
*/
|
|
27
|
-
function promptForChange(options) {
|
|
18
|
+
async function promptForChange(options) {
|
|
28
19
|
var _a, _b;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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);
|
|
27
|
+
const recentMessages = workspace_tools_1.getRecentCommitMessages(branch, cwd) || [];
|
|
28
|
+
const packageChangeInfo = [];
|
|
29
|
+
const packageGroups = getPackageGroups_1.getPackageGroups(packageInfos, options.path, options.groups);
|
|
30
|
+
for (let pkg of changedPackages) {
|
|
31
|
+
console.log('');
|
|
32
|
+
console.log(`Please describe the changes for: ${pkg}`);
|
|
33
|
+
const disallowedChangeTypes = getDisallowedChangeTypes_1.getDisallowedChangeTypes(pkg, packageInfos, packageGroups);
|
|
34
|
+
const packageInfo = packageInfos[pkg];
|
|
35
|
+
const showPrereleaseOption = semver_1.prerelease(packageInfo.version);
|
|
36
|
+
const changeTypePrompt = {
|
|
37
|
+
type: 'select',
|
|
38
|
+
name: 'type',
|
|
39
|
+
message: 'Change type',
|
|
40
|
+
choices: [
|
|
41
|
+
...(showPrereleaseOption ? [{ value: 'prerelease', title: ' [1mPrerelease[22m - bump prerelease version' }] : []),
|
|
42
|
+
{ value: 'patch', title: ' [1mPatch[22m - bug fixes; no API changes.' },
|
|
43
|
+
{ value: 'minor', title: ' [1mMinor[22m - small feature; backwards compatible API changes.' },
|
|
44
|
+
{
|
|
45
|
+
value: 'none',
|
|
46
|
+
title: ' [1mNone[22m - this change does not affect the published package in any way.',
|
|
47
|
+
},
|
|
48
|
+
{ value: 'major', title: ' [1mMajor[22m - major feature; breaking changes.' },
|
|
49
|
+
].filter(choice => !(disallowedChangeTypes === null || disallowedChangeTypes === void 0 ? void 0 : disallowedChangeTypes.includes(choice.value))),
|
|
50
|
+
};
|
|
51
|
+
if (changeTypePrompt.choices.length === 0) {
|
|
52
|
+
console.log('No valid changeTypes available, aborting');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (options.type && (disallowedChangeTypes === null || disallowedChangeTypes === void 0 ? void 0 : disallowedChangeTypes.includes(options.type))) {
|
|
56
|
+
console.log(`${options.type} type is not allowed, aborting`);
|
|
57
|
+
return;
|
|
34
58
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const descriptionPrompt = {
|
|
60
|
+
type: 'autocomplete',
|
|
61
|
+
name: 'comment',
|
|
62
|
+
message: 'Describe changes (type or choose one)',
|
|
63
|
+
suggest: input => {
|
|
64
|
+
return Promise.resolve([...recentMessages.filter(msg => msg.startsWith(input)), input]);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const showChangeTypePrompt = !options.type && changeTypePrompt.choices.length > 1;
|
|
68
|
+
const defaultPrompt = {
|
|
69
|
+
changeType: showChangeTypePrompt ? changeTypePrompt : undefined,
|
|
70
|
+
description: !options.message ? descriptionPrompt : undefined,
|
|
71
|
+
};
|
|
72
|
+
let questions = [defaultPrompt.changeType, defaultPrompt.description];
|
|
73
|
+
if ((_a = packageInfo.combinedOptions.changeFilePrompt) === null || _a === void 0 ? void 0 : _a.changePrompt) {
|
|
74
|
+
/**
|
|
75
|
+
* We are providing the package name also as the parameter so
|
|
76
|
+
* that the custom changelog can be specified at the package level
|
|
77
|
+
*/
|
|
78
|
+
questions = (_b = packageInfo.combinedOptions.changeFilePrompt) === null || _b === void 0 ? void 0 : _b.changePrompt(defaultPrompt, pkg);
|
|
79
|
+
}
|
|
80
|
+
questions = questions.filter(q => !!q);
|
|
81
|
+
let response = {
|
|
82
|
+
type: options.type || 'none',
|
|
83
|
+
comment: options.message || '',
|
|
84
|
+
};
|
|
85
|
+
if (questions.length > 0) {
|
|
86
|
+
response = (await prompts_1.default(questions));
|
|
87
|
+
if (Object.keys(response).length === 0) {
|
|
88
|
+
console.log('Cancelled, no change files are written');
|
|
63
89
|
return;
|
|
64
90
|
}
|
|
65
|
-
if
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
// if type is absent in the user input, there are two possiblities for
|
|
92
|
+
// proceeding next:
|
|
93
|
+
// 1) if options.type is defined, use that
|
|
94
|
+
// 2) otherwise, we hit the edge case when options.type is undefined
|
|
95
|
+
// and there was only one possible ChangeType to display, 'none'
|
|
96
|
+
// but we didn't display it due to showChangeTypePrompt === false;
|
|
97
|
+
// so set the type to 'none'
|
|
98
|
+
if (!response.type) {
|
|
99
|
+
if (!options.type) {
|
|
100
|
+
console.log("WARN: change type 'none' assumed by default");
|
|
101
|
+
console.log('(Not what you intended? Check the repo-level and package-level beachball configs.)');
|
|
102
|
+
}
|
|
103
|
+
response = { ...response, type: options.type || 'none' };
|
|
68
104
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
message: 'Describe changes (type or choose one)',
|
|
73
|
-
suggest: input => {
|
|
74
|
-
return Promise.resolve([...recentMessages.filter(msg => msg.startsWith(input)), input]);
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
const showChangeTypePrompt = !options.type && changeTypePrompt.choices.length > 1;
|
|
78
|
-
const defaultPrompt = {
|
|
79
|
-
changeType: showChangeTypePrompt ? changeTypePrompt : undefined,
|
|
80
|
-
description: !options.message ? descriptionPrompt : undefined,
|
|
81
|
-
};
|
|
82
|
-
let questions = [defaultPrompt.changeType, defaultPrompt.description];
|
|
83
|
-
if ((_a = packageInfo.combinedOptions.changeFilePrompt) === null || _a === void 0 ? void 0 : _a.changePrompt) {
|
|
84
|
-
/**
|
|
85
|
-
* We are providing the package name also as the parameter so
|
|
86
|
-
* that the custom changelog can be specified at the package level
|
|
87
|
-
*/
|
|
88
|
-
questions = (_b = packageInfo.combinedOptions.changeFilePrompt) === null || _b === void 0 ? void 0 : _b.changePrompt(defaultPrompt, pkg);
|
|
105
|
+
// fallback to the options.message if message is absent in the user input
|
|
106
|
+
if (!response.comment && options.message) {
|
|
107
|
+
response = { ...response, comment: options.message };
|
|
89
108
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
comment: options.message || '',
|
|
94
|
-
};
|
|
95
|
-
if (questions.length > 0) {
|
|
96
|
-
response = (yield prompts_1.default(questions));
|
|
97
|
-
if (Object.keys(response).length === 0) {
|
|
98
|
-
console.log('Cancelled, no change files are written');
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// if type is absent in the user input, there are two possiblities for
|
|
102
|
-
// proceeding next:
|
|
103
|
-
// 1) if options.type is defined, use that
|
|
104
|
-
// 2) otherwise, we hit the edge case when options.type is undefined
|
|
105
|
-
// and there was only one possible ChangeType to display, 'none'
|
|
106
|
-
// but we didn't display it due to showChangeTypePrompt === false;
|
|
107
|
-
// so set the type to 'none'
|
|
108
|
-
if (!response.type) {
|
|
109
|
-
if (!options.type) {
|
|
110
|
-
console.log("WARN: change type 'none' assumed by default");
|
|
111
|
-
console.log('(Not what you intended? Check the repo-level and package-level beachball configs.)');
|
|
112
|
-
}
|
|
113
|
-
response = Object.assign(Object.assign({}, response), { type: options.type || 'none' });
|
|
114
|
-
}
|
|
115
|
-
// fallback to the options.message if message is absent in the user input
|
|
116
|
-
if (!response.comment && options.message) {
|
|
117
|
-
response = Object.assign(Object.assign({}, response), { comment: options.message });
|
|
118
|
-
}
|
|
119
|
-
if (!isValidChangeType_1.isValidChangeType(response.type)) {
|
|
120
|
-
console.error('Prompt response contains invalid change type.');
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
109
|
+
if (!isValidChangeType_1.isValidChangeType(response.type)) {
|
|
110
|
+
console.error('Prompt response contains invalid change type.');
|
|
111
|
+
return;
|
|
123
112
|
}
|
|
124
|
-
packageChangeInfo.push(Object.assign(Object.assign({}, response), { packageName: pkg, email: workspace_tools_1.getUserEmail(cwd) || 'email not defined', dependentChangeType: options.dependentChangeType || (response.type === 'none' ? 'none' : 'patch') }));
|
|
125
113
|
}
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
packageChangeInfo.push({
|
|
115
|
+
...response,
|
|
116
|
+
packageName: pkg,
|
|
117
|
+
email: workspace_tools_1.getUserEmail(cwd) || 'email not defined',
|
|
118
|
+
dependentChangeType: options.dependentChangeType || (response.type === 'none' ? 'none' : 'patch'),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return packageChangeInfo;
|
|
128
122
|
}
|
|
129
123
|
exports.promptForChange = promptForChange;
|
|
130
124
|
//# 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":";;;;;;AACA,6DAA0D;AAC1D,qDAAwE;AACxE,sDAA8B;AAC9B,iEAA8D;AAC9D,mCAAoC;AAEpC,mEAAgE;AAChE,uEAAoE;AAEpE,yEAAsE;AAEtE;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,OAAyB;;IAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAE3C,IAAI,eAAe,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QACtD,eAAe,GAAG,CAAC,eAAe,CAAC,CAAC;KACrC;IACD,MAAM,YAAY,GAAG,iCAAe,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,eAAe,IA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ED,IAAI,CAAC,qCAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBAC/D,OAAO;aACR;SACF;QAED,iBAAiB,CAAC,IAAI,CAAC;YACrB,GAAG,QAAQ;YACX,WAAW,EAAE,GAAG;YAChB,KAAK,EAAE,8BAAY,CAAC,GAAG,CAAC,IAAI,mBAAmB;YAC/C,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SAClG,CAAC,CAAC;KACJ;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AA9HD,0CA8HC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { ChangeSet } from '../types/ChangeInfo';
|
|
2
2
|
import { BeachballOptions } from '../types/BeachballOptions';
|
|
3
3
|
import { PackageInfos } from '../types/PackageInfo';
|
|
4
|
+
/**
|
|
5
|
+
* Read change files, excluding any changes for packages that are:
|
|
6
|
+
* - out of scope (as defined in `options.scope`)
|
|
7
|
+
* - private
|
|
8
|
+
* - nonexistent
|
|
9
|
+
*
|
|
10
|
+
* The changes will also be transformed if `options.transform.changeFiles` is provided.
|
|
11
|
+
*
|
|
12
|
+
* Changes from grouped change files will be flattened into individual entries in the returned array
|
|
13
|
+
* (so it's possible that multiple entries will have the same filename).
|
|
14
|
+
*/
|
|
4
15
|
export declare function readChangeFiles(options: BeachballOptions, packageInfos: PackageInfos): ChangeSet;
|
|
5
16
|
//# sourceMappingURL=readChangeFiles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readChangeFiles.d.ts","sourceRoot":"","sources":["../../src/changefile/readChangeFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,qBAAqB,CAAC;AAIhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"readChangeFiles.d.ts","sourceRoot":"","sources":["../../src/changefile/readChangeFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,qBAAqB,CAAC;AAIhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,GAAG,SAAS,CA0FhG"}
|
|
@@ -9,40 +9,44 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const getScopedPackages_1 = require("../monorepo/getScopedPackages");
|
|
11
11
|
const workspace_tools_1 = require("workspace-tools");
|
|
12
|
+
/**
|
|
13
|
+
* Read change files, excluding any changes for packages that are:
|
|
14
|
+
* - out of scope (as defined in `options.scope`)
|
|
15
|
+
* - private
|
|
16
|
+
* - nonexistent
|
|
17
|
+
*
|
|
18
|
+
* The changes will also be transformed if `options.transform.changeFiles` is provided.
|
|
19
|
+
*
|
|
20
|
+
* Changes from grouped change files will be flattened into individual entries in the returned array
|
|
21
|
+
* (so it's possible that multiple entries will have the same filename).
|
|
22
|
+
*/
|
|
12
23
|
function readChangeFiles(options, packageInfos) {
|
|
13
|
-
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const { path: cwd, fromRef } = options;
|
|
14
26
|
const scopedPackages = getScopedPackages_1.getScopedPackages(options, packageInfos);
|
|
15
|
-
const changeSet = [];
|
|
16
27
|
const changePath = paths_1.getChangePath(cwd);
|
|
17
|
-
const fromRef = options.fromRef;
|
|
18
28
|
if (!fs_extra_1.default.existsSync(changePath)) {
|
|
19
|
-
return
|
|
29
|
+
return [];
|
|
20
30
|
}
|
|
21
31
|
const allChangeFiles = fs_extra_1.default.readdirSync(changePath);
|
|
22
|
-
|
|
32
|
+
let filteredChangeFiles = allChangeFiles;
|
|
23
33
|
if (fromRef) {
|
|
24
34
|
const changeFilesSinceFromRef = workspace_tools_1.getChangesBetweenRefs(fromRef, 'HEAD', [
|
|
25
35
|
'--diff-filter=d',
|
|
26
36
|
'--relative', // results will include path relative to the cwd, i.e. only file names.
|
|
27
37
|
], '*.json', changePath);
|
|
28
|
-
allChangeFiles
|
|
29
|
-
.filter(fileName => changeFilesSinceFromRef === null || changeFilesSinceFromRef === void 0 ? void 0 : changeFilesSinceFromRef.includes(fileName))
|
|
30
|
-
.forEach(fileName => filteredChangeFiles.push(fileName));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
filteredChangeFiles.push(...allChangeFiles);
|
|
38
|
+
filteredChangeFiles = allChangeFiles.filter(fileName => changeFilesSinceFromRef === null || changeFilesSinceFromRef === void 0 ? void 0 : changeFilesSinceFromRef.includes(fileName));
|
|
34
39
|
}
|
|
35
40
|
try {
|
|
36
41
|
// sort the change files by modified time. Most recent modified file comes first.
|
|
37
|
-
filteredChangeFiles.sort(
|
|
38
|
-
return (fs_extra_1.default.statSync(path_1.default.join(changePath, f2)).mtime.getTime() - fs_extra_1.default.statSync(path_1.default.join(changePath, f1)).mtime.getTime());
|
|
39
|
-
});
|
|
42
|
+
filteredChangeFiles.sort((f1, f2) => fs_extra_1.default.statSync(path_1.default.join(changePath, f2)).mtime.getTime() - fs_extra_1.default.statSync(path_1.default.join(changePath, f1)).mtime.getTime());
|
|
40
43
|
}
|
|
41
44
|
catch (err) {
|
|
42
45
|
console.warn('Failed to sort change files', err);
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
const changeSet = [];
|
|
48
|
+
// Read, transform, and filter the change files
|
|
49
|
+
for (const changeFile of filteredChangeFiles) {
|
|
46
50
|
const changeFilePath = path_1.default.join(changePath, changeFile);
|
|
47
51
|
let changeInfo;
|
|
48
52
|
try {
|
|
@@ -50,7 +54,7 @@ function readChangeFiles(options, packageInfos) {
|
|
|
50
54
|
}
|
|
51
55
|
catch (e) {
|
|
52
56
|
console.warn(`Error reading or parsing change file ${changeFilePath}: ${e}`);
|
|
53
|
-
|
|
57
|
+
continue;
|
|
54
58
|
}
|
|
55
59
|
// Transform the change files, if the option is provided
|
|
56
60
|
if ((_a = options.transform) === null || _a === void 0 ? void 0 : _a.changeFiles) {
|
|
@@ -59,16 +63,29 @@ function readChangeFiles(options, packageInfos) {
|
|
|
59
63
|
}
|
|
60
64
|
catch (e) {
|
|
61
65
|
console.warn(`Error transforming ${changeFilePath}: ${e}`);
|
|
62
|
-
|
|
66
|
+
continue;
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
const changes = changeInfo.changes || [changeInfo];
|
|
70
|
+
// Filter the changes from this file
|
|
66
71
|
for (const change of changes) {
|
|
67
|
-
|
|
72
|
+
// Log warnings about change entries for nonexistent and private packages.
|
|
73
|
+
// (This may happen if a package is renamed or its private flag is changed.)
|
|
74
|
+
const warningType = !packageInfos[change.packageName]
|
|
75
|
+
? 'nonexistent'
|
|
76
|
+
: packageInfos[change.packageName].private
|
|
77
|
+
? 'private'
|
|
78
|
+
: undefined;
|
|
79
|
+
if (warningType) {
|
|
80
|
+
const resolution = options.groupChanges ? 'remove the entry from this file' : 'delete this file';
|
|
81
|
+
console.warn(`Change detected for ${warningType} package ${change.packageName}; ${resolution}: "${path_1.default.resolve(changePath, changeFile)}"`);
|
|
82
|
+
}
|
|
83
|
+
// Add the change to the final list if it's valid and in scope
|
|
84
|
+
if (!warningType && scopedPackages.includes(change.packageName)) {
|
|
68
85
|
changeSet.push({ changeFile, change });
|
|
69
86
|
}
|
|
70
87
|
}
|
|
71
|
-
}
|
|
88
|
+
}
|
|
72
89
|
return changeSet;
|
|
73
90
|
}
|
|
74
91
|
exports.readChangeFiles = readChangeFiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readChangeFiles.js","sourceRoot":"","sources":["../../src/changefile/readChangeFiles.ts"],"names":[],"mappings":";;;;;;AACA,oCAAyC;AACzC,wDAA0B;AAC1B,gDAAwB;AAExB,qEAAkE;AAClE,qDAAwD;AAGxD,SAAgB,eAAe,CAAC,OAAyB,EAAE,YAA0B
|
|
1
|
+
{"version":3,"file":"readChangeFiles.js","sourceRoot":"","sources":["../../src/changefile/readChangeFiles.ts"],"names":[],"mappings":";;;;;;AACA,oCAAyC;AACzC,wDAA0B;AAC1B,gDAAwB;AAExB,qEAAkE;AAClE,qDAAwD;AAGxD;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,OAAyB,EAAE,YAA0B;;IACnF,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,cAAc,GAAG,qCAAiB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,qBAAa,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,cAAc,GAAG,kBAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,mBAAmB,GAAG,cAAc,CAAC;IAEzC,IAAI,OAAO,EAAE;QACX,MAAM,uBAAuB,GAAG,uCAAqB,CACnD,OAAO,EACP,MAAM,EACN;YACE,iBAAiB;YACjB,YAAY,EAAE,uEAAuE;SACtF,EACD,QAAQ,EACR,UAAU,CACX,CAAC;QAEF,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,QAAQ,CAAC,QAAQ,CAA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,oCAAoC;QACpC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,0EAA0E;YAC1E,4EAA4E;YAC5E,MAAM,WAAW,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC;gBACnD,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO;oBAC1C,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,SAAS,CAAC;YACd,IAAI,WAAW,EAAE;gBACf,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,kBAAkB,CAAC;gBACjG,OAAO,CAAC,IAAI,CACV,uBAAuB,WAAW,YAAY,MAAM,CAAC,WAAW,KAAK,UAAU,MAAM,cAAI,CAAC,OAAO,CAC/F,UAAW,EACX,UAAU,CACX,GAAG,CACL,CAAC;aACH;YAED,8DAA8D;YAC9D,IAAI,CAAC,WAAW,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;gBAC/D,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;aACxC;SACF;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AA1FD,0CA0FC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
@@ -24,7 +13,7 @@ function getPackageChangelogs(changeFileChangeInfos, calculatedChangeTypes, depe
|
|
|
24
13
|
const changeFileCommits = {};
|
|
25
14
|
const changePath = paths_1.getChangePath(cwd);
|
|
26
15
|
for (let { change, changeFile } of changeFileChangeInfos) {
|
|
27
|
-
const { packageName, type: changeType, dependentChangeType, email
|
|
16
|
+
const { packageName, type: changeType, dependentChangeType, email, ...rest } = change;
|
|
28
17
|
if (!changelogs[packageName]) {
|
|
29
18
|
changelogs[packageName] = createChangeLog(packageInfos[packageName]);
|
|
30
19
|
}
|
|
@@ -33,7 +22,14 @@ function getPackageChangelogs(changeFileChangeInfos, calculatedChangeTypes, depe
|
|
|
33
22
|
}
|
|
34
23
|
changelogs[packageName].comments = changelogs[packageName].comments || {};
|
|
35
24
|
changelogs[packageName].comments[changeType] = changelogs[packageName].comments[changeType] || [];
|
|
36
|
-
changelogs[packageName].comments[changeType].push(
|
|
25
|
+
changelogs[packageName].comments[changeType].push({
|
|
26
|
+
author: change.email,
|
|
27
|
+
package: packageName,
|
|
28
|
+
commit: changeFileCommits[changeFile],
|
|
29
|
+
// This contains the comment and any extra properties added to the change file by
|
|
30
|
+
// RepoOptions.changeFilePrompt.changePrompt
|
|
31
|
+
...rest,
|
|
32
|
+
});
|
|
37
33
|
}
|
|
38
34
|
const commit = workspace_tools_1.getCurrentHash(cwd) || 'not available';
|
|
39
35
|
for (let [dependent, changedBy] of Object.entries(dependentChangedBy)) {
|