@lerna-lite/core 1.3.0 → 1.4.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.
Files changed (140) hide show
  1. package/README.md +13 -12
  2. package/dist/child-process.d.ts +62 -62
  3. package/dist/child-process.js +165 -165
  4. package/dist/command.d.ts +37 -35
  5. package/dist/command.js +266 -266
  6. package/dist/command.js.map +1 -1
  7. package/dist/conventional-commits/constants.d.ts +4 -4
  8. package/dist/conventional-commits/constants.js +12 -12
  9. package/dist/conventional-commits/get-changelog-config.d.ts +12 -12
  10. package/dist/conventional-commits/get-changelog-config.js +98 -98
  11. package/dist/conventional-commits/index.d.ts +6 -6
  12. package/dist/conventional-commits/index.js +22 -22
  13. package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -6
  14. package/dist/conventional-commits/make-bump-only-filter.js +22 -22
  15. package/dist/conventional-commits/read-existing-changelog.d.ts +7 -7
  16. package/dist/conventional-commits/read-existing-changelog.js +32 -32
  17. package/dist/conventional-commits/recommend-version.d.ts +11 -11
  18. package/dist/conventional-commits/recommend-version.js +86 -86
  19. package/dist/conventional-commits/update-changelog.d.ts +11 -11
  20. package/dist/conventional-commits/update-changelog.js +83 -83
  21. package/dist/git-clients/GitLabClient.d.ts +8 -8
  22. package/dist/git-clients/GitLabClient.js +39 -39
  23. package/dist/git-clients/github-client.d.ts +6 -6
  24. package/dist/git-clients/github-client.js +40 -40
  25. package/dist/git-clients/gitlab-client.d.ts +6 -6
  26. package/dist/git-clients/gitlab-client.js +21 -21
  27. package/dist/git-clients/index.d.ts +2 -2
  28. package/dist/git-clients/index.js +18 -18
  29. package/dist/index.d.ts +12 -12
  30. package/dist/index.js +30 -30
  31. package/dist/models/command-options.d.ts +206 -0
  32. package/dist/models/command-options.js +3 -0
  33. package/dist/models/command-options.js.map +1 -0
  34. package/dist/models/index.d.ts +2 -186
  35. package/dist/models/index.js +18 -2
  36. package/dist/models/index.js.map +1 -1
  37. package/dist/models/interfaces.d.ts +201 -0
  38. package/dist/models/interfaces.js +3 -0
  39. package/dist/models/interfaces.js.map +1 -0
  40. package/dist/otplease.d.ts +14 -14
  41. package/dist/otplease.js +108 -108
  42. package/dist/package-graph/index.d.ts +2 -2
  43. package/dist/package-graph/index.js +18 -18
  44. package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +42 -42
  45. package/dist/package-graph/lib/cyclic-package-graph-node.js +97 -97
  46. package/dist/package-graph/lib/index.d.ts +3 -3
  47. package/dist/package-graph/lib/index.js +19 -19
  48. package/dist/package-graph/lib/package-graph-node.d.ts +33 -33
  49. package/dist/package-graph/lib/package-graph-node.js +58 -58
  50. package/dist/package-graph/lib/report-cycles.d.ts +1 -1
  51. package/dist/package-graph/lib/report-cycles.js +19 -19
  52. package/dist/package-graph/package-graph.d.ts +79 -79
  53. package/dist/package-graph/package-graph.js +276 -276
  54. package/dist/package.d.ts +91 -85
  55. package/dist/package.js +282 -276
  56. package/dist/package.js.map +1 -1
  57. package/dist/project/index.d.ts +2 -2
  58. package/dist/project/index.js +18 -18
  59. package/dist/project/lib/apply-extends.d.ts +10 -10
  60. package/dist/project/lib/apply-extends.js +37 -37
  61. package/dist/project/lib/index.d.ts +3 -3
  62. package/dist/project/lib/index.js +19 -19
  63. package/dist/project/lib/make-file-finder.d.ts +3 -3
  64. package/dist/project/lib/make-file-finder.js +71 -71
  65. package/dist/project/lib/shallow-extend.d.ts +11 -11
  66. package/dist/project/lib/shallow-extend.js +24 -24
  67. package/dist/project/project.d.ts +45 -45
  68. package/dist/project/project.js +195 -195
  69. package/dist/prompt.d.ts +23 -23
  70. package/dist/prompt.js +75 -75
  71. package/dist/utils/check-working-tree.d.ts +8 -8
  72. package/dist/utils/check-working-tree.js +41 -41
  73. package/dist/utils/clean-stack.d.ts +5 -5
  74. package/dist/utils/clean-stack.js +18 -18
  75. package/dist/utils/collect-uncommitted.d.ts +18 -18
  76. package/dist/utils/collect-uncommitted.js +40 -40
  77. package/dist/utils/collect-updates/collect-updates.d.ts +11 -11
  78. package/dist/utils/collect-updates/collect-updates.js +82 -82
  79. package/dist/utils/collect-updates/index.d.ts +2 -2
  80. package/dist/utils/collect-updates/index.js +18 -18
  81. package/dist/utils/collect-updates/lib/collect-dependents.d.ts +11 -11
  82. package/dist/utils/collect-updates/lib/collect-dependents.js +45 -45
  83. package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -13
  84. package/dist/utils/collect-updates/lib/collect-packages.js +33 -33
  85. package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -5
  86. package/dist/utils/collect-updates/lib/get-packages-for-option.js +30 -30
  87. package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -5
  88. package/dist/utils/collect-updates/lib/has-tags.js +26 -26
  89. package/dist/utils/collect-updates/lib/index.d.ts +5 -5
  90. package/dist/utils/collect-updates/lib/index.js +21 -21
  91. package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +7 -7
  92. package/dist/utils/collect-updates/lib/make-diff-predicate.js +64 -64
  93. package/dist/utils/conf.d.ts +25 -25
  94. package/dist/utils/conf.js +255 -255
  95. package/dist/utils/defaults.d.ts +1 -1
  96. package/dist/utils/defaults.js +182 -182
  97. package/dist/utils/defaults.js.map +1 -1
  98. package/dist/utils/describe-ref.d.ts +37 -37
  99. package/dist/utils/describe-ref.js +80 -80
  100. package/dist/utils/env-replace.d.ts +1 -1
  101. package/dist/utils/env-replace.js +22 -22
  102. package/dist/utils/find-prefix.d.ts +2 -2
  103. package/dist/utils/find-prefix.js +48 -48
  104. package/dist/utils/index.d.ts +23 -22
  105. package/dist/utils/index.js +39 -38
  106. package/dist/utils/index.js.map +1 -1
  107. package/dist/utils/log-package-error.d.ts +5 -5
  108. package/dist/utils/log-package-error.js +35 -35
  109. package/dist/utils/nerf-dart.d.ts +1 -1
  110. package/dist/utils/nerf-dart.js +18 -18
  111. package/dist/utils/npm-conf.d.ts +4 -4
  112. package/dist/utils/npm-conf.js +55 -55
  113. package/dist/utils/output.d.ts +1 -1
  114. package/dist/utils/output.js +13 -13
  115. package/dist/utils/parse-field.d.ts +1 -1
  116. package/dist/utils/parse-field.js +65 -65
  117. package/dist/utils/prerelease-id-from-version.d.ts +5 -5
  118. package/dist/utils/prerelease-id-from-version.js +15 -15
  119. package/dist/utils/pulse-till-done.d.ts +1 -1
  120. package/dist/utils/pulse-till-done.js +40 -40
  121. package/dist/utils/query-graph.d.ts +36 -36
  122. package/dist/utils/query-graph.js +77 -77
  123. package/dist/utils/query-graph.js.map +1 -1
  124. package/dist/utils/run-lifecycle.d.ts +10 -10
  125. package/dist/utils/run-lifecycle.js +131 -107
  126. package/dist/utils/run-lifecycle.js.map +1 -1
  127. package/dist/utils/run-topologically.d.ts +12 -12
  128. package/dist/utils/run-topologically.js +36 -36
  129. package/dist/utils/temp-write.d.ts +13 -0
  130. package/dist/utils/temp-write.js +50 -0
  131. package/dist/utils/temp-write.js.map +1 -0
  132. package/dist/utils/types.d.ts +131 -129
  133. package/dist/utils/types.js +138 -138
  134. package/dist/utils/warn-if-hanging.d.ts +1 -1
  135. package/dist/utils/warn-if-hanging.js +17 -17
  136. package/dist/utils/write-log-file.d.ts +1 -1
  137. package/dist/utils/write-log-file.js +32 -32
  138. package/dist/validation-error.d.ts +4 -4
  139. package/dist/validation-error.js +18 -18
  140. package/package.json +14 -10
