@teambit/workspace 0.0.523 → 0.0.527

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/capsule.cmd.ts CHANGED
@@ -7,6 +7,7 @@ import { Workspace } from '.';
7
7
 
8
8
  type CreateOpts = {
9
9
  baseDir?: string;
10
+ rootBaseDir?: string;
10
11
  alwaysNew?: boolean;
11
12
  seedersOnly?: boolean;
12
13
  id: string;
@@ -19,7 +20,12 @@ export class CapsuleCreateCmd implements Command {
19
20
  group = 'capsules';
20
21
  alias = '';
21
22
  options = [
22
- ['b', 'base-dir <name>', 'set base dir of all capsules'],
23
+ [
24
+ 'b',
25
+ 'base-dir <name>',
26
+ 'set base dir of all capsules (hashed to create the base dir inside the root dir - host path by default)',
27
+ ],
28
+ ['r', 'root-base-dir <name>', 'set root base dir of all capsules (absolute path to use as root dir)'],
23
29
  ['a', 'always-new', 'create new environment for capsule'],
24
30
  ['s', 'seeders-only', 'create capsules for the seeders only (not for the entire graph)'],
25
31
  ['i', 'id <name>', 'reuse capsule of certain name'],
@@ -32,12 +38,13 @@ export class CapsuleCreateCmd implements Command {
32
38
 
33
39
  async create(
34
40
  [componentIds = []]: [string[]],
35
- { baseDir, alwaysNew = false, id, installPackages = false, seedersOnly = false }: CreateOpts
41
+ { baseDir, rootBaseDir, alwaysNew = false, id, installPackages = false, seedersOnly = false }: CreateOpts
36
42
  ): Promise<CapsuleList> {
37
43
  // @todo: why it is not an array?
38
44
  if (componentIds && !Array.isArray(componentIds)) componentIds = [componentIds];
39
45
  const capsuleOptions: IsolateComponentsOptions = {
40
46
  baseDir,
47
+ rootBaseDir,
41
48
  installOptions: { installPackages },
42
49
  alwaysNew,
43
50
  seedersOnly,
@@ -3,6 +3,7 @@ import { CapsuleList, IsolatorMain } from '@teambit/isolator';
3
3
  import { Workspace } from '.';
4
4
  declare type CreateOpts = {
5
5
  baseDir?: string;
6
+ rootBaseDir?: string;
6
7
  alwaysNew?: boolean;
7
8
  seedersOnly?: boolean;
8
9
  id: string;
@@ -17,7 +18,7 @@ export declare class CapsuleCreateCmd implements Command {
17
18
  alias: string;
18
19
  options: CommandOptions;
19
20
  constructor(workspace: Workspace, isolator: IsolatorMain);
20
- create([componentIds]: [string[]], { baseDir, alwaysNew, id, installPackages, seedersOnly }: CreateOpts): Promise<CapsuleList>;
21
+ create([componentIds]: [string[]], { baseDir, rootBaseDir, alwaysNew, id, installPackages, seedersOnly }: CreateOpts): Promise<CapsuleList>;
21
22
  report([componentIds]: [string[]], opts: CreateOpts): Promise<string>;
22
23
  json([componentIds]: [string[]], opts: CreateOpts): Promise<{
23
24
  id: string;
@@ -43,11 +43,12 @@ class CapsuleCreateCmd {
43
43
  (0, _defineProperty2().default)(this, "description", `create capsules`);
44
44
  (0, _defineProperty2().default)(this, "group", 'capsules');
45
45
  (0, _defineProperty2().default)(this, "alias", '');
46
- (0, _defineProperty2().default)(this, "options", [['b', 'base-dir <name>', 'set base dir of all capsules'], ['a', 'always-new', 'create new environment for capsule'], ['s', 'seeders-only', 'create capsules for the seeders only (not for the entire graph)'], ['i', 'id <name>', 'reuse capsule of certain name'], ['j', 'json', 'json format'], ['d', 'install-packages', 'install packages by the package-manager'], ['p', 'package-manager <name>', 'npm, yarn or pnpm, default to npm']]);
46
+ (0, _defineProperty2().default)(this, "options", [['b', 'base-dir <name>', 'set base dir of all capsules (hashed to create the base dir inside the root dir - host path by default)'], ['r', 'root-base-dir <name>', 'set root base dir of all capsules (absolute path to use as root dir)'], ['a', 'always-new', 'create new environment for capsule'], ['s', 'seeders-only', 'create capsules for the seeders only (not for the entire graph)'], ['i', 'id <name>', 'reuse capsule of certain name'], ['j', 'json', 'json format'], ['d', 'install-packages', 'install packages by the package-manager'], ['p', 'package-manager <name>', 'npm, yarn or pnpm, default to npm']]);
47
47
  }
48
48
 
49
49
  async create([componentIds = []], {
50
50
  baseDir,
51
+ rootBaseDir,
51
52
  alwaysNew = false,
52
53
  id,
53
54
  installPackages = false,
@@ -57,6 +58,7 @@ class CapsuleCreateCmd {
57
58
  if (componentIds && !Array.isArray(componentIds)) componentIds = [componentIds];
58
59
  const capsuleOptions = {
59
60
  baseDir,
61
+ rootBaseDir,
60
62
  installOptions: {
61
63
  installPackages
62
64
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["capsule.cmd.ts"],"names":["CapsuleCreateCmd","constructor","workspace","isolator","create","componentIds","baseDir","alwaysNew","id","installPackages","seedersOnly","Array","isArray","capsuleOptions","installOptions","includeFromNestedHosts","name","ids","resolveMultipleComponentIds","network","isolateComponents","capsules","graphCapsules","report","opts","capsuleOutput","map","capsule","chalk","bold","component","toString","path","join","title","length","green","json","c","CapsuleListCmd","list","workspaceCapsulesRootDir","scopeCapsulesRootDir","scopeAspectsCapsulesRootDir","getCapsulesRootDirs","cyan","rootDirs","getCapsulesRootDir","scope","getAspectCapsulePath","CapsuleCmd","args"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAYO,MAAMA,gBAAN,CAA0C;AAe/CC,EAAAA,WAAW,CAASC,SAAT,EAAuCC,QAAvC,EAA+D;AAAA,SAAtDD,SAAsD,GAAtDA,SAAsD;AAAA,SAAxBC,QAAwB,GAAxBA,QAAwB;AAAA,kDAdnE,0BAcmE;AAAA,yDAb3D,iBAa2D;AAAA,mDAZlE,UAYkE;AAAA,mDAXlE,EAWkE;AAAA,qDAVhE,CACR,CAAC,GAAD,EAAM,iBAAN,EAAyB,8BAAzB,CADQ,EAER,CAAC,GAAD,EAAM,YAAN,EAAoB,oCAApB,CAFQ,EAGR,CAAC,GAAD,EAAM,cAAN,EAAsB,iEAAtB,CAHQ,EAIR,CAAC,GAAD,EAAM,WAAN,EAAmB,+BAAnB,CAJQ,EAKR,CAAC,GAAD,EAAM,MAAN,EAAc,aAAd,CALQ,EAMR,CAAC,GAAD,EAAM,kBAAN,EAA0B,yCAA1B,CANQ,EAOR,CAAC,GAAD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AC3B;AACA,WAAQ,8BAAR;AACD;;AAjBwC","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { CapsuleList, IsolateComponentsOptions, IsolatorMain } from '@teambit/isolator';\nimport chalk from 'chalk';\n\nimport { Workspace } from '.';\n\ntype CreateOpts = {\n baseDir?: string;\n alwaysNew?: boolean;\n seedersOnly?: boolean;\n id: string;\n installPackages?: boolean;\n};\n\nexport class CapsuleCreateCmd implements Command {\n name = 'create [componentIds...]';\n description = `create capsules`;\n group = 'capsules';\n alias = '';\n options = [\n ['b', 'base-dir <name>', 'set base dir of all capsules'],\n ['a', 'always-new', 'create new environment for capsule'],\n ['s', 'seeders-only', 'create capsules for the seeders only (not for the entire graph)'],\n ['i', 'id <name>', 'reuse capsule of certain name'],\n ['j', 'json', 'json format'],\n ['d', 'install-packages', 'install packages by the package-manager'],\n ['p', 'package-manager <name>', 'npm, yarn or pnpm, default to npm'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace, private isolator: IsolatorMain) {}\n\n async create(\n [componentIds = []]: [string[]],\n { baseDir, alwaysNew = false, id, installPackages = false, seedersOnly = false }: CreateOpts\n ): Promise<CapsuleList> {\n // @todo: why it is not an array?\n if (componentIds && !Array.isArray(componentIds)) componentIds = [componentIds];\n const capsuleOptions: IsolateComponentsOptions = {\n baseDir,\n installOptions: { installPackages },\n alwaysNew,\n seedersOnly,\n includeFromNestedHosts: true,\n name: id,\n };\n const ids = await this.workspace.resolveMultipleComponentIds(componentIds);\n const network = await this.isolator.isolateComponents(ids, capsuleOptions);\n const capsules = network.graphCapsules;\n return capsules;\n }\n\n async report([componentIds]: [string[]], opts: CreateOpts) {\n // @ts-ignore\n const capsules = await this.create(componentIds, opts);\n const capsuleOutput = capsules\n .map((capsule) => `${chalk.bold(capsule.component.id.toString())} - ${capsule.path}`)\n .join('\\n');\n const title = `${capsules.length} capsule(s) were created successfully`;\n return `${chalk.green(title)}\\n${capsuleOutput}`;\n }\n\n async json([componentIds]: [string[]], opts: CreateOpts) {\n // @ts-ignore\n const capsules = await this.create(componentIds, opts);\n return capsules.map((c) => ({\n id: c.component.id.toString(),\n path: c.path,\n }));\n }\n}\n\nexport class CapsuleListCmd implements Command {\n name = 'list';\n description = `list all capsules`;\n shortDescription = 'list all capsules';\n group = 'capsules';\n alias = '';\n options = [['j', 'json', 'json format']] as CommandOptions;\n\n constructor(private isolator: IsolatorMain, private workspace: Workspace) {}\n\n async report() {\n const list = await this.isolator.list(this.workspace.path);\n const { workspaceCapsulesRootDir, scopeCapsulesRootDir, scopeAspectsCapsulesRootDir } = this.getCapsulesRootDirs();\n // TODO: improve output\n return chalk.green(`found ${chalk.cyan(list.capsules.length.toString())} capsule(s) for workspace: ${chalk.cyan(\n list.workspace\n )}\nworkspace capsules root-dir: ${chalk.cyan(workspaceCapsulesRootDir)}\nscope capsules root-dir: ${chalk.cyan(scopeCapsulesRootDir)}\nscope's aspects capsules root-dir: ${chalk.cyan(scopeAspectsCapsulesRootDir)}\nuse --json to get the list of all workspace capsules`);\n }\n\n async json() {\n const list = await this.isolator.list(this.workspace.path);\n const rootDirs = this.getCapsulesRootDirs();\n return { ...list, ...rootDirs };\n }\n\n private getCapsulesRootDirs() {\n const workspaceCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.path);\n const scopeCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.path);\n const scopeAspectsCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.getAspectCapsulePath());\n\n return { workspaceCapsulesRootDir, scopeCapsulesRootDir, scopeAspectsCapsulesRootDir };\n }\n}\n\nexport class CapsuleCmd implements Command {\n name = 'capsule <sub-command>';\n shortDescription = 'manage capsules';\n description = `manage capsules.\na capsule is a directory contains the component code, isolated from the workspace.\nnormally, capsules are created during the build process, the component files are copied and the packages are installed\nvia the configured package-manager. the purpose is to compile/test them in isolation to make sure they will work for\nother users after publishing/exporting them.`;\n alias = '';\n group = 'capsules';\n commands: Command[] = [];\n options = [] as CommandOptions;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [string]) {\n // it should never be here. Yargs throws an error before reaching this method.\n return `Please specify a sub-command`;\n }\n}\n"]}
1
+ {"version":3,"sources":["capsule.cmd.ts"],"names":["CapsuleCreateCmd","constructor","workspace","isolator","create","componentIds","baseDir","rootBaseDir","alwaysNew","id","installPackages","seedersOnly","Array","isArray","capsuleOptions","installOptions","includeFromNestedHosts","name","ids","resolveMultipleComponentIds","network","isolateComponents","capsules","graphCapsules","report","opts","capsuleOutput","map","capsule","chalk","bold","component","toString","path","join","title","length","green","json","c","CapsuleListCmd","list","workspaceCapsulesRootDir","scopeCapsulesRootDir","scopeAspectsCapsulesRootDir","getCapsulesRootDirs","cyan","rootDirs","getCapsulesRootDir","scope","getAspectCapsulePath","CapsuleCmd","args"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAaO,MAAMA,gBAAN,CAA0C;AAoB/CC,EAAAA,WAAW,CAASC,SAAT,EAAuCC,QAAvC,EAA+D;AAAA,SAAtDD,SAAsD,GAAtDA,SAAsD;AAAA,SAAxBC,QAAwB,GAAxBA,QAAwB;AAAA,kDAnBnE,0BAmBmE;AAAA,yDAlB3D,iBAkB2D;AAAA,mDAjBlE,UAiBkE;AAAA,mDAhBlE,EAgBkE;AAAA,qDAfhE,CACR,CACE,GADF,EAEE,iBAFF,EAGE,yGAHF,CADQ,EAMR,CAAC,GAAD,EAAM,sBAAN,EAA8B,sEAA9B,CANQ,EAOR,CAAC,GAAD,EAAM,YAAN,EAAoB,oCAApB,CAPQ,EAQR,CAAC,GAAD,EAAM,cAAN,EAAsB,iEAAtB,CARQ,EASR,CAAC,GAAD,EAAM,WAAN,EAAmB,+BAAnB,CATQ,EAUR,CAAC,GAAD,EAAM,MAAN,EAAc,aAAd,CAVQ,EAWR,CAAC,GAAD,EAAM,kBAAN,EAA0B,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AAAA,qDAW/B,EAX+B;AAAA;;AAazC;AACY,QAAN3B,MAAM,CAAC4B,IAAD,EAAiB;AAC3B;AACA,WAAQ,8BAAR;AACD;;AAjBwC","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { CapsuleList, IsolateComponentsOptions, IsolatorMain } from '@teambit/isolator';\nimport chalk from 'chalk';\n\nimport { Workspace } from '.';\n\ntype CreateOpts = {\n baseDir?: string;\n rootBaseDir?: string;\n alwaysNew?: boolean;\n seedersOnly?: boolean;\n id: string;\n installPackages?: boolean;\n};\n\nexport class CapsuleCreateCmd implements Command {\n name = 'create [componentIds...]';\n description = `create capsules`;\n group = 'capsules';\n alias = '';\n options = [\n [\n 'b',\n 'base-dir <name>',\n 'set base dir of all capsules (hashed to create the base dir inside the root dir - host path by default)',\n ],\n ['r', 'root-base-dir <name>', 'set root base dir of all capsules (absolute path to use as root dir)'],\n ['a', 'always-new', 'create new environment for capsule'],\n ['s', 'seeders-only', 'create capsules for the seeders only (not for the entire graph)'],\n ['i', 'id <name>', 'reuse capsule of certain name'],\n ['j', 'json', 'json format'],\n ['d', 'install-packages', 'install packages by the package-manager'],\n ['p', 'package-manager <name>', 'npm, yarn or pnpm, default to npm'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace, private isolator: IsolatorMain) {}\n\n async create(\n [componentIds = []]: [string[]],\n { baseDir, rootBaseDir, alwaysNew = false, id, installPackages = false, seedersOnly = false }: CreateOpts\n ): Promise<CapsuleList> {\n // @todo: why it is not an array?\n if (componentIds && !Array.isArray(componentIds)) componentIds = [componentIds];\n const capsuleOptions: IsolateComponentsOptions = {\n baseDir,\n rootBaseDir,\n installOptions: { installPackages },\n alwaysNew,\n seedersOnly,\n includeFromNestedHosts: true,\n name: id,\n };\n const ids = await this.workspace.resolveMultipleComponentIds(componentIds);\n const network = await this.isolator.isolateComponents(ids, capsuleOptions);\n const capsules = network.graphCapsules;\n return capsules;\n }\n\n async report([componentIds]: [string[]], opts: CreateOpts) {\n // @ts-ignore\n const capsules = await this.create(componentIds, opts);\n const capsuleOutput = capsules\n .map((capsule) => `${chalk.bold(capsule.component.id.toString())} - ${capsule.path}`)\n .join('\\n');\n const title = `${capsules.length} capsule(s) were created successfully`;\n return `${chalk.green(title)}\\n${capsuleOutput}`;\n }\n\n async json([componentIds]: [string[]], opts: CreateOpts) {\n // @ts-ignore\n const capsules = await this.create(componentIds, opts);\n return capsules.map((c) => ({\n id: c.component.id.toString(),\n path: c.path,\n }));\n }\n}\n\nexport class CapsuleListCmd implements Command {\n name = 'list';\n description = `list all capsules`;\n shortDescription = 'list all capsules';\n group = 'capsules';\n alias = '';\n options = [['j', 'json', 'json format']] as CommandOptions;\n\n constructor(private isolator: IsolatorMain, private workspace: Workspace) {}\n\n async report() {\n const list = await this.isolator.list(this.workspace.path);\n const { workspaceCapsulesRootDir, scopeCapsulesRootDir, scopeAspectsCapsulesRootDir } = this.getCapsulesRootDirs();\n // TODO: improve output\n return chalk.green(`found ${chalk.cyan(list.capsules.length.toString())} capsule(s) for workspace: ${chalk.cyan(\n list.workspace\n )}\nworkspace capsules root-dir: ${chalk.cyan(workspaceCapsulesRootDir)}\nscope capsules root-dir: ${chalk.cyan(scopeCapsulesRootDir)}\nscope's aspects capsules root-dir: ${chalk.cyan(scopeAspectsCapsulesRootDir)}\nuse --json to get the list of all workspace capsules`);\n }\n\n async json() {\n const list = await this.isolator.list(this.workspace.path);\n const rootDirs = this.getCapsulesRootDirs();\n return { ...list, ...rootDirs };\n }\n\n private getCapsulesRootDirs() {\n const workspaceCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.path);\n const scopeCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.path);\n const scopeAspectsCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.getAspectCapsulePath());\n\n return { workspaceCapsulesRootDir, scopeCapsulesRootDir, scopeAspectsCapsulesRootDir };\n }\n}\n\nexport class CapsuleCmd implements Command {\n name = 'capsule <sub-command>';\n shortDescription = 'manage capsules';\n description = `manage capsules.\na capsule is a directory contains the component code, isolated from the workspace.\nnormally, capsules are created during the build process, the component files are copied and the packages are installed\nvia the configured package-manager. the purpose is to compile/test them in isolation to make sure they will work for\nother users after publishing/exporting them.`;\n alias = '';\n group = 'capsules';\n commands: Command[] = [];\n options = [] as CommandOptions;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [string]) {\n // it should never be here. Yargs throws an error before reaching this method.\n return `Please specify a sub-command`;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.523",
3
+ "version": "0.0.527",
4
4
  "homepage": "https://bit.dev/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "0.0.523"
9
+ "version": "0.0.527"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -32,54 +32,54 @@
32
32
  "@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
33
33
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
34
34
  "@teambit/base-ui.graph.tree.recursive-tree": "1.0.0",
35
- "@teambit/cli": "0.0.379",
36
- "@teambit/isolator": "0.0.523",
37
- "@teambit/component-tree": "0.0.365",
38
- "@teambit/component.ui.component-status-resolver": "0.0.449",
39
- "@teambit/harmony.modules.resolved-component": "0.0.443",
40
- "@teambit/dependency-resolver": "0.0.523",
41
- "@teambit/logger": "0.0.449",
42
- "@teambit/compiler": "0.0.523",
43
- "@teambit/component": "0.0.523",
44
- "@teambit/graphql": "0.0.523",
45
- "@teambit/aspect-loader": "0.0.523",
46
- "@teambit/bundler": "0.0.523",
47
- "@teambit/envs": "0.0.523",
48
- "@teambit/pubsub": "0.0.523",
49
- "@teambit/scope": "0.0.523",
50
- "@teambit/ui": "0.0.523",
51
- "@teambit/variants": "0.0.451",
52
- "@teambit/legacy-bit-id": "0.0.368",
53
- "@teambit/bit-error": "0.0.365",
54
- "@teambit/component-issues": "0.0.14",
55
- "@teambit/config": "0.0.390",
56
- "@teambit/harmony.modules.requireable-component": "0.0.443",
57
- "@teambit/workspace.modules.match-pattern": "0.0.445",
58
- "@teambit/command-bar": "0.0.523",
59
- "@teambit/design.ui.surfaces.menu.link-item": "0.0.373",
60
- "@teambit/graph": "0.0.523",
61
- "@teambit/react-router": "0.0.523",
62
- "@teambit/sidebar": "0.0.523",
63
- "@teambit/ui-foundation.ui.main-dropdown": "0.0.445",
64
- "@teambit/ui-foundation.ui.menu": "0.0.445",
65
- "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.447",
66
- "@teambit/toolbox.time.time-format": "0.0.442",
67
- "@teambit/component-id": "0.0.369",
68
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.446",
69
- "@teambit/deprecation": "0.0.523",
70
- "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.445",
71
- "@teambit/ui-foundation.ui.buttons.collapser": "0.0.150",
72
- "@teambit/ui-foundation.ui.corner": "0.0.452",
73
- "@teambit/ui-foundation.ui.notifications.notification-context": "0.0.446",
74
- "@teambit/ui-foundation.ui.top-bar": "0.0.447",
75
- "@teambit/design.ui.styles.ellipsis": "0.0.345",
76
- "@teambit/design.ui.styles.muted-italic": "0.0.34",
77
- "@teambit/ui-foundation.ui.full-loader": "0.0.445",
78
- "@teambit/ui-foundation.ui.side-bar": "0.0.449",
79
- "@teambit/ui-foundation.ui.tree.drawer": "0.0.445",
80
- "@teambit/explorer.ui.gallery.component-grid": "0.0.445",
81
- "@teambit/workspace.ui.empty-workspace": "0.0.447",
82
- "@teambit/workspace.ui.workspace-component-card": "0.0.448"
35
+ "@teambit/cli": "0.0.380",
36
+ "@teambit/isolator": "0.0.527",
37
+ "@teambit/component-tree": "0.0.366",
38
+ "@teambit/component.ui.component-status-resolver": "0.0.452",
39
+ "@teambit/harmony.modules.resolved-component": "0.0.446",
40
+ "@teambit/dependency-resolver": "0.0.527",
41
+ "@teambit/logger": "0.0.453",
42
+ "@teambit/compiler": "0.0.527",
43
+ "@teambit/component": "0.0.527",
44
+ "@teambit/graphql": "0.0.527",
45
+ "@teambit/aspect-loader": "0.0.527",
46
+ "@teambit/bundler": "0.0.527",
47
+ "@teambit/envs": "0.0.527",
48
+ "@teambit/pubsub": "0.0.527",
49
+ "@teambit/scope": "0.0.527",
50
+ "@teambit/ui": "0.0.527",
51
+ "@teambit/variants": "0.0.455",
52
+ "@teambit/legacy-bit-id": "0.0.369",
53
+ "@teambit/bit-error": "0.0.366",
54
+ "@teambit/component-issues": "0.0.15",
55
+ "@teambit/config": "0.0.391",
56
+ "@teambit/harmony.modules.requireable-component": "0.0.446",
57
+ "@teambit/workspace.modules.match-pattern": "0.0.448",
58
+ "@teambit/command-bar": "0.0.527",
59
+ "@teambit/design.ui.surfaces.menu.link-item": "0.0.374",
60
+ "@teambit/graph": "0.0.527",
61
+ "@teambit/react-router": "0.0.527",
62
+ "@teambit/sidebar": "0.0.527",
63
+ "@teambit/ui-foundation.ui.main-dropdown": "0.0.448",
64
+ "@teambit/ui-foundation.ui.menu": "0.0.448",
65
+ "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.450",
66
+ "@teambit/toolbox.time.time-format": "0.0.445",
67
+ "@teambit/component-id": "0.0.370",
68
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.449",
69
+ "@teambit/deprecation": "0.0.527",
70
+ "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.448",
71
+ "@teambit/ui-foundation.ui.buttons.collapser": "0.0.153",
72
+ "@teambit/ui-foundation.ui.corner": "0.0.455",
73
+ "@teambit/ui-foundation.ui.notifications.notification-context": "0.0.449",
74
+ "@teambit/ui-foundation.ui.top-bar": "0.0.450",
75
+ "@teambit/design.ui.styles.ellipsis": "0.0.346",
76
+ "@teambit/design.ui.styles.muted-italic": "0.0.35",
77
+ "@teambit/ui-foundation.ui.full-loader": "0.0.448",
78
+ "@teambit/ui-foundation.ui.side-bar": "0.0.452",
79
+ "@teambit/ui-foundation.ui.tree.drawer": "0.0.448",
80
+ "@teambit/explorer.ui.gallery.component-grid": "0.0.448",
81
+ "@teambit/workspace.ui.empty-workspace": "0.0.450",
82
+ "@teambit/workspace.ui.workspace-component-card": "0.0.451"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/react": "^17.0.8",
@@ -101,7 +101,7 @@
101
101
  "react-dom": "^16.8.0 || ^17.0.0",
102
102
  "react": "^16.8.0 || ^17.0.0"
103
103
  },
104
- "license": "SEE LICENSE IN LICENSE",
104
+ "license": "Apache-2.0",
105
105
  "bit": {
106
106
  "bindingPrefix": "@teambit",
107
107
  "env": {},