@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,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectPackages = void 0;
4
- const collect_dependents_1 = require("./collect-dependents");
5
- /**
6
- * Build a list of graph nodes, possibly including dependents, using predicate if available.
7
- * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
8
- * @param {PackageCollectorOptions} options
9
- */
10
- function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) {
11
- /** @type {Set<import("@lerna/package-graph").PackageGraphNode>} */
12
- const candidates = new Set();
13
- packages.forEach((node, name) => {
14
- if (isCandidate(node, name)) {
15
- candidates.add(node);
16
- }
17
- });
18
- if (!excludeDependents) {
19
- (0, collect_dependents_1.collectDependents)(candidates).forEach((node) => candidates.add(node));
20
- }
21
- // The result should always be in the same order as the input
22
- const updates = [];
23
- packages.forEach((node, name) => {
24
- if (candidates.has(node)) {
25
- if (onInclude) {
26
- onInclude(name);
27
- }
28
- updates.push(node);
29
- }
30
- });
31
- return updates;
32
- }
33
- exports.collectPackages = collectPackages;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectPackages = void 0;
4
+ const collect_dependents_1 = require("./collect-dependents");
5
+ /**
6
+ * Build a list of graph nodes, possibly including dependents, using predicate if available.
7
+ * @param {Map<string, import("@lerna/package-graph").PackageGraphNode>} packages
8
+ * @param {PackageCollectorOptions} options
9
+ */
10
+ function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) {
11
+ /** @type {Set<import("@lerna/package-graph").PackageGraphNode>} */
12
+ const candidates = new Set();
13
+ packages.forEach((node, name) => {
14
+ if (isCandidate(node, name)) {
15
+ candidates.add(node);
16
+ }
17
+ });
18
+ if (!excludeDependents) {
19
+ (0, collect_dependents_1.collectDependents)(candidates).forEach((node) => candidates.add(node));
20
+ }
21
+ // The result should always be in the same order as the input
22
+ const updates = [];
23
+ packages.forEach((node, name) => {
24
+ if (candidates.has(node)) {
25
+ if (onInclude) {
26
+ onInclude(name);
27
+ }
28
+ updates.push(node);
29
+ }
30
+ });
31
+ return updates;
32
+ }
33
+ exports.collectPackages = collectPackages;
34
34
  //# sourceMappingURL=collect-packages.js.map
@@ -1,5 +1,5 @@
1
- /**
2
- * @param {boolean|string|string[]} option
3
- * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
4
- */
5
- export declare function getPackagesForOption(option: boolean | string | string[]): Set<string>;
1
+ /**
2
+ * @param {boolean|string|string[]} option
3
+ * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
4
+ */
5
+ export declare function getPackagesForOption(option: boolean | string | string[]): Set<string>;
@@ -1,31 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPackagesForOption = void 0;
4
- /**
5
- * @param {boolean|string|string[]} option
6
- * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
7
- */
8
- function getPackagesForOption(option) {
9
- // new Set(null) is equivalent to new Set([])
10
- // i.e., an empty Set
11
- let inputs = null;
12
- if (option === true) {
13
- // option passed without specific packages, eg. --force-publish
14
- inputs = ['*'];
15
- }
16
- else if (typeof option === 'string') {
17
- // option passed with one or more comma separated package names, eg.:
18
- // --force-publish=*
19
- // --force-publish=foo
20
- // --force-publish=foo,bar
21
- inputs = option.split(',');
22
- }
23
- else if (Array.isArray(option)) {
24
- // option passed multiple times with individual package names
25
- // --force-publish foo --force-publish baz
26
- inputs = [...option];
27
- }
28
- return new Set(inputs);
29
- }
30
- exports.getPackagesForOption = getPackagesForOption;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackagesForOption = void 0;
4
+ /**
5
+ * @param {boolean|string|string[]} option
6
+ * @returns {Set<string>} A set of package names (or wildcard) derived from option value.
7
+ */
8
+ function getPackagesForOption(option) {
9
+ // new Set(null) is equivalent to new Set([])
10
+ // i.e., an empty Set
11
+ let inputs = null;
12
+ if (option === true) {
13
+ // option passed without specific packages, eg. --force-publish
14
+ inputs = ['*'];
15
+ }
16
+ else if (typeof option === 'string') {
17
+ // option passed with one or more comma separated package names, eg.:
18
+ // --force-publish=*
19
+ // --force-publish=foo
20
+ // --force-publish=foo,bar
21
+ inputs = option.split(',');
22
+ }
23
+ else if (Array.isArray(option)) {
24
+ // option passed multiple times with individual package names
25
+ // --force-publish foo --force-publish baz
26
+ inputs = [...option];
27
+ }
28
+ return new Set(inputs);
29
+ }
30
+ exports.getPackagesForOption = getPackagesForOption;
31
31
  //# sourceMappingURL=get-packages-for-option.js.map