@@ -1,42 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throwIfUncommitted = exports.mkThrowIfUncommitted = exports.throwIfReleased = exports.checkWorkingTree = void 0;
4
- const collect_uncommitted_1 = require("./collect-uncommitted");
5
- const describe_ref_1 = require("./describe-ref");
6
- const validation_error_1 = require("../validation-error");
7
- function checkWorkingTree({ cwd } = {}, gitDryRun = false) {
8
- let chain = Promise.resolve();
9
- chain = chain.then(() => (0, describe_ref_1.describeRef)({ cwd }, undefined, gitDryRun));
10
- // wrap each test separately to allow all applicable errors to be reported
11
- const tests = [
12
- // prevent duplicate versioning
13
- chain.then(throwIfReleased),
14
- // prevent publish of uncommitted changes
15
- chain.then(mkThrowIfUncommitted({ cwd }, gitDryRun)),
16
- ];
17
- // passes through result of describeRef() to aid composability
18
- return chain.then((result) => Promise.all(tests).then(() => result));
19
- }
20
- exports.checkWorkingTree = checkWorkingTree;
21
- function throwIfReleased({ refCount }) {
22
- if (refCount === '0') {
23
- throw new validation_error_1.ValidationError('ERELEASED', 'The current commit has already been released. Please make new commits before continuing.');
24
- }
25
- }
26
- exports.throwIfReleased = throwIfReleased;
27
- const EUNCOMMIT_MSG = 'Working tree has uncommitted changes, please commit or remove the following changes before continuing:\n';
28
- function mkThrowIfUncommitted(options = {}, gitDryRun = false) {
29
- return function ({ isDirty }) {
30
- if (isDirty) {
31
- return (0, collect_uncommitted_1.collectUncommitted)(options, gitDryRun).then((uncommitted) => {
32
- throw new validation_error_1.ValidationError('EUNCOMMIT', `${EUNCOMMIT_MSG}${uncommitted.join('\n')}`);
33
- });
34
- }
35
- };
36
- }
37
- exports.mkThrowIfUncommitted = mkThrowIfUncommitted;
38
- function throwIfUncommitted() {
39
- mkThrowIfUncommitted();
40
- }
41
- exports.throwIfUncommitted = throwIfUncommitted;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throwIfUncommitted = exports.mkThrowIfUncommitted = exports.throwIfReleased = exports.checkWorkingTree = void 0;
4
+ const collect_uncommitted_1 = require("./collect-uncommitted");
5
+ const describe_ref_1 = require("./describe-ref");
6
+ const validation_error_1 = require("../validation-error");
7
+ function checkWorkingTree({ cwd } = {}, gitDryRun = false) {
8
+ let chain = Promise.resolve();
9
+ chain = chain.then(() => (0, describe_ref_1.describeRef)({ cwd }, undefined, gitDryRun));
10
+ // wrap each test separately to allow all applicable errors to be reported
11
+ const tests = [
12
+ // prevent duplicate versioning
13
+ chain.then(throwIfReleased),
14
+ // prevent publish of uncommitted changes
15
+ chain.then(mkThrowIfUncommitted({ cwd }, gitDryRun)),
16
+ ];
17
+ // passes through result of describeRef() to aid composability
18
+ return chain.then((result) => Promise.all(tests).then(() => result));
19
+ }
20
+ exports.checkWorkingTree = checkWorkingTree;
21
+ function throwIfReleased({ refCount }) {
22
+ if (refCount === '0') {
23
+ throw new validation_error_1.ValidationError('ERELEASED', 'The current commit has already been released. Please make new commits before continuing.');
24
+ }
25
+ }
26
+ exports.throwIfReleased = throwIfReleased;
27
+ const EUNCOMMIT_MSG = 'Working tree has uncommitted changes, please commit or remove the following changes before continuing:\n';
28
+ function mkThrowIfUncommitted(options = {}, gitDryRun = false) {
29
+ return function ({ isDirty }) {
30
+ if (isDirty) {
31
+ return (0, collect_uncommitted_1.collectUncommitted)(options, gitDryRun).then((uncommitted) => {
32
+ throw new validation_error_1.ValidationError('EUNCOMMIT', `${EUNCOMMIT_MSG}${uncommitted.join('\n')}`);
33
+ });
34
+ }
35
+ };
36
+ }
37
+ exports.mkThrowIfUncommitted = mkThrowIfUncommitted;
38
+ function throwIfUncommitted() {
39
+ mkThrowIfUncommitted();
40
+ }
41
+ exports.throwIfUncommitted = throwIfUncommitted;
42
42
  //# sourceMappingURL=check-working-tree.js.map
