@lerna-lite/core 0.3.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/LICENSE +20 -0
- package/README.md +16 -0
- package/dist/child-process.d.ts +13 -0
- package/dist/child-process.js +129 -0
- package/dist/child-process.js.map +1 -0
- package/dist/command.d.ts +37 -0
- package/dist/command.js +269 -0
- package/dist/command.js.map +1 -0
- package/dist/conventional-commits/constants.d.ts +4 -0
- package/dist/conventional-commits/constants.js +13 -0
- package/dist/conventional-commits/constants.js.map +1 -0
- package/dist/conventional-commits/get-changelog-config.d.ts +12 -0
- package/dist/conventional-commits/get-changelog-config.js +92 -0
- package/dist/conventional-commits/get-changelog-config.js.map +1 -0
- package/dist/conventional-commits/index.d.ts +6 -0
- package/dist/conventional-commits/index.js +19 -0
- package/dist/conventional-commits/index.js.map +1 -0
- package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -0
- package/dist/conventional-commits/make-bump-only-filter.js +23 -0
- package/dist/conventional-commits/make-bump-only-filter.js.map +1 -0
- package/dist/conventional-commits/read-existing-changelog.d.ts +7 -0
- package/dist/conventional-commits/read-existing-changelog.js +33 -0
- package/dist/conventional-commits/read-existing-changelog.js.map +1 -0
- package/dist/conventional-commits/recommend-version.d.ts +10 -0
- package/dist/conventional-commits/recommend-version.js +87 -0
- package/dist/conventional-commits/recommend-version.js.map +1 -0
- package/dist/conventional-commits/update-changelog.d.ts +11 -0
- package/dist/conventional-commits/update-changelog.js +84 -0
- package/dist/conventional-commits/update-changelog.js.map +1 -0
- package/dist/git-clients/github-client.d.ts +6 -0
- package/dist/git-clients/github-client.js +41 -0
- package/dist/git-clients/github-client.js.map +1 -0
- package/dist/git-clients/gitlab-client.d.ts +5 -0
- package/dist/git-clients/gitlab-client.js +53 -0
- package/dist/git-clients/gitlab-client.js.map +1 -0
- package/dist/git-clients/index.d.ts +2 -0
- package/dist/git-clients/index.js +15 -0
- package/dist/git-clients/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/models/index.d.ts +97 -0
- package/dist/models/index.js +3 -0
- package/dist/models/index.js.map +1 -0
- package/dist/otplease.d.ts +13 -0
- package/dist/otplease.js +110 -0
- package/dist/otplease.js.map +1 -0
- package/dist/package-graph/index.d.ts +2 -0
- package/dist/package-graph/index.js +15 -0
- package/dist/package-graph/index.js.map +1 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +41 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.js +101 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.js.map +1 -0
- package/dist/package-graph/lib/index.d.ts +3 -0
- package/dist/package-graph/lib/index.js +16 -0
- package/dist/package-graph/lib/index.js.map +1 -0
- package/dist/package-graph/lib/package-graph-node.d.ts +35 -0
- package/dist/package-graph/lib/package-graph-node.js +61 -0
- package/dist/package-graph/lib/package-graph-node.js.map +1 -0
- package/dist/package-graph/lib/report-cycles.d.ts +1 -0
- package/dist/package-graph/lib/report-cycles.js +20 -0
- package/dist/package-graph/lib/report-cycles.js.map +1 -0
- package/dist/package-graph/package-graph.d.ts +78 -0
- package/dist/package-graph/package-graph.js +256 -0
- package/dist/package-graph/package-graph.js.map +1 -0
- package/dist/package.d.ts +96 -0
- package/dist/package.js +260 -0
- package/dist/package.js.map +1 -0
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.js +15 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/lib/apply-extends.d.ts +6 -0
- package/dist/project/lib/apply-extends.js +38 -0
- package/dist/project/lib/apply-extends.js.map +1 -0
- package/dist/project/lib/index.d.ts +3 -0
- package/dist/project/lib/index.js +16 -0
- package/dist/project/lib/index.js.map +1 -0
- package/dist/project/lib/make-file-finder.d.ts +2 -0
- package/dist/project/lib/make-file-finder.js +72 -0
- package/dist/project/lib/make-file-finder.js.map +1 -0
- package/dist/project/lib/shallow-extend.d.ts +5 -0
- package/dist/project/lib/shallow-extend.js +25 -0
- package/dist/project/lib/shallow-extend.js.map +1 -0
- package/dist/project/project.d.ts +50 -0
- package/dist/project/project.js +193 -0
- package/dist/project/project.js.map +1 -0
- package/dist/prompt.d.ts +5 -0
- package/dist/prompt.js +65 -0
- package/dist/prompt.js.map +1 -0
- package/dist/utils/check-working-tree.d.ts +8 -0
- package/dist/utils/check-working-tree.js +42 -0
- package/dist/utils/check-working-tree.js.map +1 -0
- package/dist/utils/clean-stack.d.ts +5 -0
- package/dist/utils/clean-stack.js +19 -0
- package/dist/utils/clean-stack.js.map +1 -0
- package/dist/utils/collect-dependents.d.ts +11 -0
- package/dist/utils/collect-dependents.js +46 -0
- package/dist/utils/collect-dependents.js.map +1 -0
- package/dist/utils/collect-uncommitted.d.ts +19 -0
- package/dist/utils/collect-uncommitted.js +46 -0
- package/dist/utils/collect-uncommitted.js.map +1 -0
- package/dist/utils/collect-updates/collect-updates.d.ts +25 -0
- package/dist/utils/collect-updates/collect-updates.js +100 -0
- package/dist/utils/collect-updates/collect-updates.js.map +1 -0
- package/dist/utils/collect-updates/index.d.ts +2 -0
- package/dist/utils/collect-updates/index.js +15 -0
- package/dist/utils/collect-updates/index.js.map +1 -0
- package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -0
- package/dist/utils/collect-updates/lib/collect-packages.js +34 -0
- package/dist/utils/collect-updates/lib/collect-packages.js.map +1 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.js +31 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.js.map +1 -0
- package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -0
- package/dist/utils/collect-updates/lib/has-tags.js +27 -0
- package/dist/utils/collect-updates/lib/has-tags.js.map +1 -0
- package/dist/utils/collect-updates/lib/index.d.ts +4 -0
- package/dist/utils/collect-updates/lib/index.js +17 -0
- package/dist/utils/collect-updates/lib/index.js.map +1 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +6 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +65 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.js.map +1 -0
- package/dist/utils/conf.d.ts +23 -0
- package/dist/utils/conf.js +256 -0
- package/dist/utils/conf.js.map +1 -0
- package/dist/utils/defaults.d.ts +1 -0
- package/dist/utils/defaults.js +182 -0
- package/dist/utils/defaults.js.map +1 -0
- package/dist/utils/describe-ref.d.ts +24 -0
- package/dist/utils/describe-ref.js +81 -0
- package/dist/utils/describe-ref.js.map +1 -0
- package/dist/utils/env-replace.d.ts +1 -0
- package/dist/utils/env-replace.js +23 -0
- package/dist/utils/env-replace.js.map +1 -0
- package/dist/utils/find-prefix.d.ts +2 -0
- package/dist/utils/find-prefix.js +49 -0
- package/dist/utils/find-prefix.js.map +1 -0
- package/dist/utils/format-error.d.ts +7 -0
- package/dist/utils/format-error.js +20 -0
- package/dist/utils/format-error.js.map +1 -0
- package/dist/utils/index.d.ts +23 -0
- package/dist/utils/index.js +36 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/log-package-error.d.ts +5 -0
- package/dist/utils/log-package-error.js +36 -0
- package/dist/utils/log-package-error.js.map +1 -0
- package/dist/utils/nerf-dart.d.ts +1 -0
- package/dist/utils/nerf-dart.js +19 -0
- package/dist/utils/nerf-dart.js.map +1 -0
- package/dist/utils/npm-conf.d.ts +2 -0
- package/dist/utils/npm-conf.js +54 -0
- package/dist/utils/npm-conf.js.map +1 -0
- package/dist/utils/parse-field.d.ts +1 -0
- package/dist/utils/parse-field.js +66 -0
- package/dist/utils/parse-field.js.map +1 -0
- package/dist/utils/prerelease-id-from-version.d.ts +5 -0
- package/dist/utils/prerelease-id-from-version.js +16 -0
- package/dist/utils/prerelease-id-from-version.js.map +1 -0
- package/dist/utils/pulse-till-done.d.ts +1 -0
- package/dist/utils/pulse-till-done.js +41 -0
- package/dist/utils/pulse-till-done.js.map +1 -0
- package/dist/utils/query-graph.d.ts +36 -0
- package/dist/utils/query-graph.js +78 -0
- package/dist/utils/query-graph.js.map +1 -0
- package/dist/utils/run-lifecycle.d.ts +10 -0
- package/dist/utils/run-lifecycle.js +109 -0
- package/dist/utils/run-lifecycle.js.map +1 -0
- package/dist/utils/run-topologically.d.ts +12 -0
- package/dist/utils/run-topologically.js +37 -0
- package/dist/utils/run-topologically.js.map +1 -0
- package/dist/utils/types.d.ts +128 -0
- package/dist/utils/types.js +138 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/warn-if-hanging.d.ts +1 -0
- package/dist/utils/warn-if-hanging.js +18 -0
- package/dist/utils/warn-if-hanging.js.map +1 -0
- package/dist/utils/write-log-file.d.ts +1 -0
- package/dist/utils/write-log-file.js +33 -0
- package/dist/utils/write-log-file.js.map +1 -0
- package/dist/validation-error.d.ts +4 -0
- package/dist/validation-error.js +19 -0
- package/dist/validation-error.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./constants"), exports);
|
|
14
|
+
__exportStar(require("./get-changelog-config"), exports);
|
|
15
|
+
__exportStar(require("./make-bump-only-filter"), exports);
|
|
16
|
+
__exportStar(require("./read-existing-changelog"), exports);
|
|
17
|
+
__exportStar(require("./recommend-version"), exports);
|
|
18
|
+
__exportStar(require("./update-changelog"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conventional-commits/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,sDAAoC;AACpC,qDAAmC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeBumpOnlyFilter = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
/**
|
|
6
|
+
* @param {import("@lerna/package").Package} pkg
|
|
7
|
+
* @return {(entry: string) => string}
|
|
8
|
+
*/
|
|
9
|
+
function makeBumpOnlyFilter(pkg) {
|
|
10
|
+
return (newEntry) => {
|
|
11
|
+
// When force publishing, it is possible that there will be no actual changes, only a version bump.
|
|
12
|
+
if (!newEntry.split('\n').some((line) => line.startsWith('*'))) {
|
|
13
|
+
// Add a note to indicate that only a version bump has occurred.
|
|
14
|
+
// TODO: actually list the dependencies that were bumped
|
|
15
|
+
const message = `**Note:** Version bump only for package ${pkg.name}`;
|
|
16
|
+
// the extra blank lines preserve the whitespace delimiting releases
|
|
17
|
+
return [newEntry.trim(), message, constants_1.BLANK_LINE].join(constants_1.BLANK_LINE);
|
|
18
|
+
}
|
|
19
|
+
return newEntry;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.makeBumpOnlyFilter = makeBumpOnlyFilter;
|
|
23
|
+
//# sourceMappingURL=make-bump-only-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-bump-only-filter.js","sourceRoot":"","sources":["../../src/conventional-commits/make-bump-only-filter.ts"],"names":[],"mappings":";;;AACA,2CAAyC;AAEzC;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,GAAY;IAC7C,OAAO,CAAC,QAAgB,EAAE,EAAE;QAC1B,mGAAmG;QACnG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;YAC9D,gEAAgE;YAChE,wDAAwD;YACxD,MAAM,OAAO,GAAG,2CAA2C,GAAG,CAAC,IAAI,EAAE,CAAC;YAEtE,oEAAoE;YACpE,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,sBAAU,CAAC,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;SAChE;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC;AAdD,gDAcC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Package } from '../package';
|
|
2
|
+
/**
|
|
3
|
+
* Read the existing changelog, if it exists.
|
|
4
|
+
* @param {import("@lerna/package").Package} pkg
|
|
5
|
+
* @returns {Promise<[string, string]>} A tuple of changelog location and contents
|
|
6
|
+
*/
|
|
7
|
+
export declare function readExistingChangelog(pkg: Package): Promise<any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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.readExistingChangelog = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
/**
|
|
11
|
+
* Read the existing changelog, if it exists.
|
|
12
|
+
* @param {import("@lerna/package").Package} pkg
|
|
13
|
+
* @returns {Promise<[string, string]>} A tuple of changelog location and contents
|
|
14
|
+
*/
|
|
15
|
+
async function readExistingChangelog(pkg) {
|
|
16
|
+
const changelogFileLoc = path_1.default.join(pkg.location, 'CHANGELOG.md');
|
|
17
|
+
let chain = Promise.resolve();
|
|
18
|
+
// catch allows missing file to pass without breaking chain
|
|
19
|
+
chain = chain.then(() => fs_extra_1.default.readFile(changelogFileLoc, 'utf8').catch(() => ''));
|
|
20
|
+
chain = chain.then((changelogContents) => {
|
|
21
|
+
// Remove the header if it exists, thus starting at the first entry.
|
|
22
|
+
const headerIndex = changelogContents.indexOf(constants_1.COMMIT_GUIDELINE);
|
|
23
|
+
if (headerIndex !== -1) {
|
|
24
|
+
return changelogContents.substring(headerIndex + constants_1.COMMIT_GUIDELINE.length + constants_1.BLANK_LINE.length);
|
|
25
|
+
}
|
|
26
|
+
return changelogContents;
|
|
27
|
+
});
|
|
28
|
+
// consumer expects resolved tuple
|
|
29
|
+
chain = chain.then((changelogContents) => [changelogFileLoc, changelogContents]);
|
|
30
|
+
return chain;
|
|
31
|
+
}
|
|
32
|
+
exports.readExistingChangelog = readExistingChangelog;
|
|
33
|
+
//# sourceMappingURL=read-existing-changelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-existing-changelog.js","sourceRoot":"","sources":["../../src/conventional-commits/read-existing-changelog.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAExB,2CAA2D;AAG3D;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CAAC,GAAY;IACtD,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAEjE,IAAI,KAAK,GAAiB,OAAO,CAAC,OAAO,EAAE,CAAC;IAE5C,2DAA2D;IAC3D,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,kBAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhF,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAyB,EAAE,EAAE;QAC/C,oEAAoE;QACpE,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,4BAAgB,CAAC,CAAC;QAEhE,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE;YACtB,OAAO,iBAAiB,CAAC,SAAS,CAAC,WAAW,GAAG,4BAAgB,CAAC,MAAM,GAAG,sBAAU,CAAC,MAAM,CAAC,CAAC;SAC/F;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,kCAAkC;IAClC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEjF,OAAO,KAAK,CAAC;AACf,CAAC;AAvBD,sDAuBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseChangelogOptions, VersioningStrategy } from '../models';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@lerna/package').Package} pkg
|
|
5
|
+
* @param {import('..').VersioningStrategy} type
|
|
6
|
+
* @param {import('..').BaseChangelogOptions & { prereleaseId?: string }} commandOptions
|
|
7
|
+
*/
|
|
8
|
+
export declare function recommendVersion(pkg: Package, type: VersioningStrategy, recommendationOptions: BaseChangelogOptions & {
|
|
9
|
+
prereleaseId?: string;
|
|
10
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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.recommendVersion = void 0;
|
|
7
|
+
const conventional_recommended_bump_1 = __importDefault(require("conventional-recommended-bump"));
|
|
8
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
|
+
const semver_1 = __importDefault(require("semver"));
|
|
10
|
+
const get_changelog_config_1 = require("./get-changelog-config");
|
|
11
|
+
/**
|
|
12
|
+
* @param {import('@lerna/package').Package} pkg
|
|
13
|
+
* @param {import('..').VersioningStrategy} type
|
|
14
|
+
* @param {import('..').BaseChangelogOptions & { prereleaseId?: string }} commandOptions
|
|
15
|
+
*/
|
|
16
|
+
async function recommendVersion(pkg, type, recommendationOptions) {
|
|
17
|
+
const { changelogPreset, rootPath, tagPrefix, prereleaseId } = recommendationOptions;
|
|
18
|
+
npmlog_1.default.silly(type, 'for %s at %s', pkg.name, pkg.location);
|
|
19
|
+
const options = {
|
|
20
|
+
path: pkg.location,
|
|
21
|
+
};
|
|
22
|
+
if (type === 'independent') {
|
|
23
|
+
options.lernaPackage = pkg.name;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// only fixed mode can have a custom tag prefix
|
|
27
|
+
options.tagPrefix = tagPrefix;
|
|
28
|
+
}
|
|
29
|
+
const shouldBumpPrerelease = (releaseType, version) => {
|
|
30
|
+
if (!semver_1.default.prerelease(version)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
switch (releaseType) {
|
|
34
|
+
case 'major':
|
|
35
|
+
return semver_1.default.minor(version) !== 0 || semver_1.default.patch(version) !== 0;
|
|
36
|
+
case 'minor':
|
|
37
|
+
return semver_1.default.patch(version) !== 0;
|
|
38
|
+
default:
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
// 'new' preset API
|
|
43
|
+
options.config = await get_changelog_config_1.GetChangelogConfig.getChangelogConfig(changelogPreset, rootPath);
|
|
44
|
+
// Ensure potential ValidationError in getChangelogConfig() is propagated correctly
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
(0, conventional_recommended_bump_1.default)(options, (err, data) => {
|
|
47
|
+
if (err) {
|
|
48
|
+
return reject(err);
|
|
49
|
+
}
|
|
50
|
+
// result might be undefined because some presets are not consistent with angular
|
|
51
|
+
// we still need to bump _something_ because lerna-lite saw a change here
|
|
52
|
+
let releaseType = data.releaseType || 'patch';
|
|
53
|
+
if (prereleaseId) {
|
|
54
|
+
const shouldBump = shouldBumpPrerelease(releaseType, pkg.version);
|
|
55
|
+
const prereleaseType = shouldBump ? `pre${releaseType}` : 'prerelease';
|
|
56
|
+
npmlog_1.default.verbose(type, 'increment %s by %s - %s', pkg.version, prereleaseType, pkg.name);
|
|
57
|
+
resolve(semver_1.default.inc(pkg.version, prereleaseType, prereleaseId));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (semver_1.default.major(pkg.version) === 0) {
|
|
61
|
+
// According to semver, major version zero (0.y.z) is for initial
|
|
62
|
+
// development. Anything MAY change at any time. The public API
|
|
63
|
+
// SHOULD NOT be considered stable. The version 1.0.0 defines
|
|
64
|
+
// the (initial stable) public API.
|
|
65
|
+
//
|
|
66
|
+
// To allow monorepos to use major version zero meaningfully,
|
|
67
|
+
// the transition from 0.x to 1.x must be explicitly requested
|
|
68
|
+
// by the user. Breaking changes MUST NOT automatically bump
|
|
69
|
+
// the major version from 0.x to 1.x.
|
|
70
|
+
//
|
|
71
|
+
// The usual convention is to use semver-patch bumps for bugfix
|
|
72
|
+
// releases and semver-minor for everything else, including
|
|
73
|
+
// breaking changes. This matches the behavior of `^` operator
|
|
74
|
+
// as implemented by `npm`.
|
|
75
|
+
//
|
|
76
|
+
if (releaseType === 'major') {
|
|
77
|
+
releaseType = 'minor';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
npmlog_1.default.verbose(type, 'increment %s by %s - %s', pkg.version, releaseType, pkg.name);
|
|
81
|
+
resolve(semver_1.default.inc(pkg.version, releaseType));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.recommendVersion = recommendVersion;
|
|
87
|
+
//# sourceMappingURL=recommend-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommend-version.js","sourceRoot":"","sources":["../../src/conventional-commits/recommend-version.ts"],"names":[],"mappings":";;;;;;AAAA,kGAAwE;AAExE,oDAAyB;AACzB,oDAA6C;AAI7C,iEAA4D;AAE5D;;;;GAIG;AACI,KAAK,UAAU,gBAAgB,CAAC,GAAY,EAAE,IAAwB,EAAE,qBAAwE;IACrJ,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAAC;IAErF,gBAAG,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAExD,MAAM,OAAO,GAAwC;QACnD,IAAI,EAAE,GAAG,CAAC,QAAQ;KACnB,CAAC;IAEF,IAAI,IAAI,KAAK,aAAa,EAAE;QAC1B,OAAO,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC;KACjC;SAAM;QACL,+CAA+C;QAC/C,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;KAC/B;IAED,MAAM,oBAAoB,GAAG,CAAC,WAAwB,EAAE,OAAe,EAAE,EAAE;QACzE,IAAI,CAAC,gBAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAC;SACb;QACD,QAAQ,WAAW,EAAE;YACnB,KAAK,OAAO;gBACV,OAAO,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpE,KAAK,OAAO;gBACV,OAAO,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACrC;gBACE,OAAO,KAAK,CAAC;SAChB;IACH,CAAC,CAAC;IAEF,mBAAmB;IACnB,OAAO,CAAC,MAAM,GAAG,MAAM,yCAAkB,CAAC,kBAAkB,CAAC,e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AAE,yBAAyB,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;gBACjF,OAAO,CAAC,gBAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA3ED,4CA2EC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UpdateChangelogOption } from '../models';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
/**
|
|
4
|
+
* @param {import("@lerna/package").Package} pkg
|
|
5
|
+
* @param {import("..").ChangelogType} type
|
|
6
|
+
* @param {import("..").BaseChangelogOptions & { version?: string }} commandOptions
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateChangelog(pkg: Package, type: 'root' | 'independent' | 'fixed', updateOptions: UpdateChangelogOption): Promise<{
|
|
9
|
+
logPath: any;
|
|
10
|
+
newEntry: any;
|
|
11
|
+
}>;
|
|
@@ -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.updateChangelog = void 0;
|
|
7
|
+
const conventional_changelog_core_1 = __importDefault(require("conventional-changelog-core"));
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const get_stream_1 = __importDefault(require("get-stream"));
|
|
10
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const get_changelog_config_1 = require("./get-changelog-config");
|
|
13
|
+
const make_bump_only_filter_1 = require("./make-bump-only-filter");
|
|
14
|
+
const read_existing_changelog_1 = require("./read-existing-changelog");
|
|
15
|
+
/**
|
|
16
|
+
* @param {import("@lerna/package").Package} pkg
|
|
17
|
+
* @param {import("..").ChangelogType} type
|
|
18
|
+
* @param {import("..").BaseChangelogOptions & { version?: string }} commandOptions
|
|
19
|
+
*/
|
|
20
|
+
async function updateChangelog(pkg, type, updateOptions) {
|
|
21
|
+
npmlog_1.default.silly(type, 'for %s at %s', pkg.name, pkg.location);
|
|
22
|
+
const { changelogPreset, rootPath, tagPrefix = 'v', version = undefined, changelogHeaderMessage = '', changelogVersionMessage = '', } = updateOptions;
|
|
23
|
+
const config = await get_changelog_config_1.GetChangelogConfig.getChangelogConfig(changelogPreset, rootPath);
|
|
24
|
+
const options = {};
|
|
25
|
+
const context = {}; // pass as positional because cc-core's merge-config is wack
|
|
26
|
+
// cc-core mutates input :P
|
|
27
|
+
if (config.conventionalChangelog) {
|
|
28
|
+
// "new" preset API
|
|
29
|
+
options.config = Object.assign({}, config.conventionalChangelog);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// "old" preset API
|
|
33
|
+
options.config = Object.assign({}, config);
|
|
34
|
+
}
|
|
35
|
+
// NOTE: must pass as positional argument due to weird bug in merge-config
|
|
36
|
+
const gitRawCommitsOpts = Object.assign({}, options.config.gitRawCommitsOpts);
|
|
37
|
+
if (type === 'root') {
|
|
38
|
+
context.version = version;
|
|
39
|
+
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
40
|
+
context.currentTag = `${tagPrefix}${version}`;
|
|
41
|
+
// root changelogs are only enabled in fixed mode, and need the proper tag prefix
|
|
42
|
+
options.tagPrefix = tagPrefix;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// "fixed" or "independent"
|
|
46
|
+
gitRawCommitsOpts.path = pkg.location;
|
|
47
|
+
options.pkg = { path: pkg.manifestLocation };
|
|
48
|
+
if (type === 'independent') {
|
|
49
|
+
options.lernaPackage = pkg.name;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// only fixed mode can have a custom tag prefix
|
|
53
|
+
options.tagPrefix = tagPrefix;
|
|
54
|
+
// preserve tagPrefix because cc-core can't find the currentTag otherwise
|
|
55
|
+
context.currentTag = `${tagPrefix}${pkg.version}`;
|
|
56
|
+
context.version = pkg.version; // TODO investigate why Lerna doesn't have this line
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// generate the markdown for the upcoming release.
|
|
60
|
+
const changelogStream = (0, conventional_changelog_core_1.default)(options, context, gitRawCommitsOpts);
|
|
61
|
+
return Promise.all([
|
|
62
|
+
get_stream_1.default(changelogStream).then((0, make_bump_only_filter_1.makeBumpOnlyFilter)(pkg)),
|
|
63
|
+
(0, read_existing_changelog_1.readExistingChangelog)(pkg),
|
|
64
|
+
]).then(([newEntry, [changelogFileLoc, changelogContents]]) => {
|
|
65
|
+
npmlog_1.default.silly(type, 'writing new entry: %j', newEntry);
|
|
66
|
+
const changelogVersion = type === 'root' ? changelogVersionMessage : '';
|
|
67
|
+
const changelogHeader = constants_1.CHANGELOG_HEADER.replace(/%s/g, type === 'root'
|
|
68
|
+
? (changelogHeaderMessage === null || changelogHeaderMessage === void 0 ? void 0 : changelogHeaderMessage.length) > 0 ? changelogHeaderMessage + constants_1.EOL : ''
|
|
69
|
+
: '');
|
|
70
|
+
const content = [changelogHeader, changelogVersion, newEntry, changelogContents]
|
|
71
|
+
.join(constants_1.BLANK_LINE)
|
|
72
|
+
.trim()
|
|
73
|
+
.replace(/[\n]{2,}/gm, '\n\n');
|
|
74
|
+
return fs_extra_1.default.writeFile(changelogFileLoc, content + constants_1.EOL).then(() => {
|
|
75
|
+
npmlog_1.default.verbose(type, 'wrote', changelogFileLoc);
|
|
76
|
+
return {
|
|
77
|
+
logPath: changelogFileLoc,
|
|
78
|
+
newEntry,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.updateChangelog = updateChangelog;
|
|
84
|
+
//# sourceMappingURL=update-changelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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,IAAI,KAAK,MAAM;YACrE,CAAC,CAAC,CAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,sBAAsB,GAAG,eAAG,CAAC,CAAC,CAAC,EAAE;YACxE,CAAC,CAAC,EAAE,CACL,CAAC;QAEF,MAAM,OAAO,GAAG,CAAC,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,CAAC;aAC7E,IAAI,CAAC,sBAAU,CAAC;aAChB,IAAI,EAAE;aACN,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEjC,OAAO,kBAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,OAAO,GAAG,eAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC7D,gBAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;YAE7C,OAAO;gBACL,OAAO,EAAE,gBAAgB;gBACzB,QAAQ;aACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAlFD,0CAkFC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SyncOptions } from 'execa';
|
|
2
|
+
import parseGitUrl from 'git-url-parse';
|
|
3
|
+
export declare function createGitHubClient(): import("@octokit/core").Octokit & {
|
|
4
|
+
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
|
5
|
+
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types").RestEndpointMethods & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api;
|
|
6
|
+
export declare function parseGitRepo(remote: string | undefined, opts: SyncOptions<string>, gitDryRun?: boolean): parseGitUrl.GitUrl;
|
|
@@ -0,0 +1,41 @@
|
|
|
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.parseGitRepo = exports.createGitHubClient = void 0;
|
|
7
|
+
const rest_1 = require("@octokit/rest");
|
|
8
|
+
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
9
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
+
const child_process_1 = require("../child-process");
|
|
11
|
+
function createGitHubClient() {
|
|
12
|
+
npmlog_1.default.silly('createGitHubClient', '');
|
|
13
|
+
const { GH_TOKEN, GHE_API_URL, GHE_VERSION } = process.env;
|
|
14
|
+
if (!GH_TOKEN) {
|
|
15
|
+
throw new Error('A GH_TOKEN environment variable is required.');
|
|
16
|
+
}
|
|
17
|
+
if (GHE_VERSION) {
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
rest_1.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`));
|
|
20
|
+
}
|
|
21
|
+
const options = {
|
|
22
|
+
auth: `token ${GH_TOKEN}`,
|
|
23
|
+
};
|
|
24
|
+
if (GHE_API_URL) {
|
|
25
|
+
options.baseUrl = GHE_API_URL;
|
|
26
|
+
}
|
|
27
|
+
return new rest_1.Octokit(options);
|
|
28
|
+
}
|
|
29
|
+
exports.createGitHubClient = createGitHubClient;
|
|
30
|
+
function parseGitRepo(remote = 'origin', opts, gitDryRun = false) {
|
|
31
|
+
npmlog_1.default.silly('parseGitRepo', '');
|
|
32
|
+
const args = ['config', '--get', `remote.${remote}.url`];
|
|
33
|
+
npmlog_1.default.verbose('git', args.join(' '));
|
|
34
|
+
const url = (0, child_process_1.execSync)('git', args, opts, gitDryRun);
|
|
35
|
+
if (!url && !gitDryRun) {
|
|
36
|
+
throw new Error(`Git remote URL could not be found using '${remote}'.`);
|
|
37
|
+
}
|
|
38
|
+
return gitDryRun ? {} : (0, git_url_parse_1.default)(url);
|
|
39
|
+
}
|
|
40
|
+
exports.parseGitRepo = parseGitRepo;
|
|
41
|
+
//# sourceMappingURL=github-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-client.js","sourceRoot":"","sources":["../../src/git-clients/github-client.ts"],"names":[],"mappings":";;;;;;AAAA,wCAAwC;AAExC,kEAAwC;AACxC,oDAAyB;AAEzB,oDAA4C;AAE5C,SAAgB,kBAAkB;IAChC,gBAAG,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAEpC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAE3D,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IAED,IAAI,WAAW,EAAE;QACf,2BAA2B;QAC3B,cAAO,CAAC,MAAM,CAAC,OAAO,CAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC,CAAC;KAC/E;IAED,MAAM,OAAO,GAAQ;QACnB,IAAI,EAAE,SAAS,QAAQ,EAAE;KAC1B,CAAC;IAEF,IAAI,WAAW,EAAE;QACf,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC;KAC/B;IAED,OAAO,IAAI,cAAO,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAvBD,gDAuBC;AAED,SAAgB,YAAY,CAAC,MAAM,GAAG,QAAQ,EAAE,IAAyB,EAAE,SAAS,GAAG,KAAK;IAC1F,gBAAG,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,MAAM,MAAM,CAAC,CAAC;IACzD,gBAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,IAAA,wBAAQ,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAEnD,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,4CAA4C,MAAM,IAAI,CAAC,CAAC;KACzE;IAED,OAAO,SAAS,CAAC,CAAC,CAAC,EAAwB,CAAC,CAAC,CAAC,IAAA,uBAAW,EAAC,GAAG,CAAC,CAAC;AACjE,CAAC;AAXD,oCAWC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.createGitLabClient = void 0;
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const whatwg_url_1 = require("whatwg-url");
|
|
12
|
+
class GitLabClient {
|
|
13
|
+
constructor(baseUrl = 'https://gitlab.com/api/v4', token) {
|
|
14
|
+
this.baseUrl = baseUrl;
|
|
15
|
+
this.token = token;
|
|
16
|
+
}
|
|
17
|
+
createRelease({ owner, repo, name, tag_name: tagName, body }) {
|
|
18
|
+
const releasesUrl = this.releasesUrl(owner, repo, 'releases');
|
|
19
|
+
npmlog_1.default.silly('Requesting GitLab releases', releasesUrl);
|
|
20
|
+
return (0, node_fetch_1.default)(releasesUrl, {
|
|
21
|
+
method: 'post',
|
|
22
|
+
body: JSON.stringify({ name, tag_name: tagName, description: body }),
|
|
23
|
+
headers: {
|
|
24
|
+
'PRIVATE-TOKEN': this.token,
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
},
|
|
27
|
+
}).then(({ ok, status, statusText }) => {
|
|
28
|
+
if (!ok) {
|
|
29
|
+
npmlog_1.default.error('gitlab', `Failed to create release\nRequest returned ${status} ${statusText}`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
npmlog_1.default.silly('gitlab', 'Created release successfully.');
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
releasesUrl(namespace, project, releases) {
|
|
37
|
+
return new whatwg_url_1.URL(`${this.baseUrl}/${path_1.default.join('projects', encodeURIComponent(`${namespace}/${project}`), releases)}`).toString();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function OcktokitAdapter(client) {
|
|
41
|
+
return { repos: { createRelease: client.createRelease.bind(client) } };
|
|
42
|
+
}
|
|
43
|
+
function createGitLabClient() {
|
|
44
|
+
const { GL_API_URL, GL_TOKEN } = process.env;
|
|
45
|
+
npmlog_1.default.silly('Creating a GitLab client...', '');
|
|
46
|
+
if (!GL_TOKEN) {
|
|
47
|
+
throw new Error('A GL_TOKEN environment variable is required.');
|
|
48
|
+
}
|
|
49
|
+
const client = new GitLabClient(GL_API_URL, GL_TOKEN);
|
|
50
|
+
return OcktokitAdapter(client);
|
|
51
|
+
}
|
|
52
|
+
exports.createGitLabClient = createGitLabClient;
|
|
53
|
+
//# sourceMappingURL=gitlab-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-client.js","sourceRoot":"","sources":["../../src/git-clients/gitlab-client.ts"],"names":[],"mappings":";;;;;;AAAA,aAAa;AACb,4DAA+B;AAC/B,oDAAyB;AACzB,gDAAwB;AACxB,2CAAiC;AAEjC,MAAM,YAAY;IAIhB,YAAY,OAAO,GAAG,2BAA2B,EAAE,KAAK;QACtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,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C,KAAK,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAE7C,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IAED,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAEtD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAZD,gDAYC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./github-client"), exports);
|
|
14
|
+
__exportStar(require("./gitlab-client"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git-clients/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './conventional-commits';
|
|
2
|
+
export * from './git-clients';
|
|
3
|
+
export * from './models';
|
|
4
|
+
export * from './package-graph';
|
|
5
|
+
export * from './project';
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './child-process';
|
|
8
|
+
export * from './command';
|
|
9
|
+
export * from './otplease';
|
|
10
|
+
export * from './package';
|
|
11
|
+
export * from './prompt';
|
|
12
|
+
export * from './validation-error';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
// folders
|
|
14
|
+
__exportStar(require("./conventional-commits"), exports);
|
|
15
|
+
__exportStar(require("./git-clients"), exports);
|
|
16
|
+
__exportStar(require("./models"), exports);
|
|
17
|
+
__exportStar(require("./package-graph"), exports);
|
|
18
|
+
__exportStar(require("./project"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
20
|
+
// files
|
|
21
|
+
__exportStar(require("./child-process"), exports);
|
|
22
|
+
__exportStar(require("./command"), exports);
|
|
23
|
+
__exportStar(require("./otplease"), exports);
|
|
24
|
+
__exportStar(require("./package"), exports);
|
|
25
|
+
__exportStar(require("./prompt"), exports);
|
|
26
|
+
__exportStar(require("./validation-error"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,UAAU;AACV,yDAAuC;AACvC,gDAA8B;AAC9B,2CAAyB;AACzB,kDAAgC;AAChC,4CAA0B;AAC1B,0CAAwB;AAExB,QAAQ;AACR,kDAAgC;AAChC,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,qDAAmC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import log from 'npmlog';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
export declare type VersioningStrategy = 'fixed' | 'independent';
|
|
4
|
+
export declare type ChangelogType = 'fixed' | 'independent' | 'root';
|
|
5
|
+
export declare type ChangelogPresetConfig = string | {
|
|
6
|
+
name: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export interface BaseChangelogOptions {
|
|
10
|
+
changelogPreset: ChangelogPresetConfig;
|
|
11
|
+
rootPath: string;
|
|
12
|
+
tagPrefix: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CommandOptions {
|
|
15
|
+
rollPublish?: boolean;
|
|
16
|
+
rollVersion?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DescribeRefOptions {
|
|
19
|
+
cwd?: string;
|
|
20
|
+
match?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DescribeRefFallbackResult {
|
|
23
|
+
isDirty: boolean;
|
|
24
|
+
refCount: string;
|
|
25
|
+
sha: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DescribeRefDetailedResult {
|
|
28
|
+
lastTagName: string;
|
|
29
|
+
lastVersion: string;
|
|
30
|
+
isDirty: boolean;
|
|
31
|
+
refCount: string;
|
|
32
|
+
sha: string;
|
|
33
|
+
}
|
|
34
|
+
/** Provided to any execa-based call */
|
|
35
|
+
export interface ExecOpts {
|
|
36
|
+
cwd: string;
|
|
37
|
+
maxBuffer?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface LifecycleConfig {
|
|
40
|
+
log?: typeof log;
|
|
41
|
+
ignorePrepublish?: boolean;
|
|
42
|
+
ignoreScripts?: boolean;
|
|
43
|
+
nodeOptions?: string;
|
|
44
|
+
scriptShell?: string;
|
|
45
|
+
scriptsPrependNodePath?: boolean;
|
|
46
|
+
snapshot?: any;
|
|
47
|
+
unsafePerm?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface Manifest {
|
|
50
|
+
name: string;
|
|
51
|
+
location: string;
|
|
52
|
+
manifest: Package;
|
|
53
|
+
version: string;
|
|
54
|
+
}
|
|
55
|
+
export interface UpdateChangelogOption {
|
|
56
|
+
changelogHeaderMessage?: string;
|
|
57
|
+
changelogVersionMessage?: string;
|
|
58
|
+
changelogPreset?: string;
|
|
59
|
+
rootPath: string;
|
|
60
|
+
tagPrefix?: string;
|
|
61
|
+
version?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface FetchConfig {
|
|
64
|
+
fetchRetries: number;
|
|
65
|
+
log: typeof log;
|
|
66
|
+
registry: string;
|
|
67
|
+
username: string;
|
|
68
|
+
}
|
|
69
|
+
export interface PackConfig {
|
|
70
|
+
log: typeof log;
|
|
71
|
+
lernaCommand?: string;
|
|
72
|
+
ignorePrepublish?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface ProfileData {
|
|
75
|
+
tfa: {
|
|
76
|
+
pending: boolean;
|
|
77
|
+
mode: 'auth-and-writes' | 'auth-only';
|
|
78
|
+
};
|
|
79
|
+
name: string;
|
|
80
|
+
username: string;
|
|
81
|
+
email: string;
|
|
82
|
+
email_verified: boolean;
|
|
83
|
+
created: string;
|
|
84
|
+
updated: string;
|
|
85
|
+
fullname?: string;
|
|
86
|
+
twitter?: string;
|
|
87
|
+
github?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface QueryGraphConfig {
|
|
90
|
+
/** "dependencies" excludes devDependencies from graph */
|
|
91
|
+
graphType?: 'allDependencies' | 'dependencies';
|
|
92
|
+
/** Whether or not to reject dependency cycles */
|
|
93
|
+
rejectCycles?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface TopologicalConfig extends QueryGraphConfig {
|
|
96
|
+
concurrency?: number;
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempt to execute Promise callback, prompting for OTP if necessary.
|
|
3
|
+
* @template {Record<string, unknown>} T
|
|
4
|
+
* @param {(opts: T) => Promise<unknown>} fn
|
|
5
|
+
* @param {T} _opts The options to be passed to `fn`
|
|
6
|
+
* @param {OneTimePasswordCache} otpCache
|
|
7
|
+
*/
|
|
8
|
+
export declare function otplease(fn: any, _opts: any, otpCache: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Prompt user for one-time password.
|
|
11
|
+
* @returns {Promise<string>}
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOneTimePassword(message?: string): Promise<string>;
|