@@ -1,5 +1,5 @@
1
- /**
2
- * Determine if any git tags are reachable.
3
- * @param {import("@lerna/child-process").ExecOpts} opts
4
- */
5
- export declare function hasTags(opts: any): boolean;
1
+ /**
2
+ * Determine if any git tags are reachable.
3
+ * @param {import("@lerna/child-process").ExecOpts} opts
4
+ */
5
+ export declare function hasTags(opts: any): boolean;
@@ -1,27 +1,27 @@
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.hasTags = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- const child_process_1 = require("../../../child-process");
9
- /**
10
- * Determine if any git tags are reachable.
11
- * @param {import("@lerna/child-process").ExecOpts} opts
12
- */
13
- function hasTags(opts) {
14
- npmlog_1.default.silly('hasTags', '');
15
- let result = false;
16
- try {
17
- result = !!(0, child_process_1.execSync)('git', ['tag'], opts);
18
- }
19
- catch (err) {
20
- npmlog_1.default.warn('ENOTAGS', 'No git tags were reachable from this branch!');
21
- npmlog_1.default.verbose('hasTags error', err);
22
- }
23
- npmlog_1.default.verbose('hasTags', result.toString());
24
- return result;
25
- }
26
- exports.hasTags = hasTags;
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.hasTags = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const child_process_1 = require("../../../child-process");
9
+ /**
10
+ * Determine if any git tags are reachable.
11
+ * @param {import("@lerna/child-process").ExecOpts} opts
12
+ */
13
+ function hasTags(opts) {
14
+ npmlog_1.default.silly('hasTags', '');
15
+ let result = false;
16
+ try {
17
+ result = !!(0, child_process_1.execSync)('git', ['tag'], opts);
18
+ }
19
+ catch (err) {
20
+ npmlog_1.default.warn('ENOTAGS', 'No git tags were reachable from this branch!');
21
+ npmlog_1.default.verbose('hasTags error', err);
22
+ }
23
+ npmlog_1.default.verbose('hasTags', result.toString());
24
+ return result;
25
+ }
26
+ exports.hasTags = hasTags;
27
27
  //# sourceMappingURL=has-tags.js.map