@@ -1,5 +1,5 @@
1
- /**
2
- * @param {import("execa").ExecaError} err
3
- * @param {string} className
4
- */
5
- export declare function cleanStack(err: any, className: any): any;
1
+ /**
2
+ * @param {import("execa").ExecaError} err
3
+ * @param {string} className
4
+ */
5
+ export declare function cleanStack(err: any, className: any): any;
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanStack = void 0;
4
- /**
5
- * @param {import("execa").ExecaError} err
6
- * @param {string} className
7
- */
8
- function cleanStack(err, className) {
9
- const lines = err.stack ? err.stack.split('\n') : String(err).split('\n');
10
- const cutoff = new RegExp(`^ at ${className}.runCommand .*$`);
11
- const relevantIndex = lines.findIndex((line) => cutoff.test(line));
12
- if (relevantIndex) {
13
- return lines.slice(0, relevantIndex).join('\n');
14
- }
15
- // nothing matched, just return original error
16
- return err;
17
- }
18
- exports.cleanStack = cleanStack;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanStack = void 0;
4
+ /**
5
+ * @param {import("execa").ExecaError} err
6
+ * @param {string} className
7
+ */
8
+ function cleanStack(err, className) {
9
+ const lines = err.stack ? err.stack.split('\n') : String(err).split('\n');
10
+ const cutoff = new RegExp(`^ at ${className}.runCommand .*$`);
11
+ const relevantIndex = lines.findIndex((line) => cutoff.test(line));
12
+ if (relevantIndex) {
13
+ return lines.slice(0, relevantIndex).join('\n');
14
+ }
15
+ // nothing matched, just return original error
16
+ return err;
17
+ }
18
+ exports.cleanStack = cleanStack;
19
19
  //# sourceMappingURL=clean-stack.js.map
