@teambit/install 1.0.395 → 1.0.397
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +3 -3
- package/artifacts/schema.json +456 -348
- package/dist/install.main.runtime.d.ts +15 -0
- package/dist/install.main.runtime.js +75 -1
- package/dist/install.main.runtime.js.map +1 -1
- package/package.json +17 -17
- /package/dist/{preview-1725160825823.js → preview-1725333555400.js} +0 -0
@@ -114,6 +114,21 @@ export declare class InstallMain {
|
|
114
114
|
private reloadNonLoadedEnvs;
|
115
115
|
private reloadEnvs;
|
116
116
|
private reloadAspects;
|
117
|
+
private reloadOneAspectsGroup;
|
118
|
+
/**
|
119
|
+
* This function groups the components to aspects to load into groups.
|
120
|
+
* The order of the groups is important, the first group should be loaded first.
|
121
|
+
* The order inside the group is not important.
|
122
|
+
* The groups are:
|
123
|
+
* 1. aspects definitions without components (this should be an empty group, if it's not, we should check why).
|
124
|
+
* 2. aspects which are not in the workspace but in the scope / node modules.
|
125
|
+
* 3. envs of aspects (which are also aspects)
|
126
|
+
* 4. other aspects (the rest)
|
127
|
+
* @param aspects
|
128
|
+
* @returns
|
129
|
+
*/
|
130
|
+
private groupAspectsToLoad;
|
131
|
+
private regroupEnvsIdsFromTheList;
|
117
132
|
private _getComponentsManifestsAndRootPolicy;
|
118
133
|
/**
|
119
134
|
* The function `tryWriteConfigFiles` attempts to write workspace config files, and if it fails, it logs an error
|
@@ -369,7 +369,8 @@ class InstallMain {
|
|
369
369
|
await this.install(packages, {
|
370
370
|
addMissingDeps: installMissing,
|
371
371
|
skipIfExisting: true,
|
372
|
-
writeConfigFiles: false
|
372
|
+
writeConfigFiles: false,
|
373
|
+
optimizeReportForNonTerminal: !process.stdout.isTTY
|
373
374
|
// skipPrune: true,
|
374
375
|
});
|
375
376
|
}
|
@@ -625,6 +626,21 @@ class InstallMain {
|
|
625
626
|
}
|
626
627
|
}
|
627
628
|
async reloadAspects(aspects) {
|
629
|
+
const groups = await this.groupAspectsToLoad(aspects);
|
630
|
+
// We need to make sure we load group by group and not in parallel
|
631
|
+
await (0, _pMapSeries().default)(groups, async group => {
|
632
|
+
await this.reloadOneAspectsGroup(group);
|
633
|
+
});
|
634
|
+
}
|
635
|
+
async reloadOneAspectsGroup(group) {
|
636
|
+
const aspects = group.aspects || [];
|
637
|
+
if (group.workspace && !group.envOfAspect) {
|
638
|
+
aspects.forEach(aspectDef => {
|
639
|
+
if (aspectDef.component?.id) {
|
640
|
+
this.workspace.clearComponentCache(aspectDef.component.id);
|
641
|
+
}
|
642
|
+
});
|
643
|
+
}
|
628
644
|
const loadedPlugins = (0, _lodash().compact)(await Promise.all(aspects.map(aspectDef => {
|
629
645
|
const localPath = aspectDef.aspectPath;
|
630
646
|
const component = aspectDef.component;
|
@@ -639,6 +655,64 @@ class InstallMain {
|
|
639
655
|
return runtime?.provider(undefined, undefined, undefined, this.harmony);
|
640
656
|
}));
|
641
657
|
}
|
658
|
+
|
659
|
+
/**
|
660
|
+
* This function groups the components to aspects to load into groups.
|
661
|
+
* The order of the groups is important, the first group should be loaded first.
|
662
|
+
* The order inside the group is not important.
|
663
|
+
* The groups are:
|
664
|
+
* 1. aspects definitions without components (this should be an empty group, if it's not, we should check why).
|
665
|
+
* 2. aspects which are not in the workspace but in the scope / node modules.
|
666
|
+
* 3. envs of aspects (which are also aspects)
|
667
|
+
* 4. other aspects (the rest)
|
668
|
+
* @param aspects
|
669
|
+
* @returns
|
670
|
+
*/
|
671
|
+
async groupAspectsToLoad(aspects) {
|
672
|
+
const groups = (0, _lodash().groupBy)(aspects, aspectDef => {
|
673
|
+
if (!aspectDef.component) return 'no-comp';
|
674
|
+
if (!this.workspace.hasId(aspectDef.component.id)) return 'scope';
|
675
|
+
return 'workspace';
|
676
|
+
});
|
677
|
+
const workspaceSubGroups = await this.regroupEnvsIdsFromTheList(groups.workspace || []);
|
678
|
+
return [{
|
679
|
+
comps: false,
|
680
|
+
workspace: false,
|
681
|
+
aspects: groups.noComp || []
|
682
|
+
}, {
|
683
|
+
comps: true,
|
684
|
+
workspace: false,
|
685
|
+
aspects: groups.scope || []
|
686
|
+
}, {
|
687
|
+
comps: true,
|
688
|
+
workspace: true,
|
689
|
+
envOfAspect: true,
|
690
|
+
aspects: workspaceSubGroups.envOfAspect
|
691
|
+
}, {
|
692
|
+
comps: true,
|
693
|
+
workspace: true,
|
694
|
+
aspects: workspaceSubGroups.otherAspects
|
695
|
+
}];
|
696
|
+
}
|
697
|
+
async regroupEnvsIdsFromTheList(aspects) {
|
698
|
+
const envsOfAspects = new Set();
|
699
|
+
await Promise.all(aspects.map(async aspectDef => {
|
700
|
+
if (!aspectDef.component) return;
|
701
|
+
const envId = aspectDef.component ? await this.envs.calculateEnvId(aspectDef.component) : undefined;
|
702
|
+
if (envId) {
|
703
|
+
envsOfAspects.add(envId.toString());
|
704
|
+
}
|
705
|
+
}));
|
706
|
+
const groups = (0, _lodash().groupBy)(aspects, aspectDef => {
|
707
|
+
const id = aspectDef.component?.id.toString();
|
708
|
+
const idWithoutVersion = aspectDef.component?.id.toStringWithoutVersion();
|
709
|
+
if (id && envsOfAspects.has(id) || idWithoutVersion && envsOfAspects.has(idWithoutVersion)) {
|
710
|
+
return 'envOfAspect';
|
711
|
+
}
|
712
|
+
return 'otherAspects';
|
713
|
+
});
|
714
|
+
return groups;
|
715
|
+
}
|
642
716
|
async _getComponentsManifestsAndRootPolicy(installer, options) {
|
643
717
|
const mergedRootPolicy = await this.addConfiguredAspectsToWorkspacePolicy();
|
644
718
|
await this.addConfiguredGeneratorEnvsToWorkspacePolicy(mergedRootPolicy);
|