@teambit/workspace 1.0.338 → 1.0.339
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_workspace-preview.js +1 -1
- package/artifacts/schema.json +2057 -1869
- package/dist/{preview-1721186478884.js → preview-1721223204715.js} +2 -2
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/dist/workspace.d.ts +5 -0
- package/dist/workspace.js +20 -3
- package/dist/workspace.js.map +1 -1
- package/package.json +28 -28
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.339/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.339/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":[]}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -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;
|
|
@@ -501,6 +505,7 @@ export declare class Workspace implements ComponentFactory {
|
|
|
501
505
|
*/
|
|
502
506
|
_reloadConsumer(): Promise<void>;
|
|
503
507
|
getComponentPackagePath(component: Component): Promise<string>;
|
|
508
|
+
_getComponentRelativePath(component: Component): Promise<string>;
|
|
504
509
|
get defaultDirectory(): string;
|
|
505
510
|
get legacyDefaultDirectory(): string;
|
|
506
511
|
resolveComponentIdFromPackageName(packageName: string): Promise<ComponentID>;
|
package/dist/workspace.js
CHANGED
|
@@ -429,6 +429,9 @@ class Workspace {
|
|
|
429
429
|
if ((0, _lodash().isEmpty)(this.config)) throw new (_bitError().BitError)(`fatal: workspace config is empty. probably one of bit files is missing. please run "bit init" to rewrite them`);
|
|
430
430
|
const defaultScope = this.config.defaultScope;
|
|
431
431
|
if (!defaultScope) throw new (_bitError().BitError)('defaultScope is missing');
|
|
432
|
+
if (this.config.rootComponentsDirectory === '') {
|
|
433
|
+
throw new (_bitError().BitError)('rootComponentsDirectory cannot be empty. Root components directory location cannot be the same as the workspace directory path');
|
|
434
|
+
}
|
|
432
435
|
if (!(0, _legacyBitId().isValidScopeName)(defaultScope)) throw new (_legacyBitId().InvalidScopeName)(defaultScope);
|
|
433
436
|
}
|
|
434
437
|
|
|
@@ -439,6 +442,13 @@ class Workspace {
|
|
|
439
442
|
return this.consumer.getPath();
|
|
440
443
|
}
|
|
441
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Get the location of the bit roots folder
|
|
447
|
+
*/
|
|
448
|
+
get rootComponentsPath() {
|
|
449
|
+
return this.config.rootComponentsDirectory ?? _path().default.join(this.modulesPath, '.bit_roots');
|
|
450
|
+
}
|
|
451
|
+
|
|
442
452
|
/** get the `node_modules` folder of this workspace */
|
|
443
453
|
get modulesPath() {
|
|
444
454
|
return _path().default.join(this.path, 'node_modules');
|
|
@@ -1677,9 +1687,16 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1677
1687
|
await this.clearCache();
|
|
1678
1688
|
}
|
|
1679
1689
|
async getComponentPackagePath(component) {
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1690
|
+
return _path().default.join(this.path, await this._getComponentRelativePath(component));
|
|
1691
|
+
}
|
|
1692
|
+
async _getComponentRelativePath(component) {
|
|
1693
|
+
if (this.hasId(component.id)) {
|
|
1694
|
+
return this.dependencyResolver.getRuntimeModulePathInWorkspace(component, {
|
|
1695
|
+
workspacePath: this.path,
|
|
1696
|
+
rootComponentsPath: this.rootComponentsPath
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
return this.dependencyResolver.getRuntimeModulePathInCapsules(component);
|
|
1683
1700
|
}
|
|
1684
1701
|
|
|
1685
1702
|
// TODO: should we return here the dir as it defined (aka components) or with /{name} prefix (as it used in legacy)
|