@@ -1,18 +1,18 @@
1
- import npmlog from 'npmlog';
2
- interface UncommittedConfig {
3
- cwd: string;
4
- log?: typeof npmlog;
5
- }
6
- /**
7
- * Report uncommitted files. (async)
8
- * @param {UncommittedConfig} options
9
- * @returns {Promise<string[]>} A list of uncommitted files
10
- */
11
- export declare function collectUncommitted({ cwd, log }: UncommittedConfig, gitDryRun?: boolean): Promise<string[]>;
12
- /**
13
- * Report uncommitted files. (sync)
14
- * @param {UncommittedConfig} options
15
- * @returns {string[]} A list of uncommitted files
16
- */
17
- export declare function collectUncommittedSync({ cwd, log }: UncommittedConfig, gitDryRun?: boolean): string[];
18
- export {};
1
+ import npmlog from 'npmlog';
2
+ interface UncommittedConfig {
3
+ cwd: string;
4
+ log?: typeof npmlog;
5
+ }
6
+ /**
7
+ * Report uncommitted files. (async)
8
+ * @param {UncommittedConfig} options
9
+ * @returns {Promise<string[]>} A list of uncommitted files
10
+ */
11
+ export declare function collectUncommitted({ cwd, log }: UncommittedConfig, gitDryRun?: boolean): Promise<string[]>;
12
+ /**
13
+ * Report uncommitted files. (sync)
14
+ * @param {UncommittedConfig} options
15
+ * @returns {string[]} A list of uncommitted files
16
+ */
17
+ export declare function collectUncommittedSync({ cwd, log }: UncommittedConfig, gitDryRun?: boolean): string[];
18
+ export {};
@@ -1,41 +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.collectUncommittedSync = exports.collectUncommitted = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const npmlog_1 = __importDefault(require("npmlog"));
9
- const child_process_1 = require("../child-process");
10
- const maybeColorize = (colorize) => (s) => (s !== ' ' ? colorize(s) : s);
11
- const cRed = maybeColorize(chalk_1.default.red);
12
- const cGreen = maybeColorize(chalk_1.default.green);
13
- const replaceStatus = (_, maybeGreen, maybeRed) => `${cGreen(maybeGreen)}${cRed(maybeRed)}`;
14
- const colorizeStats = (stats) => stats.replace(/^([^U]| )([A-Z]| )/gm, replaceStatus).replace(/^\?{2}|U{2}/gm, cRed('$&'));
15
- const splitOnNewLine = (str) => str.split('\n');
16
- const filterEmpty = (lines) => lines.filter((line) => line.length);
17
- const o = (l, r) => (x) => l(r(x));
18
- const transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats));
19
- /**
20
- * Report uncommitted files. (async)
21
- * @param {UncommittedConfig} options
22
- * @returns {Promise<string[]>} A list of uncommitted files
23
- */
24
- function collectUncommitted({ cwd, log = npmlog_1.default }, gitDryRun = false) {
25
- log.silly('collect-uncommitted', 'git status --porcelain (async)');
26
- return (0, child_process_1.exec)('git', ['status', '--porcelain'], { cwd }, gitDryRun)
27
- .then(({ stdout }) => transformOutput(stdout));
28
- }
29
- exports.collectUncommitted = collectUncommitted;
30
- /**
31
- * Report uncommitted files. (sync)
32
- * @param {UncommittedConfig} options
33
- * @returns {string[]} A list of uncommitted files
34
- */
35
- function collectUncommittedSync({ cwd, log = npmlog_1.default }, gitDryRun = false) {
36
- log.silly('collect-uncommitted', 'git status --porcelain (sync)');
37
- const stdout = (0, child_process_1.execSync)('git', ['status', '--porcelain'], { cwd }, gitDryRun);
38
- return transformOutput(stdout);
39
- }
40
- exports.collectUncommittedSync = collectUncommittedSync;
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.collectUncommittedSync = exports.collectUncommitted = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const npmlog_1 = __importDefault(require("npmlog"));
9
+ const child_process_1 = require("../child-process");
10
+ const maybeColorize = (colorize) => (s) => (s !== ' ' ? colorize(s) : s);
11
+ const cRed = maybeColorize(chalk_1.default.red);
12
+ const cGreen = maybeColorize(chalk_1.default.green);
13
+ const replaceStatus = (_, maybeGreen, maybeRed) => `${cGreen(maybeGreen)}${cRed(maybeRed)}`;
14
+ const colorizeStats = (stats) => stats.replace(/^([^U]| )([A-Z]| )/gm, replaceStatus).replace(/^\?{2}|U{2}/gm, cRed('$&'));
15
+ const splitOnNewLine = (str) => str.split('\n');
16
+ const filterEmpty = (lines) => lines.filter((line) => line.length);
17
+ const o = (l, r) => (x) => l(r(x));
18
+ const transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats));
19
+ /**
20
+ * Report uncommitted files. (async)
21
+ * @param {UncommittedConfig} options
22
+ * @returns {Promise<string[]>} A list of uncommitted files
23
+ */
24
+ function collectUncommitted({ cwd, log = npmlog_1.default }, gitDryRun = false) {
25
+ log.silly('collect-uncommitted', 'git status --porcelain (async)');
26
+ return (0, child_process_1.exec)('git', ['status', '--porcelain'], { cwd }, gitDryRun)
27
+ .then(({ stdout }) => transformOutput(stdout));
28
+ }
29
+ exports.collectUncommitted = collectUncommitted;
30
+ /**
31
+ * Report uncommitted files. (sync)
32
+ * @param {UncommittedConfig} options
33
+ * @returns {string[]} A list of uncommitted files
34
+ */
35
+ function collectUncommittedSync({ cwd, log = npmlog_1.default }, gitDryRun = false) {
36
+ log.silly('collect-uncommitted', 'git status --porcelain (sync)');
37
+ const stdout = (0, child_process_1.execSync)('git', ['status', '--porcelain'], { cwd }, gitDryRun);
38
+ return transformOutput(stdout);
39
+ }
40
+ exports.collectUncommittedSync = collectUncommittedSync;
41
41
  //# sourceMappingURL=collect-uncommitted.js.map
