@teambit/workspace 1.0.13 → 1.0.15

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/workspace.js CHANGED
@@ -651,7 +651,7 @@ class Workspace {
651
651
  const allIds = this.consumer.bitMap.getAllBitIdsFromAllLanes();
652
652
  const availableIds = this.consumer.bitMap.getAllIdsAvailableOnLane();
653
653
  if (allIds.length === availableIds.length) return [];
654
- const unavailableIds = allIds.filter(id => !availableIds.hasWithoutScopeAndVersion(id));
654
+ const unavailableIds = allIds.filter(id => !availableIds.hasWithoutVersion(id));
655
655
  if (!unavailableIds.length) return [];
656
656
  const removedIds = this.consumer.bitMap.getRemoved();
657
657
  const compsWithHead = [];
@@ -974,7 +974,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
974
974
  const componentFromScope = await this.scope.get(id);
975
975
  const {
976
976
  extensions
977
- } = await this.componentExtensions(id, componentFromScope, ['WorkspaceDefault', 'WorkspaceVariants']);
977
+ } = await this.componentExtensions(id, componentFromScope, ['WorkspaceVariants']);
978
978
  return extensions;
979
979
  }
980
980
 
@@ -1214,7 +1214,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1214
1214
  if (componentConfigFile && componentConfigFile.defaultScope) {
1215
1215
  return componentConfigFile.defaultScope;
1216
1216
  }
1217
- const bitMapId = this.consumer.bitMap.getExistingBitId(name);
1217
+ const bitMapId = this.consumer.bitMap.getExistingBitId(name, false);
1218
1218
  const bitMapEntry = bitMapId ? this.consumer.bitMap.getComponent(bitMapId) : undefined;
1219
1219
  if (bitMapEntry && bitMapEntry.defaultScope) {
1220
1220
  return bitMapEntry.defaultScope;
@@ -1332,6 +1332,9 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1332
1332
  if (this.defaultScope === scopeName) {
1333
1333
  throw new Error(`the default-scope is already set as "${scopeName}", nothing to change`);
1334
1334
  }
1335
+ if (!(0, _legacyBitId().isValidScopeName)(scopeName)) {
1336
+ throw new (_legacyBitId().InvalidScopeName)(scopeName);
1337
+ }
1335
1338
  const config = this.harmony.get('teambit.harmony/config');
1336
1339
  (_config$workspaceConf = config.workspaceConfig) === null || _config$workspaceConf === void 0 || _config$workspaceConf.setExtension(_workspace().WorkspaceAspect.id, {
1337
1340
  defaultScope: scopeName
@@ -1339,10 +1342,13 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1339
1342
  mergeIntoExisting: true,
1340
1343
  ignoreVersion: true
1341
1344
  });
1345
+ // fix also comps using the old default-scope
1346
+ this.bitMap.updateDefaultScope(this.config.defaultScope, scopeName);
1342
1347
  this.config.defaultScope = scopeName;
1343
1348
  await ((_config$workspaceConf2 = config.workspaceConfig) === null || _config$workspaceConf2 === void 0 ? void 0 : _config$workspaceConf2.write({
1344
1349
  dir: _path2().default.dirname(config.workspaceConfig.path)
1345
1350
  }));
1351
+ await this.bitMap.write();
1346
1352
  }
1347
1353
  async addSpecificComponentConfig(id, aspectId, config = {}, {
1348
1354
  shouldMergeWithExisting,
@@ -1548,7 +1554,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1548
1554
  const relativeComponentDir = this.componentDirFromLegacyId(bitId, bitMapOptions, {
1549
1555
  relative: true
1550
1556
  });
1551
- const defaultScope = await this.componentDefaultScopeFromComponentDirAndName(relativeComponentDir, bitId.toStringWithoutScopeAndVersion());
1557
+ const defaultScope = await this.componentDefaultScopeFromComponentDirAndName(relativeComponentDir, bitId.name);
1552
1558
  return defaultScope;
1553
1559
  };
1554
1560