@teambit/workspace 1.0.281 → 1.0.282

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.281/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.281/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.282/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.282/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -2,7 +2,7 @@ import { Graph } from '@teambit/graph.cleargraph';
2
2
  import type { PubsubMain } from '@teambit/pubsub';
3
3
  import { IssuesList } from '@teambit/component-issues';
4
4
  import type { AspectLoaderMain, AspectDefinition } from '@teambit/aspect-loader';
5
- import { ComponentMain, Component, ComponentFactory, InvalidComponent, ResolveAspectsOptions } from '@teambit/component';
5
+ import { ComponentMain, Component, ComponentFactory, InvalidComponent, ResolveAspectsOptions, AspectList } from '@teambit/component';
6
6
  import { ComponentScopeDirMap, WorkspaceConfig } from '@teambit/config';
7
7
  import { DependencyResolverMain, DependencyList } from '@teambit/dependency-resolver';
8
8
  import { EnvsMain } from '@teambit/envs';
@@ -221,7 +221,7 @@ export declare class Workspace implements ComponentFactory {
221
221
  * Check if a specific id exist in the workspace
222
222
  * @param componentId
223
223
  */
224
- hasId(componentId: ComponentID): Promise<boolean>;
224
+ hasId(componentId: ComponentID): boolean;
225
225
  /**
226
226
  * given component-ids, return the ones that are part of the workspace
227
227
  */
@@ -269,7 +269,7 @@ export declare class Workspace implements ComponentFactory {
269
269
  * given component ids, find their dependents in the workspace
270
270
  */
271
271
  getDependentsIds(ids: ComponentID[], filterOutNowWorkspaceIds?: boolean): Promise<ComponentID[]>;
272
- createAspectList(extensionDataList: ExtensionDataList): Promise<import("@teambit/component").AspectList>;
272
+ createAspectList(extensionDataList: ExtensionDataList): Promise<AspectList>;
273
273
  private extensionDataEntryToAspectEntry;
274
274
  /**
275
275
  * this is not the complete legacy component (ConsumerComponent), it's missing dependencies and hooks from Harmony
@@ -311,6 +311,7 @@ export declare class Workspace implements ComponentFactory {
311
311
  getCurrentRemoteLane(): Promise<Lane | null>;
312
312
  getDefaultExtensions(): ExtensionDataList;
313
313
  getComponentConfigVinylFile(id: ComponentID, options: EjectConfOptions, excludeLocalChanges?: boolean): Promise<JsonVinyl>;
314
+ private removeEnvVersionIfExistsLocally;
314
315
  ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]>;
315
316
  getAspectConfigForComponent(id: ComponentID, aspectId: string): Promise<object | undefined>;
316
317
  getExtensionsFromScopeAndSpecific(id: ComponentID, excludeComponentJson?: boolean): Promise<ExtensionDataList>;
package/dist/workspace.js CHANGED
@@ -572,8 +572,8 @@ class Workspace {
572
572
  * Check if a specific id exist in the workspace
573
573
  * @param componentId
574
574
  */
575
- async hasId(componentId) {
576
- const ids = await this.listIds();
575
+ hasId(componentId) {
576
+ const ids = this.listIds();
577
577
  const found = ids.find(id => {
578
578
  return id.isEqual(componentId);
579
579
  });
@@ -1032,6 +1032,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1032
1032
  const componentId = await this.resolveComponentId(id);
1033
1033
  const extensions = await this.getExtensionsFromScopeAndSpecific(id, excludeLocalChanges);
1034
1034
  const aspects = await this.createAspectList(extensions);
1035
+ this.removeEnvVersionIfExistsLocally(aspects);
1035
1036
  const componentDir = this.componentDir(id, {
1036
1037
  ignoreVersion: true
1037
1038
  }, {
@@ -1040,6 +1041,16 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1040
1041
  const configFile = new (_componentConfigFile().ComponentConfigFile)(componentId, aspects, componentDir, options.propagate);
1041
1042
  return configFile.toVinylFile(options);
1042
1043
  }
1044
+ removeEnvVersionIfExistsLocally(aspects) {
1045
+ const env = aspects.get(_envs().EnvsAspect.id)?.config?.env;
1046
+ if (!env) return;
1047
+ const envAspect = aspects.get(env);
1048
+ if (!envAspect) return;
1049
+ const envExtId = envAspect.id;
1050
+ if (!envExtId?.hasVersion()) return;
1051
+ if (!this.exists(envExtId)) return;
1052
+ envAspect.id = envExtId.changeVersion(undefined);
1053
+ }
1043
1054
  async ejectMultipleConfigs(ids, options) {
1044
1055
  const vinylFiles = await Promise.all(ids.map(id => this.getComponentConfigVinylFile(id, options)));
1045
1056
  const EjectConfResult = vinylFiles.map(file => ({