@@ -1,11 +1,11 @@
1
- import { ExecOpts, UpdateCollectorOptions } from '../../models';
2
- import { Package } from '../../package';
3
- import { PackageGraph } from '../../package-graph';
4
- /**
5
- * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
6
- * @param {import("@lerna/package").Package[]} filteredPackages
7
- * @param {import("@lerna/package-graph").PackageGraph} packageGraph
8
- * @param {import("@lerna/child-process").ExecOpts} execOpts
9
- * @param {UpdateCollectorOptions} commandOptions
10
- */
11
- export declare function collectUpdates(filteredPackages: Package[], packageGraph: PackageGraph, execOpts: ExecOpts, commandOptions: UpdateCollectorOptions, gitDryRun?: boolean): import("../../package-graph").PackageGraphNode[];
1
+ import { ExecOpts, UpdateCollectorOptions } from '../../models';
2
+ import { Package } from '../../package';
3
+ import { PackageGraph } from '../../package-graph';
4
+ /**
5
+ * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
6
+ * @param {import("@lerna/package").Package[]} filteredPackages
7
+ * @param {import("@lerna/package-graph").PackageGraph} packageGraph
8
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
9
+ * @param {UpdateCollectorOptions} commandOptions
10
+ */
11
+ export declare function collectUpdates(filteredPackages: Package[], packageGraph: PackageGraph, execOpts: ExecOpts, commandOptions: UpdateCollectorOptions, gitDryRun?: boolean): import("../../package-graph").PackageGraphNode[];
@@ -1,83 +1,83 @@
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.collectUpdates = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- const describe_ref_1 = require("../describe-ref");
9
- const collect_packages_1 = require("./lib/collect-packages");
10
- const get_packages_for_option_1 = require("./lib/get-packages-for-option");
11
- const has_tags_1 = require("./lib/has-tags");
12
- const make_diff_predicate_1 = require("./lib/make-diff-predicate");
13
- /**
14
- * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
15
- * @param {import("@lerna/package").Package[]} filteredPackages
16
- * @param {import("@lerna/package-graph").PackageGraph} packageGraph
17
- * @param {import("@lerna/child-process").ExecOpts} execOpts
18
- * @param {UpdateCollectorOptions} commandOptions
19
- */
20
- function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions, gitDryRun = false) {
21
- const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions;
22
- // If --conventional-commits and --conventional-graduate are both set, ignore --force-publish
23
- const useConventionalGraduate = conventionalCommits && conventionalGraduate;
24
- const forced = (0, get_packages_for_option_1.getPackagesForOption)(useConventionalGraduate ? conventionalGraduate : forcePublish);
25
- const packages = filteredPackages.length === packageGraph.size
26
- ? packageGraph
27
- : new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)]));
28
- let committish = commandOptions.since;
29
- if ((0, has_tags_1.hasTags)(execOpts)) {
30
- // describe the last annotated tag in the current branch
31
- const { sha, refCount, lastTagName } = (0, describe_ref_1.describeRefSync)(execOpts, commandOptions.includeMergedTags, gitDryRun);
32
- // TODO: warn about dirty tree?
33
- if (refCount === '0' && forced.size === 0 && !committish) {
34
- // no commits since previous release
35
- npmlog_1.default.notice('', 'Current HEAD is already released, skipping change detection.');
36
- return [];
37
- }
38
- if (commandOptions.canary) {
39
- // if it's a merge commit, it will return all the commits that were part of the merge
40
- // ex: If `ab7533e` had 2 commits, ab7533e^..ab7533e would contain 2 commits + the merge commit
41
- committish = `${sha}^..${sha}`;
42
- }
43
- else if (!committish) {
44
- // if no tags found, this will be undefined and we'll use the initial commit
45
- committish = lastTagName;
46
- }
47
- }
48
- if (forced.size) {
49
- // "warn" might seem a bit loud, but it is appropriate for logging anything _forced_
50
- npmlog_1.default.warn(useConventionalGraduate ? 'conventional-graduate' : 'force-publish', forced.has('*') ? 'all packages' : Array.from(forced.values()).join('\n'));
51
- }
52
- if (useConventionalGraduate) {
53
- // --conventional-commits --conventional-graduate
54
- if (forced.has('*')) {
55
- npmlog_1.default.info('', 'Graduating all prereleased packages');
56
- }
57
- else {
58
- npmlog_1.default.info('', 'Graduating prereleased packages');
59
- }
60
- }
61
- else if (!committish || forced.has('*')) {
62
- // --force-publish or no tag
63
- npmlog_1.default.info('', 'Assuming all packages changed');
64
- return (0, collect_packages_1.collectPackages)(packages, {
65
- onInclude: (name) => npmlog_1.default.verbose('updated', name),
66
- excludeDependents,
67
- });
68
- }
69
- npmlog_1.default.info('', `Looking for changed packages since ${committish}`);
70
- const hasDiff = (0, make_diff_predicate_1.makeDiffPredicate)(committish, execOpts, commandOptions.ignoreChanges);
71
- const needsBump = !commandOptions.bump || commandOptions.bump.startsWith('pre')
72
- ? () => false
73
- : /* skip packages that have not been previously prereleased */
74
- (node) => node.prereleaseId;
75
- const isForced = (node, name) => (forced.has('*') || forced.has(name)) && (useConventionalGraduate ? node.prereleaseId : true);
76
- return (0, collect_packages_1.collectPackages)(packages, {
77
- isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node),
78
- onInclude: (name) => npmlog_1.default.verbose('updated', name),
79
- excludeDependents,
80
- });
81
- }
82
- exports.collectUpdates = collectUpdates;
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.collectUpdates = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const describe_ref_1 = require("../describe-ref");
9
+ const collect_packages_1 = require("./lib/collect-packages");
10
+ const get_packages_for_option_1 = require("./lib/get-packages-for-option");
11
+ const has_tags_1 = require("./lib/has-tags");
12
+ const make_diff_predicate_1 = require("./lib/make-diff-predicate");
13
+ /**
14
+ * Create a list of graph nodes representing packages changed since the previous release, tagged or otherwise.
15
+ * @param {import("@lerna/package").Package[]} filteredPackages
16
+ * @param {import("@lerna/package-graph").PackageGraph} packageGraph
17
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
18
+ * @param {UpdateCollectorOptions} commandOptions
19
+ */
20
+ function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions, gitDryRun = false) {
21
+ const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions;
22
+ // If --conventional-commits and --conventional-graduate are both set, ignore --force-publish
23
+ const useConventionalGraduate = conventionalCommits && conventionalGraduate;
24
+ const forced = (0, get_packages_for_option_1.getPackagesForOption)(useConventionalGraduate ? conventionalGraduate : forcePublish);
25
+ const packages = filteredPackages.length === packageGraph.size
26
+ ? packageGraph
27
+ : new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)]));
28
+ let committish = commandOptions.since;
29
+ if ((0, has_tags_1.hasTags)(execOpts)) {
30
+ // describe the last annotated tag in the current branch
31
+ const { sha, refCount, lastTagName } = (0, describe_ref_1.describeRefSync)(execOpts, commandOptions.includeMergedTags, gitDryRun);
32
+ // TODO: warn about dirty tree?
33
+ if (refCount === '0' && forced.size === 0 && !committish) {
34
+ // no commits since previous release
35
+ npmlog_1.default.notice('', 'Current HEAD is already released, skipping change detection.');
36
+ return [];
37
+ }
38
+ if (commandOptions.canary) {
39
+ // if it's a merge commit, it will return all the commits that were part of the merge
40
+ // ex: If `ab7533e` had 2 commits, ab7533e^..ab7533e would contain 2 commits + the merge commit
41
+ committish = `${sha}^..${sha}`;
42
+ }
43
+ else if (!committish) {
44
+ // if no tags found, this will be undefined and we'll use the initial commit
45
+ committish = lastTagName;
46
+ }
47
+ }
48
+ if (forced.size) {
49
+ // "warn" might seem a bit loud, but it is appropriate for logging anything _forced_
50
+ npmlog_1.default.warn(useConventionalGraduate ? 'conventional-graduate' : 'force-publish', forced.has('*') ? 'all packages' : Array.from(forced.values()).join('\n'));
51
+ }
52
+ if (useConventionalGraduate) {
53
+ // --conventional-commits --conventional-graduate
54
+ if (forced.has('*')) {
55
+ npmlog_1.default.info('', 'Graduating all prereleased packages');
56
+ }
57
+ else {
58
+ npmlog_1.default.info('', 'Graduating prereleased packages');
59
+ }
60
+ }
61
+ else if (!committish || forced.has('*')) {
62
+ // --force-publish or no tag
63
+ npmlog_1.default.info('', 'Assuming all packages changed');
64
+ return (0, collect_packages_1.collectPackages)(packages, {
65
+ onInclude: (name) => npmlog_1.default.verbose('updated', name),
66
+ excludeDependents,
67
+ });
68
+ }
69
+ npmlog_1.default.info('', `Looking for changed packages since ${committish}`);
70
+ const hasDiff = (0, make_diff_predicate_1.makeDiffPredicate)(committish, execOpts, commandOptions.ignoreChanges);
71
+ const needsBump = !commandOptions.bump || commandOptions.bump.startsWith('pre')
72
+ ? () => false
73
+ : /* skip packages that have not been previously prereleased */
74
+ (node) => node.prereleaseId;
75
+ const isForced = (node, name) => (forced.has('*') || forced.has(name)) && (useConventionalGraduate ? node.prereleaseId : true);
76
+ return (0, collect_packages_1.collectPackages)(packages, {
77
+ isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node),
78
+ onInclude: (name) => npmlog_1.default.verbose('updated', name),
79
+ excludeDependents,
80
+ });
81
+ }
82
+ exports.collectUpdates = collectUpdates;
83
83
  //# sourceMappingURL=collect-updates.js.map
