@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,199 +1,199 @@
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.Project = void 0;
7
- const cosmiconfig_1 = require("cosmiconfig");
8
- const dedent_1 = __importDefault(require("dedent"));
9
- const globby_1 = __importDefault(require("globby"));
10
- const glob_parent_1 = __importDefault(require("glob-parent"));
11
- const npmlog_1 = __importDefault(require("npmlog"));
12
- const path_1 = __importDefault(require("path"));
13
- const p_map_1 = __importDefault(require("p-map"));
14
- const load_json_file_1 = __importDefault(require("load-json-file"));
15
- const write_json_file_1 = __importDefault(require("write-json-file"));
16
- const package_1 = require("../package");
17
- const apply_extends_1 = require("./lib/apply-extends");
18
- const validation_error_1 = require("../validation-error");
19
- const make_file_finder_1 = require("./lib/make-file-finder");
20
- /**
21
- * A representation of the entire project managed by Lerna.
22
- *
23
- * Wherever the lerna.json file is located, that is the project root.
24
- * All package globs are rooted from this location.
25
- */
26
- class Project {
27
- /**
28
- * @param {string} [cwd] Defaults to process.cwd()
29
- */
30
- constructor(cwd) {
31
- var _a, _b;
32
- const explorer = (0, cosmiconfig_1.cosmiconfigSync)('lerna', {
33
- searchPlaces: ['lerna.json', 'package.json'],
34
- transform(obj) {
35
- // cosmiconfig returns null when nothing is found
36
- if (!obj) {
37
- return {
38
- // No need to distinguish between missing and empty,
39
- // saves a lot of noisy guards elsewhere
40
- config: {},
41
- // path.resolve(".", ...) starts from process.cwd()
42
- filepath: path_1.default.resolve(cwd || '.', 'lerna.json'),
43
- };
44
- }
45
- obj.config = (0, apply_extends_1.applyExtends)(obj.config, path_1.default.dirname(obj.filepath));
46
- return obj;
47
- },
48
- });
49
- let loaded;
50
- try {
51
- loaded = explorer.search(cwd);
52
- }
53
- catch (err) {
54
- // redecorate JSON syntax errors, avoid debug dump
55
- if (err.name === 'JSONError') {
56
- throw new validation_error_1.ValidationError(err.name, err.message);
57
- }
58
- // re-throw other errors, could be ours or third-party
59
- throw err;
60
- }
61
- this.config = loaded === null || loaded === void 0 ? void 0 : loaded.config;
62
- this.rootConfigLocation = (_a = loaded === null || loaded === void 0 ? void 0 : loaded.filepath) !== null && _a !== void 0 ? _a : '';
63
- this.rootPath = path_1.default.dirname((_b = loaded === null || loaded === void 0 ? void 0 : loaded.filepath) !== null && _b !== void 0 ? _b : '');
64
- npmlog_1.default.verbose('rootPath', this.rootPath);
65
- }
66
- /**
67
- * @param {string} [cwd] Defaults to process.cwd()
68
- */
69
- static getPackages(cwd) {
70
- return new Project(cwd).getPackages();
71
- }
72
- /**
73
- * @param {string} [cwd] Defaults to process.cwd()
74
- */
75
- static getPackagesSync(cwd) {
76
- return new Project(cwd).getPackagesSync();
77
- }
78
- get version() {
79
- return this.config.version;
80
- }
81
- set version(val) {
82
- this.config.version = val;
83
- }
84
- get packageConfigs() {
85
- var _a;
86
- if (this.config.useWorkspaces) {
87
- const workspaces = (_a = this.manifest) === null || _a === void 0 ? void 0 : _a.get('workspaces');
88
- if (!workspaces) {
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.Project = void 0;
7
+ const cosmiconfig_1 = require("cosmiconfig");
8
+ const dedent_1 = __importDefault(require("dedent"));
9
+ const globby_1 = __importDefault(require("globby"));
10
+ const glob_parent_1 = __importDefault(require("glob-parent"));
11
+ const npmlog_1 = __importDefault(require("npmlog"));
12
+ const path_1 = __importDefault(require("path"));
13
+ const p_map_1 = __importDefault(require("p-map"));
14
+ const load_json_file_1 = __importDefault(require("load-json-file"));
15
+ const write_json_file_1 = __importDefault(require("write-json-file"));
16
+ const package_1 = require("../package");
17
+ const apply_extends_1 = require("./lib/apply-extends");
18
+ const validation_error_1 = require("../validation-error");
19
+ const make_file_finder_1 = require("./lib/make-file-finder");
20
+ /**
21
+ * A representation of the entire project managed by Lerna.
22
+ *
23
+ * Wherever the lerna.json file is located, that is the project root.
24
+ * All package globs are rooted from this location.
25
+ */
26
+ class Project {
27
+ /**
28
+ * @param {string} [cwd] Defaults to process.cwd()
29
+ */
30
+ constructor(cwd) {
31
+ var _a, _b;
32
+ const explorer = (0, cosmiconfig_1.cosmiconfigSync)('lerna', {
33
+ searchPlaces: ['lerna.json', 'package.json'],
34
+ transform(obj) {
35
+ // cosmiconfig returns null when nothing is found
36
+ if (!obj) {
37
+ return {
38
+ // No need to distinguish between missing and empty,
39
+ // saves a lot of noisy guards elsewhere
40
+ config: {},
41
+ // path.resolve(".", ...) starts from process.cwd()
42
+ filepath: path_1.default.resolve(cwd || '.', 'lerna.json'),
43
+ };
44
+ }
45
+ obj.config = (0, apply_extends_1.applyExtends)(obj.config, path_1.default.dirname(obj.filepath));
46
+ return obj;
47
+ },
48
+ });
49
+ let loaded;
50
+ try {
51
+ loaded = explorer.search(cwd);
52
+ }
53
+ catch (err) {
54
+ // redecorate JSON syntax errors, avoid debug dump
55
+ if (err.name === 'JSONError') {
56
+ throw new validation_error_1.ValidationError(err.name, err.message);
57
+ }
58
+ // re-throw other errors, could be ours or third-party
59
+ throw err;
60
+ }
61
+ this.config = loaded === null || loaded === void 0 ? void 0 : loaded.config;
62
+ this.rootConfigLocation = (_a = loaded === null || loaded === void 0 ? void 0 : loaded.filepath) !== null && _a !== void 0 ? _a : '';
63
+ this.rootPath = path_1.default.dirname((_b = loaded === null || loaded === void 0 ? void 0 : loaded.filepath) !== null && _b !== void 0 ? _b : '');
64
+ npmlog_1.default.verbose('rootPath', this.rootPath);
65
+ }
66
+ /**
67
+ * @param {string} [cwd] Defaults to process.cwd()
68
+ */
69
+ static getPackages(cwd) {
70
+ return new Project(cwd).getPackages();
71
+ }
72
+ /**
73
+ * @param {string} [cwd] Defaults to process.cwd()
74
+ */
75
+ static getPackagesSync(cwd) {
76
+ return new Project(cwd).getPackagesSync();
77
+ }
78
+ get version() {
79
+ return this.config.version;
80
+ }
81
+ set version(val) {
82
+ this.config.version = val;
83
+ }
84
+ get packageConfigs() {
85
+ var _a;
86
+ if (this.config.useWorkspaces) {
87
+ const workspaces = (_a = this.manifest) === null || _a === void 0 ? void 0 : _a.get('workspaces');
88
+ if (!workspaces) {
89
89
  throw new validation_error_1.ValidationError('EWORKSPACES', (0, dedent_1.default) `
90
90
  Yarn workspaces need to be defined in the root package.json.
91
91
  See: https://github.com/lerna/lerna/blob/master/commands/bootstrap/README.md#--use-workspaces
92
- `);
93
- }
94
- const workspaceList = (workspaces.packages || workspaces);
95
- npmlog_1.default.verbose('project workspaces packages', workspaceList.join(' '));
96
- return workspaceList;
97
- }
98
- npmlog_1.default.verbose('project packages', (this.config.packages || [Project.PACKAGE_GLOB]).join(' '));
99
- return this.config.packages || [Project.PACKAGE_GLOB];
100
- }
101
- get packageParentDirs() {
102
- return this.packageConfigs.map(glob_parent_1.default).map((parentDir) => path_1.default.resolve(this.rootPath, parentDir));
103
- }
104
- get manifest() {
105
- let manifest;
106
- try {
107
- const manifestLocation = path_1.default.join(this.rootPath, 'package.json');
108
- const packageJson = load_json_file_1.default.sync(manifestLocation);
109
- if (!packageJson.name) {
110
- // npm-lifecycle chokes if this is missing, so default like npm init does
111
- packageJson.name = path_1.default.basename(path_1.default.dirname(manifestLocation));
112
- }
113
- // Encapsulate raw JSON in Package instance
114
- manifest = new package_1.Package(packageJson, this.rootPath);
115
- // redefine getter to lazy-loaded value
116
- Object.defineProperty(this, 'manifest', {
117
- value: manifest,
118
- });
119
- }
120
- catch (err) {
121
- // redecorate JSON syntax errors, avoid debug dump
122
- if (err.name === 'JSONError') {
123
- throw new validation_error_1.ValidationError(err.name, err.message);
124
- }
125
- // try again next time
126
- }
127
- return manifest;
128
- }
129
- get licensePath() {
130
- let licensePath;
131
- try {
132
- const search = globby_1.default.sync(Project.LICENSE_GLOB, {
133
- cwd: this.rootPath,
134
- absolute: true,
135
- caseSensitiveMatch: false,
136
- // Project license is always a sibling of the root manifest
137
- deep: 0,
138
- });
139
- licensePath = search.shift();
140
- if (licensePath) {
141
- // POSIX results always need to be normalized
142
- licensePath = path_1.default.normalize(licensePath);
143
- // redefine getter to lazy-loaded value
144
- Object.defineProperty(this, 'licensePath', {
145
- value: licensePath,
146
- });
147
- }
148
- }
149
- catch (err) {
150
- /* istanbul ignore next */
151
- throw new validation_error_1.ValidationError(err.name, err.message);
152
- }
153
- return licensePath;
154
- }
155
- get fileFinder() {
156
- const finder = (0, make_file_finder_1.makeFileFinder)(this.rootPath, this.packageConfigs);
157
- // redefine getter to lazy-loaded value
158
- Object.defineProperty(this, 'fileFinder', {
159
- value: finder,
160
- });
161
- return finder;
162
- }
163
- /**
164
- * @returns {Promise<Package[]>} A promise resolving to a list of Package instances
165
- */
166
- getPackages() {
167
- const mapper = (packageConfigPath) => {
168
- var _a;
169
- return (_a = (0, load_json_file_1.default)(packageConfigPath)) === null || _a === void 0 ? void 0 : _a.then((packageJson) => new package_1.Package(packageJson, path_1.default.dirname(packageConfigPath), this.rootPath));
170
- };
171
- return this.fileFinder('package.json', (filePaths) => (0, p_map_1.default)(filePaths, mapper, { concurrency: 50 }));
172
- }
173
- /**
174
- * @returns {Package[]} A list of Package instances
175
- */
176
- getPackagesSync() {
177
- return (0, make_file_finder_1.makeSyncFileFinder)(this.rootPath, this.packageConfigs)('package.json', (packageConfigPath) => {
178
- return new package_1.Package(load_json_file_1.default.sync(packageConfigPath), path_1.default.dirname(packageConfigPath), this.rootPath);
179
- });
180
- }
181
- getPackageLicensePaths() {
182
- return this.fileFinder(Project.LICENSE_GLOB, null, { caseSensitiveMatch: false });
183
- }
184
- isIndependent() {
185
- return this.version === 'independent';
186
- }
187
- serializeConfig() {
188
- // TODO: might be package.json prop
189
- return (0, write_json_file_1.default)(this.rootConfigLocation, this.config, { indent: 2, detectIndent: true }).then(() => this.rootConfigLocation);
190
- }
191
- }
192
- exports.Project = Project;
193
- Project.PACKAGE_GLOB = 'packages/*';
194
- Project.LICENSE_GLOB = 'LICEN{S,C}E{,.*}';
195
- Project.PACKAGE_GLOB = 'packages/*';
196
- Project.LICENSE_GLOB = 'LICEN{S,C}E{,.*}';
197
- module.exports.getPackages = Project.getPackages;
198
- module.exports.getPackagesSync = Project.getPackagesSync;
92
+ `);
93
+ }
94
+ const workspaceList = (workspaces.packages || workspaces);
95
+ npmlog_1.default.verbose('project workspaces packages', workspaceList.join(' '));
96
+ return workspaceList;
97
+ }
98
+ npmlog_1.default.verbose('project packages', (this.config.packages || [Project.PACKAGE_GLOB]).join(' '));
99
+ return this.config.packages || [Project.PACKAGE_GLOB];
100
+ }
101
+ get packageParentDirs() {
102
+ return this.packageConfigs.map(glob_parent_1.default).map((parentDir) => path_1.default.resolve(this.rootPath, parentDir));
103
+ }
104
+ get manifest() {
105
+ let manifest;
106
+ try {
107
+ const manifestLocation = path_1.default.join(this.rootPath, 'package.json');
108
+ const packageJson = load_json_file_1.default.sync(manifestLocation);
109
+ if (!packageJson.name) {
110
+ // npm-lifecycle chokes if this is missing, so default like npm init does
111
+ packageJson.name = path_1.default.basename(path_1.default.dirname(manifestLocation));
112
+ }
113
+ // Encapsulate raw JSON in Package instance
114
+ manifest = new package_1.Package(packageJson, this.rootPath);
115
+ // redefine getter to lazy-loaded value
116
+ Object.defineProperty(this, 'manifest', {
117
+ value: manifest,
118
+ });
119
+ }
120
+ catch (err) {
121
+ // redecorate JSON syntax errors, avoid debug dump
122
+ if (err.name === 'JSONError') {
123
+ throw new validation_error_1.ValidationError(err.name, err.message);
124
+ }
125
+ // try again next time
126
+ }
127
+ return manifest;
128
+ }
129
+ get licensePath() {
130
+ let licensePath;
131
+ try {
132
+ const search = globby_1.default.sync(Project.LICENSE_GLOB, {
133
+ cwd: this.rootPath,
134
+ absolute: true,
135
+ caseSensitiveMatch: false,
136
+ // Project license is always a sibling of the root manifest
137
+ deep: 0,
138
+ });
139
+ licensePath = search.shift();
140
+ if (licensePath) {
141
+ // POSIX results always need to be normalized
142
+ licensePath = path_1.default.normalize(licensePath);
143
+ // redefine getter to lazy-loaded value
144
+ Object.defineProperty(this, 'licensePath', {
145
+ value: licensePath,
146
+ });
147
+ }
148
+ }
149
+ catch (err) {
150
+ /* istanbul ignore next */
151
+ throw new validation_error_1.ValidationError(err.name, err.message);
152
+ }
153
+ return licensePath;
154
+ }
155
+ get fileFinder() {
156
+ const finder = (0, make_file_finder_1.makeFileFinder)(this.rootPath, this.packageConfigs);
157
+ // redefine getter to lazy-loaded value
158
+ Object.defineProperty(this, 'fileFinder', {
159
+ value: finder,
160
+ });
161
+ return finder;
162
+ }
163
+ /**
164
+ * @returns {Promise<Package[]>} A promise resolving to a list of Package instances
165
+ */
166
+ getPackages() {
167
+ const mapper = (packageConfigPath) => {
168
+ var _a;
169
+ return (_a = (0, load_json_file_1.default)(packageConfigPath)) === null || _a === void 0 ? void 0 : _a.then((packageJson) => new package_1.Package(packageJson, path_1.default.dirname(packageConfigPath), this.rootPath));
170
+ };
171
+ return this.fileFinder('package.json', (filePaths) => (0, p_map_1.default)(filePaths, mapper, { concurrency: 50 }));
172
+ }
173
+ /**
174
+ * @returns {Package[]} A list of Package instances
175
+ */
176
+ getPackagesSync() {
177
+ return (0, make_file_finder_1.makeSyncFileFinder)(this.rootPath, this.packageConfigs)('package.json', (packageConfigPath) => {
178
+ return new package_1.Package(load_json_file_1.default.sync(packageConfigPath), path_1.default.dirname(packageConfigPath), this.rootPath);
179
+ });
180
+ }
181
+ getPackageLicensePaths() {
182
+ return this.fileFinder(Project.LICENSE_GLOB, null, { caseSensitiveMatch: false });
183
+ }
184
+ isIndependent() {
185
+ return this.version === 'independent';
186
+ }
187
+ serializeConfig() {
188
+ // TODO: might be package.json prop
189
+ return (0, write_json_file_1.default)(this.rootConfigLocation, this.config, { indent: 2, detectIndent: true }).then(() => this.rootConfigLocation);
190
+ }
191
+ }
192
+ exports.Project = Project;
193
+ Project.PACKAGE_GLOB = 'packages/*';
194
+ Project.LICENSE_GLOB = 'LICEN{S,C}E{,.*}';
195
+ Project.PACKAGE_GLOB = 'packages/*';
196
+ Project.LICENSE_GLOB = 'LICEN{S,C}E{,.*}';
197
+ module.exports.getPackages = Project.getPackages;
198
+ module.exports.getPackagesSync = Project.getPackagesSync;
199
199
  //# sourceMappingURL=project.js.map
package/dist/prompt.d.ts CHANGED
@@ -1,23 +1,23 @@
1
- import inquirer, { ListChoiceOptions } from 'inquirer';
2
- /**
3
- * Prompt for confirmation
4
- * @param {string} message
5
- * @returns {Promise<boolean>}
6
- */
7
- export declare function promptConfirmation(message: string): Promise<boolean>;
8
- /**
9
- * Prompt for selection
10
- * @param {string} message
11
- * @param {{ choices: import("inquirer").ListChoiceOptions[] } & Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
12
- * @returns {Promise<string>}
13
- */
14
- export declare function promptSelectOne(message: string, { choices, filter, validate }?: {
15
- choices: ListChoiceOptions[];
16
- } & Pick<inquirer.Question<inquirer.Answers>, "filter" | "validate">): Promise<string>;
17
- /**
18
- * Prompt for input
19
- * @param {string} message
20
- * @param {Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
21
- * @returns {Promise<string>}
22
- */
23
- export declare function promptTextInput(message: string, { filter, validate }?: Pick<inquirer.Question<inquirer.Answers>, "filter" | "validate">): Promise<string>;
1
+ import inquirer, { ListChoiceOptions } from 'inquirer';
2
+ /**
3
+ * Prompt for confirmation
4
+ * @param {string} message
5
+ * @returns {Promise<boolean>}
6
+ */
7
+ export declare function promptConfirmation(message: string): Promise<boolean>;
8
+ /**
9
+ * Prompt for selection
10
+ * @param {string} message
11
+ * @param {{ choices: import("inquirer").ListChoiceOptions[] } & Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
12
+ * @returns {Promise<string>}
13
+ */
14
+ export declare function promptSelectOne(message: string, { choices, filter, validate }?: {
15
+ choices: ListChoiceOptions[];
16
+ } & Pick<inquirer.Question<inquirer.Answers>, "filter" | "validate">): Promise<string>;
17
+ /**
18
+ * Prompt for input
19
+ * @param {string} message
20
+ * @param {Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
21
+ * @returns {Promise<string>}
22
+ */
23
+ export declare function promptTextInput(message: string, { filter, validate }?: Pick<inquirer.Question<inquirer.Answers>, "filter" | "validate">): Promise<string>;
package/dist/prompt.js CHANGED
@@ -1,76 +1,76 @@
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.promptTextInput = exports.promptSelectOne = exports.promptConfirmation = void 0;
7
- const inquirer_1 = __importDefault(require("inquirer"));
8
- const npmlog_1 = __importDefault(require("npmlog"));
9
- /**
10
- * Prompt for confirmation
11
- * @param {string} message
12
- * @returns {Promise<boolean>}
13
- */
14
- async function promptConfirmation(message) {
15
- npmlog_1.default.pause();
16
- const answers = await inquirer_1.default.prompt([
17
- {
18
- type: 'expand',
19
- name: 'confirm',
20
- message,
21
- default: 2,
22
- choices: [
23
- { key: 'y', name: 'Yes', value: true },
24
- { key: 'n', name: 'No', value: false },
25
- ],
26
- },
27
- ]);
28
- npmlog_1.default.resume();
29
- return answers.confirm;
30
- }
31
- exports.promptConfirmation = promptConfirmation;
32
- /**
33
- * Prompt for selection
34
- * @param {string} message
35
- * @param {{ choices: import("inquirer").ListChoiceOptions[] } & Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
36
- * @returns {Promise<string>}
37
- */
38
- async function promptSelectOne(message, { choices, filter, validate } = {}) {
39
- npmlog_1.default.pause();
40
- const answers = await inquirer_1.default.prompt([
41
- {
42
- type: 'list',
43
- name: 'prompt',
44
- message,
45
- choices,
46
- pageSize: choices.length,
47
- filter,
48
- validate,
49
- },
50
- ]);
51
- npmlog_1.default.resume();
52
- return answers.prompt;
53
- }
54
- exports.promptSelectOne = promptSelectOne;
55
- /**
56
- * Prompt for input
57
- * @param {string} message
58
- * @param {Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
59
- * @returns {Promise<string>}
60
- */
61
- async function promptTextInput(message, { filter, validate } = {}) {
62
- npmlog_1.default.pause();
63
- const answers = await inquirer_1.default.prompt([
64
- {
65
- type: 'input',
66
- name: 'input',
67
- message,
68
- filter,
69
- validate,
70
- },
71
- ]);
72
- npmlog_1.default.resume();
73
- return answers.input;
74
- }
75
- exports.promptTextInput = promptTextInput;
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.promptTextInput = exports.promptSelectOne = exports.promptConfirmation = void 0;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const npmlog_1 = __importDefault(require("npmlog"));
9
+ /**
10
+ * Prompt for confirmation
11
+ * @param {string} message
12
+ * @returns {Promise<boolean>}
13
+ */
14
+ async function promptConfirmation(message) {
15
+ npmlog_1.default.pause();
16
+ const answers = await inquirer_1.default.prompt([
17
+ {
18
+ type: 'expand',
19
+ name: 'confirm',
20
+ message,
21
+ default: 2,
22
+ choices: [
23
+ { key: 'y', name: 'Yes', value: true },
24
+ { key: 'n', name: 'No', value: false },
25
+ ],
26
+ },
27
+ ]);
28
+ npmlog_1.default.resume();
29
+ return answers.confirm;
30
+ }
31
+ exports.promptConfirmation = promptConfirmation;
32
+ /**
33
+ * Prompt for selection
34
+ * @param {string} message
35
+ * @param {{ choices: import("inquirer").ListChoiceOptions[] } & Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
36
+ * @returns {Promise<string>}
37
+ */
38
+ async function promptSelectOne(message, { choices, filter, validate } = {}) {
39
+ npmlog_1.default.pause();
40
+ const answers = await inquirer_1.default.prompt([
41
+ {
42
+ type: 'list',
43
+ name: 'prompt',
44
+ message,
45
+ choices,
46
+ pageSize: choices.length,
47
+ filter,
48
+ validate,
49
+ },
50
+ ]);
51
+ npmlog_1.default.resume();
52
+ return answers.prompt;
53
+ }
54
+ exports.promptSelectOne = promptSelectOne;
55
+ /**
56
+ * Prompt for input
57
+ * @param {string} message
58
+ * @param {Pick<import("inquirer").Question, 'filter' | 'validate'>} [options]
59
+ * @returns {Promise<string>}
60
+ */
61
+ async function promptTextInput(message, { filter, validate } = {}) {
62
+ npmlog_1.default.pause();
63
+ const answers = await inquirer_1.default.prompt([
64
+ {
65
+ type: 'input',
66
+ name: 'input',
67
+ message,
68
+ filter,
69
+ validate,
70
+ },
71
+ ]);
72
+ npmlog_1.default.resume();
73
+ return answers.input;
74
+ }
75
+ exports.promptTextInput = promptTextInput;
76
76
  //# sourceMappingURL=prompt.js.map
@@ -1,8 +1,8 @@
1
- export declare function checkWorkingTree({ cwd }?: any, gitDryRun?: boolean): Promise<any>;
2
- export declare function throwIfReleased({ refCount }: {
3
- refCount: any;
4
- }): void;
5
- export declare function mkThrowIfUncommitted(options?: any, gitDryRun?: boolean): ({ isDirty }: {
6
- isDirty: any;
7
- }) => Promise<never> | undefined;
8
- export declare function throwIfUncommitted(): void;
1
+ export declare function checkWorkingTree({ cwd }?: any, gitDryRun?: boolean): Promise<any>;
2
+ export declare function throwIfReleased({ refCount }: {
3
+ refCount: any;
4
+ }): void;
5
+ export declare function mkThrowIfUncommitted(options?: any, gitDryRun?: boolean): ({ isDirty }: {
6
+ isDirty: any;
7
+ }) => Promise<never> | undefined;
8
+ export declare function throwIfUncommitted(): void;