@teambit/install 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exceptions/dependency-type-not-supported-in-policy.js +0 -6
- package/dist/exceptions/dependency-type-not-supported-in-policy.js.map +1 -1
- package/dist/exceptions/index.js +0 -3
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/install.aspect.js +0 -5
- package/dist/install.aspect.js.map +1 -1
- package/dist/install.cmd.js +0 -17
- package/dist/install.cmd.js.map +1 -1
- package/dist/install.main.runtime.js +11 -142
- package/dist/install.main.runtime.js.map +1 -1
- package/dist/link/component-list-links.js +0 -18
- package/dist/link/component-list-links.js.map +1 -1
- package/dist/link/core-aspects-links.js +0 -18
- package/dist/link/core-aspects-links.js.map +1 -1
- package/dist/link/get-package-name-from-target.js +0 -2
- package/dist/link/get-package-name-from-target.js.map +1 -1
- package/dist/link/index.js +0 -3
- package/dist/link/index.js.map +1 -1
- package/dist/link/link-row.js +0 -6
- package/dist/link/link-row.js.map +1 -1
- package/dist/link/link-to-dir.js +0 -10
- package/dist/link/link-to-dir.js.map +1 -1
- package/dist/link/link.cmd.js +2 -36
- package/dist/link/link.cmd.js.map +1 -1
- package/dist/link/nested-deps-in-nm-links.js +0 -15
- package/dist/link/nested-deps-in-nm-links.js.map +1 -1
- package/dist/link/rewire-row.js +0 -5
- package/dist/link/rewire-row.js.map +1 -1
- package/dist/pick-outdated-pkgs.js +3 -64
- package/dist/pick-outdated-pkgs.js.map +1 -1
- package/dist/pick-outdated-pkgs.spec.js +10 -13
- package/dist/pick-outdated-pkgs.spec.js.map +1 -1
- package/dist/uninstall.cmd.js +0 -10
- package/dist/uninstall.cmd.js.map +1 -1
- package/dist/update.cmd.js +0 -9
- package/dist/update.cmd.js.map +1 -1
- package/package-tar/teambit-install-0.0.29.tgz +0 -0
- package/package.json +3 -3
- /package/{preview-1666409808293.js → preview-1666496165706.js} +0 -0
- package/package-tar/teambit-install-0.0.28.tgz +0 -0
@@ -1,260 +1,182 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
6
|
-
|
7
5
|
require("core-js/modules/es.promise.js");
|
8
|
-
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
10
7
|
value: true
|
11
8
|
});
|
12
9
|
exports.default = exports.InstallMain = void 0;
|
13
|
-
|
14
10
|
function _defineProperty2() {
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
16
|
-
|
17
12
|
_defineProperty2 = function () {
|
18
13
|
return data;
|
19
14
|
};
|
20
|
-
|
21
15
|
return data;
|
22
16
|
}
|
23
|
-
|
24
17
|
function _community() {
|
25
18
|
const data = require("@teambit/community");
|
26
|
-
|
27
19
|
_community = function () {
|
28
20
|
return data;
|
29
21
|
};
|
30
|
-
|
31
22
|
return data;
|
32
23
|
}
|
33
|
-
|
34
24
|
function _compiler() {
|
35
25
|
const data = require("@teambit/compiler");
|
36
|
-
|
37
26
|
_compiler = function () {
|
38
27
|
return data;
|
39
28
|
};
|
40
|
-
|
41
29
|
return data;
|
42
30
|
}
|
43
|
-
|
44
31
|
function _manyComponentsWriter() {
|
45
32
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/many-components-writer"));
|
46
|
-
|
47
33
|
_manyComponentsWriter = function () {
|
48
34
|
return data;
|
49
35
|
};
|
50
|
-
|
51
36
|
return data;
|
52
37
|
}
|
53
|
-
|
54
38
|
function _cli() {
|
55
39
|
const data = require("@teambit/cli");
|
56
|
-
|
57
40
|
_cli = function () {
|
58
41
|
return data;
|
59
42
|
};
|
60
|
-
|
61
43
|
return data;
|
62
44
|
}
|
63
|
-
|
64
45
|
function _chalk() {
|
65
46
|
const data = _interopRequireDefault(require("chalk"));
|
66
|
-
|
67
47
|
_chalk = function () {
|
68
48
|
return data;
|
69
49
|
};
|
70
|
-
|
71
50
|
return data;
|
72
51
|
}
|
73
|
-
|
74
52
|
function _workspace() {
|
75
53
|
const data = require("@teambit/workspace");
|
76
|
-
|
77
54
|
_workspace = function () {
|
78
55
|
return data;
|
79
56
|
};
|
80
|
-
|
81
57
|
return data;
|
82
58
|
}
|
83
|
-
|
84
59
|
function _lodash() {
|
85
60
|
const data = require("lodash");
|
86
|
-
|
87
61
|
_lodash = function () {
|
88
62
|
return data;
|
89
63
|
};
|
90
|
-
|
91
64
|
return data;
|
92
65
|
}
|
93
|
-
|
94
66
|
function _exceptions() {
|
95
67
|
const data = require("@teambit/legacy/dist/consumer/exceptions");
|
96
|
-
|
97
68
|
_exceptions = function () {
|
98
69
|
return data;
|
99
70
|
};
|
100
|
-
|
101
71
|
return data;
|
102
72
|
}
|
103
|
-
|
104
73
|
function _componentIdToPackageName() {
|
105
74
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/bit/component-id-to-package-name"));
|
106
|
-
|
107
75
|
_componentIdToPackageName = function () {
|
108
76
|
return data;
|
109
77
|
};
|
110
|
-
|
111
78
|
return data;
|
112
79
|
}
|
113
|
-
|
114
80
|
function _variants() {
|
115
81
|
const data = require("@teambit/variants");
|
116
|
-
|
117
82
|
_variants = function () {
|
118
83
|
return data;
|
119
84
|
};
|
120
|
-
|
121
85
|
return data;
|
122
86
|
}
|
123
|
-
|
124
87
|
function _component() {
|
125
88
|
const data = require("@teambit/component");
|
126
|
-
|
127
89
|
_component = function () {
|
128
90
|
return data;
|
129
91
|
};
|
130
|
-
|
131
92
|
return data;
|
132
93
|
}
|
133
|
-
|
134
94
|
function _componentIssues() {
|
135
95
|
const data = require("@teambit/component-issues");
|
136
|
-
|
137
96
|
_componentIssues = function () {
|
138
97
|
return data;
|
139
98
|
};
|
140
|
-
|
141
99
|
return data;
|
142
100
|
}
|
143
|
-
|
144
101
|
function _dependencyResolver() {
|
145
102
|
const data = require("@teambit/dependency-resolver");
|
146
|
-
|
147
103
|
_dependencyResolver = function () {
|
148
104
|
return data;
|
149
105
|
};
|
150
|
-
|
151
106
|
return data;
|
152
107
|
}
|
153
|
-
|
154
108
|
function _importer() {
|
155
109
|
const data = require("@teambit/importer");
|
156
|
-
|
157
110
|
_importer = function () {
|
158
111
|
return data;
|
159
112
|
};
|
160
|
-
|
161
113
|
return data;
|
162
114
|
}
|
163
|
-
|
164
115
|
function _logger() {
|
165
116
|
const data = require("@teambit/logger");
|
166
|
-
|
167
117
|
_logger = function () {
|
168
118
|
return data;
|
169
119
|
};
|
170
|
-
|
171
120
|
return data;
|
172
121
|
}
|
173
|
-
|
174
122
|
function _issues() {
|
175
123
|
const data = require("@teambit/issues");
|
176
|
-
|
177
124
|
_issues = function () {
|
178
125
|
return data;
|
179
126
|
};
|
180
|
-
|
181
127
|
return data;
|
182
128
|
}
|
183
|
-
|
184
129
|
function _exceptions2() {
|
185
130
|
const data = require("./exceptions");
|
186
|
-
|
187
131
|
_exceptions2 = function () {
|
188
132
|
return data;
|
189
133
|
};
|
190
|
-
|
191
134
|
return data;
|
192
135
|
}
|
193
|
-
|
194
136
|
function _install() {
|
195
137
|
const data = require("./install.aspect");
|
196
|
-
|
197
138
|
_install = function () {
|
198
139
|
return data;
|
199
140
|
};
|
200
|
-
|
201
141
|
return data;
|
202
142
|
}
|
203
|
-
|
204
143
|
function _pickOutdatedPkgs() {
|
205
144
|
const data = require("./pick-outdated-pkgs");
|
206
|
-
|
207
145
|
_pickOutdatedPkgs = function () {
|
208
146
|
return data;
|
209
147
|
};
|
210
|
-
|
211
148
|
return data;
|
212
149
|
}
|
213
|
-
|
214
150
|
function _link() {
|
215
151
|
const data = require("./link");
|
216
|
-
|
217
152
|
_link = function () {
|
218
153
|
return data;
|
219
154
|
};
|
220
|
-
|
221
155
|
return data;
|
222
156
|
}
|
223
|
-
|
224
157
|
function _install2() {
|
225
158
|
const data = _interopRequireDefault(require("./install.cmd"));
|
226
|
-
|
227
159
|
_install2 = function () {
|
228
160
|
return data;
|
229
161
|
};
|
230
|
-
|
231
162
|
return data;
|
232
163
|
}
|
233
|
-
|
234
164
|
function _uninstall() {
|
235
165
|
const data = _interopRequireDefault(require("./uninstall.cmd"));
|
236
|
-
|
237
166
|
_uninstall = function () {
|
238
167
|
return data;
|
239
168
|
};
|
240
|
-
|
241
169
|
return data;
|
242
170
|
}
|
243
|
-
|
244
171
|
function _update() {
|
245
172
|
const data = _interopRequireDefault(require("./update.cmd"));
|
246
|
-
|
247
173
|
_update = function () {
|
248
174
|
return data;
|
249
175
|
};
|
250
|
-
|
251
176
|
return data;
|
252
177
|
}
|
253
|
-
|
254
178
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
255
|
-
|
256
179
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
257
|
-
|
258
180
|
class InstallMain {
|
259
181
|
constructor(dependencyResolver, logger, workspace, variants, importer, compiler) {
|
260
182
|
this.dependencyResolver = dependencyResolver;
|
@@ -270,16 +192,12 @@ class InstallMain {
|
|
270
192
|
* @returns
|
271
193
|
* @memberof Workspace
|
272
194
|
*/
|
273
|
-
|
274
|
-
|
275
195
|
async install(packages, options) {
|
276
196
|
if (packages && packages.length) {
|
277
197
|
await this._addPackages(packages, options);
|
278
198
|
}
|
279
|
-
|
280
199
|
if (options !== null && options !== void 0 && options.addMissingPeers) {
|
281
200
|
var _options$copyPeerToRu, _options$copyPeerToRu2;
|
282
|
-
|
283
201
|
const compDirMap = await this.getComponentsDirectory([]);
|
284
202
|
const mergedRootPolicy = this.dependencyResolver.getWorkspacePolicy();
|
285
203
|
const depsFilterFn = await this.generateFilterFnForDepsFromLocalRemote();
|
@@ -292,7 +210,6 @@ class InstallMain {
|
|
292
210
|
packageImportMethod: this.dependencyResolver.config.packageImportMethod
|
293
211
|
};
|
294
212
|
const missingPeers = await this.dependencyResolver.getMissingPeerDependencies(this.workspace.path, mergedRootPolicy, compDirMap, pmInstallOptions);
|
295
|
-
|
296
213
|
if (missingPeers) {
|
297
214
|
const missingPeerPackages = Object.entries(missingPeers).map(([peerName, range]) => `${peerName}@${range}`);
|
298
215
|
await this._addPackages(missingPeerPackages, options);
|
@@ -300,21 +217,17 @@ class InstallMain {
|
|
300
217
|
this.logger.console('No missing peer dependencies found.');
|
301
218
|
}
|
302
219
|
}
|
303
|
-
|
304
220
|
if (options !== null && options !== void 0 && options.import) {
|
305
221
|
this.logger.setStatusLine('importing missing objects');
|
306
222
|
await this.importObjects();
|
307
223
|
this.logger.consoleSuccess();
|
308
224
|
}
|
309
|
-
|
310
225
|
return this._installModules(options);
|
311
226
|
}
|
312
|
-
|
313
227
|
async _addPackages(packages, options) {
|
314
228
|
if (!(options !== null && options !== void 0 && options.variants) && (options === null || options === void 0 ? void 0 : options.lifecycleType) === 'dev') {
|
315
229
|
throw new (_exceptions2().DependencyTypeNotSupportedInPolicy)(options === null || options === void 0 ? void 0 : options.lifecycleType);
|
316
230
|
}
|
317
|
-
|
318
231
|
this.logger.debug(`installing the following packages: ${packages.join()}`);
|
319
232
|
const resolver = await this.dependencyResolver.getVersionResolver();
|
320
233
|
const resolvedPackagesP = packages.map(packageName => resolver.resolveRemoteVersion(packageName, {
|
@@ -334,22 +247,18 @@ class InstallMain {
|
|
334
247
|
});
|
335
248
|
}
|
336
249
|
});
|
337
|
-
|
338
250
|
if (!(options !== null && options !== void 0 && options.variants)) {
|
339
251
|
var _options$updateExisti;
|
340
|
-
|
341
252
|
this.dependencyResolver.addToRootPolicy(newWorkspacePolicyEntries, {
|
342
253
|
updateExisting: (_options$updateExisti = options === null || options === void 0 ? void 0 : options.updateExisting) !== null && _options$updateExisti !== void 0 ? _options$updateExisti : false
|
343
254
|
});
|
344
|
-
} else {
|
255
|
+
} else {
|
256
|
+
// TODO: implement
|
345
257
|
}
|
346
|
-
|
347
258
|
await this.dependencyResolver.persistConfig(this.workspace.path);
|
348
259
|
}
|
349
|
-
|
350
260
|
async _installModules(options) {
|
351
261
|
var _options$copyPeerToRu3, _options$copyPeerToRu4;
|
352
|
-
|
353
262
|
this.logger.console(`installing dependencies in workspace using ${_chalk().default.cyan(this.dependencyResolver.getPackageManagerName())}`);
|
354
263
|
this.logger.debug(`installing dependencies in workspace with options`, options);
|
355
264
|
const mergedRootPolicy = this.dependencyResolver.getWorkspacePolicy();
|
@@ -363,14 +272,14 @@ class InstallMain {
|
|
363
272
|
overrides: this.dependencyResolver.config.overrides,
|
364
273
|
packageImportMethod: this.dependencyResolver.config.packageImportMethod,
|
365
274
|
rootComponents: hasRootComponents
|
366
|
-
};
|
367
|
-
|
275
|
+
};
|
276
|
+
// TODO: pass get install options
|
368
277
|
const installer = this.dependencyResolver.getInstaller({});
|
369
278
|
let current = await this._getComponentsManifests(installer, mergedRootPolicy, pmInstallOptions);
|
370
|
-
let prev;
|
279
|
+
let prev;
|
280
|
+
// TODO: this make duplicate
|
371
281
|
// this.logger.consoleSuccess();
|
372
282
|
// TODO: add the links results to the output
|
373
|
-
|
374
283
|
await this.link({
|
375
284
|
linkTeambitBit: true,
|
376
285
|
legacyLink: true,
|
@@ -386,15 +295,14 @@ class InstallMain {
|
|
386
295
|
linkNestedDepsInNM: !this.workspace.isLegacy && !hasRootComponents
|
387
296
|
};
|
388
297
|
/* eslint-disable no-await-in-loop */
|
389
|
-
|
390
298
|
do {
|
391
299
|
this.workspace.consumer.componentLoader.clearComponentsCache();
|
392
300
|
this.workspace.clearCache();
|
393
301
|
await installer.installComponents(this.workspace.path, current.manifests, mergedRootPolicy, current.componentDirectoryMap, {
|
394
302
|
installTeambitBit: false
|
395
|
-
}, pmInstallOptions);
|
303
|
+
}, pmInstallOptions);
|
304
|
+
// Core aspects should be relinked after installation because Yarn removes all symlinks created not by Yarn.
|
396
305
|
// If we don't link the core aspects immediately, the components will fail during load.
|
397
|
-
|
398
306
|
await this.linkCoreAspectsAndLegacy({
|
399
307
|
linkTeambitBit: false,
|
400
308
|
linkCoreAspects: this.dependencyResolver.linkCoreAspects()
|
@@ -407,11 +315,8 @@ class InstallMain {
|
|
407
315
|
current = await this._getComponentsManifests(installer, mergedRootPolicy, pmInstallOptions);
|
408
316
|
} while (!(0, _lodash().isEqual)(prev.manifests, current.manifests));
|
409
317
|
/* eslint-enable no-await-in-loop */
|
410
|
-
|
411
|
-
|
412
318
|
return current.componentDirectoryMap;
|
413
319
|
}
|
414
|
-
|
415
320
|
async _getComponentsManifests(dependencyInstaller, rootPolicy, installOptions) {
|
416
321
|
const componentDirectoryMap = await this.getComponentsDirectory([]);
|
417
322
|
const manifests = await dependencyInstaller.getComponentManifests(_objectSpread(_objectSpread({}, installOptions), {}, {
|
@@ -424,22 +329,19 @@ class InstallMain {
|
|
424
329
|
manifests
|
425
330
|
};
|
426
331
|
}
|
332
|
+
|
427
333
|
/**
|
428
334
|
* Updates out-of-date dependencies in the workspace.
|
429
335
|
*
|
430
336
|
* @param options.all {Boolean} updates all outdated dependencies without showing a prompt.
|
431
337
|
*/
|
432
|
-
|
433
|
-
|
434
338
|
async updateDependencies(options) {
|
435
339
|
const {
|
436
340
|
componentConfigFiles,
|
437
341
|
componentPoliciesById
|
438
342
|
} = await this._getComponentsWithDependencyPolicies();
|
439
343
|
const variantPatterns = this.variants.raw();
|
440
|
-
|
441
344
|
const variantPoliciesByPatterns = this._variantPatternsToDepPolicesDict(variantPatterns);
|
442
|
-
|
443
345
|
const components = await this.workspace.list();
|
444
346
|
const outdatedPkgs = await this.dependencyResolver.getOutdatedPkgsFromPolicies({
|
445
347
|
rootDir: this.workspace.path,
|
@@ -448,7 +350,6 @@ class InstallMain {
|
|
448
350
|
components
|
449
351
|
});
|
450
352
|
let outdatedPkgsToUpdate;
|
451
|
-
|
452
353
|
if (options.all) {
|
453
354
|
outdatedPkgsToUpdate = outdatedPkgs;
|
454
355
|
} else {
|
@@ -456,7 +357,6 @@ class InstallMain {
|
|
456
357
|
outdatedPkgsToUpdate = await (0, _pickOutdatedPkgs().pickOutdatedPkgs)(outdatedPkgs);
|
457
358
|
this.logger.on();
|
458
359
|
}
|
459
|
-
|
460
360
|
const {
|
461
361
|
updatedVariants,
|
462
362
|
updatedComponents
|
@@ -472,19 +372,16 @@ class InstallMain {
|
|
472
372
|
dedupe: true
|
473
373
|
});
|
474
374
|
}
|
475
|
-
|
476
375
|
async addDuplicateComponentAndPackageIssue(components) {
|
477
376
|
const workspacePolicy = this.dependencyResolver.getWorkspacePolicy();
|
478
377
|
components.forEach(component => {
|
479
378
|
const pkgName = (0, _componentIdToPackageName().default)(component.state._consumer);
|
480
379
|
const found = workspacePolicy.find(pkgName);
|
481
|
-
|
482
380
|
if (found) {
|
483
381
|
component.state.issues.getOrCreate(_componentIssues().IssuesClasses.DuplicateComponentAndPackage).data = found.dependencyId;
|
484
382
|
}
|
485
383
|
});
|
486
384
|
}
|
487
|
-
|
488
385
|
async _getComponentsWithDependencyPolicies() {
|
489
386
|
const allComponentIds = await this.workspace.listIds();
|
490
387
|
const componentConfigFiles = {};
|
@@ -502,33 +399,25 @@ class InstallMain {
|
|
502
399
|
componentPoliciesById
|
503
400
|
};
|
504
401
|
}
|
505
|
-
|
506
402
|
_variantPatternsToDepPolicesDict(variantPatterns) {
|
507
403
|
const variantPoliciesByPatterns = {};
|
508
|
-
|
509
404
|
for (const [variantPattern, extensions] of Object.entries(variantPatterns)) {
|
510
405
|
var _extensions$Dependenc;
|
511
|
-
|
512
406
|
if ((_extensions$Dependenc = extensions[_dependencyResolver().DependencyResolverAspect.id]) !== null && _extensions$Dependenc !== void 0 && _extensions$Dependenc.policy) {
|
513
407
|
var _extensions$Dependenc2;
|
514
|
-
|
515
408
|
variantPoliciesByPatterns[variantPattern] = (_extensions$Dependenc2 = extensions[_dependencyResolver().DependencyResolverAspect.id]) === null || _extensions$Dependenc2 === void 0 ? void 0 : _extensions$Dependenc2.policy;
|
516
409
|
}
|
517
410
|
}
|
518
|
-
|
519
411
|
return variantPoliciesByPatterns;
|
520
412
|
}
|
521
|
-
|
522
413
|
_updateVariantsPolicies(variantPatterns, updateVariantPolicies) {
|
523
414
|
for (const variantPattern of updateVariantPolicies) {
|
524
415
|
this.variants.setExtension(variantPattern, _dependencyResolver().DependencyResolverAspect.id, variantPatterns[variantPattern][_dependencyResolver().DependencyResolverAspect.id], {
|
525
416
|
overrideExisting: true
|
526
417
|
});
|
527
418
|
}
|
528
|
-
|
529
419
|
return this.dependencyResolver.persistConfig(this.workspace.path);
|
530
420
|
}
|
531
|
-
|
532
421
|
async _saveManyComponentConfigFiles(componentConfigFiles) {
|
533
422
|
await Promise.all(Array.from(componentConfigFiles).map(async componentConfigFile => {
|
534
423
|
await componentConfigFile.write({
|
@@ -536,13 +425,12 @@ class InstallMain {
|
|
536
425
|
});
|
537
426
|
}));
|
538
427
|
}
|
428
|
+
|
539
429
|
/**
|
540
430
|
* Uninstall the specified packages from dependencies.
|
541
431
|
*
|
542
432
|
* @param {string[]} the list of packages that should be removed from dependencies.
|
543
433
|
*/
|
544
|
-
|
545
|
-
|
546
434
|
async uninstallDependencies(packages) {
|
547
435
|
this.dependencyResolver.removeFromRootPolicy(packages);
|
548
436
|
await this.dependencyResolver.persistConfig(this.workspace.path);
|
@@ -550,7 +438,6 @@ class InstallMain {
|
|
550
438
|
dedupe: true
|
551
439
|
});
|
552
440
|
}
|
553
|
-
|
554
441
|
async linkCoreAspectsAndLegacy(options = {}) {
|
555
442
|
const linker = this.dependencyResolver.getLinker({
|
556
443
|
rootDir: this.workspace.path,
|
@@ -560,12 +447,10 @@ class InstallMain {
|
|
560
447
|
const res = await linker.linkCoreAspectsAndLegacy(this.workspace.path, compIds, options);
|
561
448
|
return res;
|
562
449
|
}
|
563
|
-
|
564
450
|
async link(options = {}) {
|
565
451
|
if (options.fetchObject) {
|
566
452
|
await this.importObjects();
|
567
453
|
}
|
568
|
-
|
569
454
|
options.consumer = this.workspace.consumer;
|
570
455
|
const compDirMap = await this.getComponentsDirectory([]);
|
571
456
|
const mergedRootPolicy = this.dependencyResolver.getWorkspacePolicy();
|
@@ -576,14 +461,12 @@ class InstallMain {
|
|
576
461
|
const res = await linker.link(this.workspace.path, mergedRootPolicy, compDirMap, options);
|
577
462
|
return res;
|
578
463
|
}
|
579
|
-
|
580
464
|
async importObjects() {
|
581
465
|
const importOptions = {
|
582
466
|
ids: [],
|
583
467
|
objectsOnly: true,
|
584
468
|
installNpmPackages: false
|
585
469
|
};
|
586
|
-
|
587
470
|
try {
|
588
471
|
await this.importer.import(importOptions, []);
|
589
472
|
} catch (err) {
|
@@ -592,18 +475,16 @@ class InstallMain {
|
|
592
475
|
// Do not write nothing to import warning
|
593
476
|
return;
|
594
477
|
}
|
595
|
-
|
596
478
|
throw err;
|
597
479
|
}
|
598
480
|
}
|
481
|
+
|
599
482
|
/**
|
600
483
|
* Generate a filter to pass to the installer
|
601
484
|
* This will filter deps which are come from remotes which defined in scope.json
|
602
485
|
* those components comes from local remotes, usually doesn't have a package in a registry
|
603
486
|
* so no reason to try to install them (it will fail)
|
604
487
|
*/
|
605
|
-
|
606
|
-
|
607
488
|
async generateFilterFnForDepsFromLocalRemote() {
|
608
489
|
// TODO: once scope create a new API for this, replace it with the new one
|
609
490
|
const remotes = await this.workspace.scope._legacyRemotes();
|
@@ -614,30 +495,24 @@ class InstallMain {
|
|
614
495
|
if (!(dep instanceof _dependencyResolver().ComponentDependency)) {
|
615
496
|
return true;
|
616
497
|
}
|
617
|
-
|
618
498
|
if (remotes.isHub(dep.componentId.scope)) {
|
619
499
|
return true;
|
620
500
|
}
|
621
|
-
|
622
501
|
if (packageScopes.some(scope => dep.packageName.startsWith(`@${scope}/`))) {
|
623
502
|
return true;
|
624
503
|
}
|
625
|
-
|
626
504
|
return false;
|
627
505
|
});
|
628
506
|
return filtered;
|
629
507
|
};
|
630
508
|
}
|
631
|
-
|
632
509
|
async getComponentsDirectory(ids) {
|
633
510
|
const components = ids.length ? await this.workspace.getMany(ids) : await this.workspace.list();
|
634
511
|
return _component().ComponentMap.as(components, component => this.workspace.componentDir(component.id));
|
635
512
|
}
|
636
|
-
|
637
513
|
static async provider([dependencyResolver, workspace, loggerExt, variants, cli, community, importer, compiler, issues]) {
|
638
514
|
const logger = loggerExt.createLogger('teambit.bit/install');
|
639
515
|
const installExt = new InstallMain(dependencyResolver, logger, workspace, variants, importer, compiler);
|
640
|
-
|
641
516
|
_manyComponentsWriter().default.registerExternalInstaller({
|
642
517
|
install: async () => {
|
643
518
|
// TODO: think how we should pass this options
|
@@ -649,25 +524,19 @@ class InstallMain {
|
|
649
524
|
return installExt.install(undefined, installOpts);
|
650
525
|
}
|
651
526
|
});
|
652
|
-
|
653
527
|
if (issues) {
|
654
528
|
issues.registerAddComponentsIssues(installExt.addDuplicateComponentAndPackageIssue.bind(installExt));
|
655
529
|
}
|
656
|
-
|
657
530
|
const commands = [new (_install2().default)(installExt, workspace, logger), new (_uninstall().default)(installExt), new (_update().default)(installExt), new (_link().LinkCommand)(installExt, workspace, logger, community.getDocsDomain())];
|
658
531
|
cli.register(...commands);
|
659
532
|
return installExt;
|
660
533
|
}
|
661
|
-
|
662
534
|
}
|
663
|
-
|
664
535
|
exports.InstallMain = InstallMain;
|
665
536
|
(0, _defineProperty2().default)(InstallMain, "slots", []);
|
666
537
|
(0, _defineProperty2().default)(InstallMain, "dependencies", [_dependencyResolver().DependencyResolverAspect, _workspace().WorkspaceAspect, _logger().LoggerAspect, _variants().VariantsAspect, _cli().CLIAspect, _community().CommunityAspect, _importer().ImporterAspect, _compiler().CompilerAspect, _issues().IssuesAspect]);
|
667
538
|
(0, _defineProperty2().default)(InstallMain, "runtime", _cli().MainRuntime);
|
668
|
-
|
669
539
|
_install().InstallAspect.addRuntime(InstallMain);
|
670
|
-
|
671
540
|
var _default = InstallMain;
|
672
541
|
exports.default = _default;
|
673
542
|
|