@@ -1,2 +1,2 @@
1
- export * from './collect-updates';
2
- export * from './lib';
1
+ export * from './collect-updates';
2
+ export * from './lib';
@@ -1,19 +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
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./collect-updates"), exports);
18
- __exportStar(require("./lib"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./collect-updates"), exports);
18
+ __exportStar(require("./lib"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- /**
2
- * @callback LocalDependentVisitor
3
- * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode
4
- * @param {string} dependentName
5
- * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} siblingDependents
6
- */
7
- /**
8
- * Build a set of nodes that are dependents of the input set.
9
- * @param {Set<import("@lerna/package-graph").PackageGraphNode>} nodes
10
- */
11
- export declare function collectDependents(nodes: any): Set<unknown>;
1
+ /**
2
+ * @callback LocalDependentVisitor
3
+ * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode
4
+ * @param {string} dependentName
5
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} siblingDependents
6
+ */
7
+ /**
8
+ * Build a set of nodes that are dependents of the input set.
9
+ * @param {Set<import("@lerna/package-graph").PackageGraphNode>} nodes
10
+ */
11
+ export declare function collectDependents(nodes: any): Set<unknown>;
@@ -1,46 +1,46 @@
1
- "use strict";
2
- /**
3
- * @callback LocalDependentVisitor
4
- * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode
5
- * @param {string} dependentName
6
- * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} siblingDependents
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.collectDependents = void 0;
10
- /**
11
- * Build a set of nodes that are dependents of the input set.
12
- * @param {Set<import("@lerna/package-graph").PackageGraphNode>} nodes
13
- */
14
- function collectDependents(nodes) {
15
- /** @type {typeof nodes} */
16
- const collected = new Set();
17
- nodes.forEach((currentNode) => {
18
- if (currentNode.localDependents.size === 0) {
19
- // no point diving into a non-existent tree
20
- return;
21
- }
22
- // breadth-first search
23
- const queue = [currentNode];
24
- const seen = new Set();
25
- /** @type {LocalDependentVisitor} */
26
- const visit = (dependentNode, dependentName, siblingDependents) => {
27
- if (seen.has(dependentNode)) {
28
- return;
29
- }
30
- seen.add(dependentNode);
31
- if (dependentNode === currentNode || siblingDependents.has(currentNode.name)) {
32
- // a direct or transitive cycle, skip it
33
- return;
34
- }
35
- collected.add(dependentNode);
36
- queue.push(dependentNode);
37
- };
38
- while (queue.length) {
39
- const node = queue.shift();
40
- node.localDependents.forEach(visit);
41
- }
42
- });
43
- return collected;
44
- }
45
- exports.collectDependents = collectDependents;
1
+ "use strict";
2
+ /**
3
+ * @callback LocalDependentVisitor
4
+ * @param {import("@lerna/package-graph").PackageGraphNode} dependentNode
5
+ * @param {string} dependentName
6
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} siblingDependents
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.collectDependents = void 0;
10
+ /**
11
+ * Build a set of nodes that are dependents of the input set.
12
+ * @param {Set<import("@lerna/package-graph").PackageGraphNode>} nodes
13
+ */
14
+ function collectDependents(nodes) {
15
+ /** @type {typeof nodes} */
16
+ const collected = new Set();
17
+ nodes.forEach((currentNode) => {
18
+ if (currentNode.localDependents.size === 0) {
19
+ // no point diving into a non-existent tree
20
+ return;
21
+ }
22
+ // breadth-first search
23
+ const queue = [currentNode];
24
+ const seen = new Set();
25
+ /** @type {LocalDependentVisitor} */
26
+ const visit = (dependentNode, dependentName, siblingDependents) => {
27
+ if (seen.has(dependentNode)) {
28
+ return;
29
+ }
30
+ seen.add(dependentNode);
31
+ if (dependentNode === currentNode || siblingDependents.has(currentNode.name)) {
32
+ // a direct or transitive cycle, skip it
33
+ return;
34
+ }
35
+ collected.add(dependentNode);
36
+ queue.push(dependentNode);
37
+ };
38
+ while (queue.length) {
39
+ const node = queue.shift();
40
+ node.localDependents.forEach(visit);
41
+ }
42
+ });
43
+ return collected;
44
+ }
45
+ exports.collectDependents = collectDependents;
46
46
  //# sourceMappingURL=collect-dependents.js.map
@@ -1,13 +1,13 @@
1
- import { PackageGraphNode } from '../../../package-graph/lib/package-graph-node';
2
- interface PackageCollectorOptions {
3
- isCandidate?: (node: PackageGraphNode, name: string) => boolean;
4
- onInclude?: (name: string) => void;
5
- excludeDependents?: boolean;
6
- }
7
- /**
8
- * Build a list of graph nodes, possibly including dependents, using predicate if available.
9
- * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
10
- * @param {PackageCollectorOptions} options
11
- */
12
- export declare function collectPackages(packages: any, { isCandidate, onInclude, excludeDependents }?: PackageCollectorOptions): PackageGraphNode[];
13
- export {};
1
+ import { PackageGraphNode } from '../../../package-graph/lib/package-graph-node';
2
+ interface PackageCollectorOptions {
3
+ isCandidate?: (node: PackageGraphNode, name: string) => boolean;
4
+ onInclude?: (name: string) => void;
5
+ excludeDependents?: boolean;
6
+ }
7
+ /**
8
+ * Build a list of graph nodes, possibly including dependents, using predicate if available.
9
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
10
+ * @param {PackageCollectorOptions} options
11
+ */
12
+ export declare function collectPackages(packages: any, { isCandidate, onInclude, excludeDependents }?: PackageCollectorOptions): PackageGraphNode[];
13
+ export {};