@@ -1,5 +1,5 @@
1
- export * from './collect-packages';
2
- export * from './collect-dependents';
3
- export * from './get-packages-for-option';
4
- export * from './has-tags';
5
- export * from './make-diff-predicate';
1
+ export * from './collect-packages';
2
+ export * from './collect-dependents';
3
+ export * from './get-packages-for-option';
4
+ export * from './has-tags';
5
+ export * from './make-diff-predicate';
@@ -1,22 +1,22 @@
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-packages"), exports);
18
- __exportStar(require("./collect-dependents"), exports);
19
- __exportStar(require("./get-packages-for-option"), exports);
20
- __exportStar(require("./has-tags"), exports);
21
- __exportStar(require("./make-diff-predicate"), 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-packages"), exports);
18
+ __exportStar(require("./collect-dependents"), exports);
19
+ __exportStar(require("./get-packages-for-option"), exports);
20
+ __exportStar(require("./has-tags"), exports);
21
+ __exportStar(require("./make-diff-predicate"), exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- import { ExecOpts } from '../../../models';
2
- /**
3
- * @param {string} committish
4
- * @param {import("@lerna/child-process").ExecOpts} execOpts
5
- * @param {string[]} ignorePatterns
6
- */
7
- export declare function makeDiffPredicate(committish: string, execOpts: ExecOpts, ignorePatterns?: string[]): (node: any) => boolean;
1
+ import { ExecOpts } from '../../../models';
2
+ /**
3
+ * @param {string} committish
4
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
5
+ * @param {string[]} ignorePatterns
6
+ */
7
+ export declare function makeDiffPredicate(committish: string, execOpts: ExecOpts, ignorePatterns?: string[]): (node: any) => boolean;
@@ -1,65 +1,65 @@
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.makeDiffPredicate = void 0;
7
- const npmlog_1 = __importDefault(require("npmlog"));
8
- const minimatch_1 = __importDefault(require("minimatch"));
9
- const path_1 = __importDefault(require("path"));
10
- const slash_1 = __importDefault(require("slash"));
11
- const child_process_1 = require("../../../child-process");
12
- /**
13
- * @param {string} committish
14
- * @param {import("@lerna/child-process").ExecOpts} execOpts
15
- * @param {string[]} ignorePatterns
16
- */
17
- function makeDiffPredicate(committish, execOpts, ignorePatterns = []) {
18
- const ignoreFilters = new Set(ignorePatterns.map((p) => minimatch_1.default.filter(`!${p}`, {
19
- matchBase: true,
20
- // dotfiles inside ignored directories should also match
21
- dot: true,
22
- })));
23
- if (ignoreFilters.size) {
24
- npmlog_1.default.info('ignoring diff in paths matching', ignorePatterns.join(' '));
25
- }
26
- return function hasDiffSinceThatIsntIgnored(
27
- /** @type {import("@lerna/package-graph").PackageGraphNode} */ node) {
28
- const diff = diffSinceIn(committish, node.location, execOpts);
29
- if (diff === '') {
30
- npmlog_1.default.silly('', 'no diff found in %s', node.name);
31
- return false;
32
- }
33
- npmlog_1.default.silly('found diff in', diff);
34
- let changedFiles = diff.split('\n');
35
- if (ignoreFilters.size) {
36
- for (const ignored of ignoreFilters) {
37
- changedFiles = changedFiles.filter(ignored);
38
- }
39
- }
40
- if (changedFiles.length) {
41
- npmlog_1.default.verbose('filtered diff', changedFiles.join(' '));
42
- }
43
- else {
44
- npmlog_1.default.verbose('', 'no diff found in %s (after filtering)', node.name);
45
- }
46
- return changedFiles.length > 0;
47
- };
48
- }
49
- exports.makeDiffPredicate = makeDiffPredicate;
50
- /**
51
- * @param {string} committish
52
- * @param {string} location
53
- * @param {import("@lerna/child-process").ExecOpts} opts
54
- */
55
- function diffSinceIn(committish, location, opts) {
56
- const args = ['diff', '--name-only', committish];
57
- const formattedLocation = (0, slash_1.default)(path_1.default.relative(opts.cwd, location));
58
- if (formattedLocation) {
59
- // avoid same-directory path.relative() === ""
60
- args.push('--', formattedLocation);
61
- }
62
- npmlog_1.default.silly('checking diff', formattedLocation);
63
- return (0, child_process_1.execSync)('git', args, opts);
64
- }
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.makeDiffPredicate = void 0;
7
+ const npmlog_1 = __importDefault(require("npmlog"));
8
+ const minimatch_1 = __importDefault(require("minimatch"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const slash_1 = __importDefault(require("slash"));
11
+ const child_process_1 = require("../../../child-process");
12
+ /**
13
+ * @param {string} committish
14
+ * @param {import("@lerna/child-process").ExecOpts} execOpts
15
+ * @param {string[]} ignorePatterns
16
+ */
17
+ function makeDiffPredicate(committish, execOpts, ignorePatterns = []) {
18
+ const ignoreFilters = new Set(ignorePatterns.map((p) => minimatch_1.default.filter(`!${p}`, {
19
+ matchBase: true,
20
+ // dotfiles inside ignored directories should also match
21
+ dot: true,
22
+ })));
23
+ if (ignoreFilters.size) {
24
+ npmlog_1.default.info('ignoring diff in paths matching', ignorePatterns.join(' '));
25
+ }
26
+ return function hasDiffSinceThatIsntIgnored(
27
+ /** @type {import("@lerna/package-graph").PackageGraphNode} */ node) {
28
+ const diff = diffSinceIn(committish, node.location, execOpts);
29
+ if (diff === '') {
30
+ npmlog_1.default.silly('', 'no diff found in %s', node.name);
31
+ return false;
32
+ }
33
+ npmlog_1.default.silly('found diff in', diff);
34
+ let changedFiles = diff.split('\n');
35
+ if (ignoreFilters.size) {
36
+ for (const ignored of ignoreFilters) {
37
+ changedFiles = changedFiles.filter(ignored);
38
+ }
39
+ }
40
+ if (changedFiles.length) {
41
+ npmlog_1.default.verbose('filtered diff', changedFiles.join(' '));
42
+ }
43
+ else {
44
+ npmlog_1.default.verbose('', 'no diff found in %s (after filtering)', node.name);
45
+ }
46
+ return changedFiles.length > 0;
47
+ };
48
+ }
49
+ exports.makeDiffPredicate = makeDiffPredicate;
50
+ /**
51
+ * @param {string} committish
52
+ * @param {string} location
53
+ * @param {import("@lerna/child-process").ExecOpts} opts
54
+ */
55
+ function diffSinceIn(committish, location, opts) {
56
+ const args = ['diff', '--name-only', committish];
57
+ const formattedLocation = (0, slash_1.default)(path_1.default.relative(opts.cwd, location));
58
+ if (formattedLocation) {
59
+ // avoid same-directory path.relative() === ""
60
+ args.push('--', formattedLocation);
61
+ }
62
+ npmlog_1.default.silly('checking diff', formattedLocation);
63
+ return (0, child_process_1.execSync)('git', args, opts);
64
+ }
65
65
  //# sourceMappingURL=make-diff-predicate.js.map
@@ -1,25 +1,25 @@
1
- import { ConfigChain } from 'config-chain';
2
- export declare class Conf extends ConfigChain {
3
- _await: any;
4
- addString: any;
5
- del: any;
6
- get: any;
7
- set: any;
8
- globalPrefix: string;
9
- localPrefix: string;
10
- root: any;
11
- sources: any;
12
- push: any;
13
- list: any;
14
- constructor(base: any);
15
- add(data: any, marker: any): any;
16
- addFile(file: string, name?: string): this;
17
- addEnv(env?: {
18
- [key: string]: string | undefined;
19
- }): any;
20
- loadPrefix(): any;
21
- loadCAFile(file: string): void;
22
- loadUser(): void;
23
- getCredentialsByURI(uri: string): any;
24
- setCredentialsByURI(uri: any, c: any): void;
25
- }
1
+ import { ConfigChain } from 'config-chain';
2
+ export declare class Conf extends ConfigChain {
3
+ _await: any;
4
+ addString: any;
5
+ del: any;
6
+ get: any;
7
+ set: any;
8
+ globalPrefix: string;
9
+ localPrefix: string;
10
+ root: any;
11
+ sources: any;
12
+ push: any;
13
+ list: any;
14
+ constructor(base: any);
15
+ add(data: any, marker: any): any;
16
+ addFile(file: string, name?: string): this;
17
+ addEnv(env?: {
18
+ [key: string]: string | undefined;
19
+ }): any;
20
+ loadPrefix(): any;
21
+ loadCAFile(file: string): void;
22
+ loadUser(): void;
23
+ getCredentialsByURI(uri: string): any;
24
+ setCredentialsByURI(uri: any, c: any): void;
25
+ }