@teambit/workspace 1.0.347 → 1.0.349

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.347/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.347/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.349/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.349/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/dist/types.d.ts CHANGED
@@ -18,6 +18,11 @@ export interface WorkspaceExtConfig {
18
18
  * set the default directory when there is no matching for the component in the components array.
19
19
  */
20
20
  defaultDirectory: string;
21
+ /**
22
+ * sets the location of the root components directory.
23
+ * The location is a relative path to the workspace root and should use linux path separators (/).
24
+ */
25
+ rootComponentsDirectory?: string;
21
26
  /**
22
27
  * set the default structure of components in your project
23
28
  */
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * set the default scope when there is no matching for the component in the components array.\n */\n defaultScope: string;\n\n /**\n * set the default directory when there is no matching for the component in the components array.\n */\n defaultDirectory: string;\n\n /**\n * set the default structure of components in your project\n */\n vendor: VendorConfig;\n\n /**\n * All component extensions applied by default on all components in the workspace (except vendor components)\n */\n extensions: { [extensionsId: string]: string };\n\n /**\n * If set to\n * `true`, it allows the workspace to resolve scope's aspects from node modules\n * installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved\n * from the scope aspects capsule.\n */\n resolveAspectsFromNodeModules?: boolean;\n\n /**\n * If set to `true`, it allows the workspace to resolve envs from node modules\n * installed in the workspace's `node_modules` directory.\n * the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})\n * and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the\n * workspace.\n * If not set or set to `false`, envs will only be resolved from the scope envs capsule.\n */\n resolveEnvsFromRoots?: boolean;\n\n /**\n * If set to `true`, bit will try to load aspects dependencies automatically.\n * even if the aspects dependencies are not configured in the workspace.jsonc root config.\n * for example having the aspect\n * main aspect\n * export class MainAspectMain {\n * ...\n * static dependencies = [MyDepAspect];\n * }\n * and the in the workspace.jsonc file:\n * {\n * ...\n * main-aspect: {}\n * }\n * when set to true, bit will try to load MyDepAspect automatically.\n */\n autoLoadAspectsDeps?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * set the default scope when there is no matching for the component in the components array.\n */\n defaultScope: string;\n\n /**\n * set the default directory when there is no matching for the component in the components array.\n */\n defaultDirectory: string;\n\n /**\n * sets the location of the root components directory.\n * The location is a relative path to the workspace root and should use linux path separators (/).\n */\n rootComponentsDirectory?: string;\n\n /**\n * set the default structure of components in your project\n */\n vendor: VendorConfig;\n\n /**\n * All component extensions applied by default on all components in the workspace (except vendor components)\n */\n extensions: { [extensionsId: string]: string };\n\n /**\n * If set to\n * `true`, it allows the workspace to resolve scope's aspects from node modules\n * installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved\n * from the scope aspects capsule.\n */\n resolveAspectsFromNodeModules?: boolean;\n\n /**\n * If set to `true`, it allows the workspace to resolve envs from node modules\n * installed in the workspace's `node_modules` directory.\n * the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})\n * and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the\n * workspace.\n * If not set or set to `false`, envs will only be resolved from the scope envs capsule.\n */\n resolveEnvsFromRoots?: boolean;\n\n /**\n * If set to `true`, bit will try to load aspects dependencies automatically.\n * even if the aspects dependencies are not configured in the workspace.jsonc root config.\n * for example having the aspect\n * main aspect\n * export class MainAspectMain {\n * ...\n * static dependencies = [MyDepAspect];\n * }\n * and the in the workspace.jsonc file:\n * {\n * ...\n * main-aspect: {}\n * }\n * when set to true, bit will try to load MyDepAspect automatically.\n */\n autoLoadAspectsDeps?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -178,6 +178,10 @@ export declare class Workspace implements ComponentFactory {
178
178
  * root path of the Workspace.
179
179
  */
180
180
  get path(): string;
181
+ /**
182
+ * Get the location of the bit roots folder
183
+ */
184
+ get rootComponentsPath(): string;
181
185
  /** get the `node_modules` folder of this workspace */
182
186
  private get modulesPath();
183
187
  get isLegacy(): boolean;
package/dist/workspace.js CHANGED
@@ -439,6 +439,14 @@ class Workspace {
439
439
  return this.consumer.getPath();
440
440
  }
441
441
 
442
+ /**
443
+ * Get the location of the bit roots folder
444
+ */
445
+ get rootComponentsPath() {
446
+ const baseDir = this.config.rootComponentsDirectory != null ? _path().default.join(this.path, this.config.rootComponentsDirectory) : this.modulesPath;
447
+ return _path().default.join(baseDir, _constants().BIT_ROOTS_DIR);
448
+ }
449
+
442
450
  /** get the `node_modules` folder of this workspace */
443
451
  get modulesPath() {
444
452
  return _path().default.join(this.path, 'node_modules');
@@ -1678,8 +1686,11 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1678
1686
  await this.clearCache();
1679
1687
  }
1680
1688
  async getComponentPackagePath(component) {
1681
- const inInWs = await this.hasId(component.id);
1682
- const relativePath = this.dependencyResolver.getRuntimeModulePath(component, inInWs);
1689
+ const relativePath = this.dependencyResolver.getRuntimeModulePath(component, {
1690
+ workspacePath: this.path,
1691
+ rootComponentsPath: this.rootComponentsPath,
1692
+ isInWorkspace: this.hasId(component.id)
1693
+ });
1683
1694
  return _path().default.join(this.path, relativePath);
1684
1695
  }
1685
1696
 
@@ -2094,6 +2105,13 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
2094
2105
  return this.componentStatusLoader.getComponentStatusById(id);
2095
2106
  }
2096
2107
  async setLocalOnly(ids) {
2108
+ const staged = (0, _lodash().compact)(await (0, _pMapSeries().default)(ids, async id => {
2109
+ const componentStatus = await this.getComponentStatusById(id);
2110
+ if (componentStatus.staged) return id;
2111
+ }));
2112
+ if (staged.length) {
2113
+ throw new (_bitError().BitError)(`unable to set the following component(s) as local-only because they have local snaps/tags: ${staged.join(', ')}`);
2114
+ }
2097
2115
  this.bitMap.setLocalOnly(ids);
2098
2116
  await this.bitMap.write('setLocalOnly');
2099
2117
  }