@teambit/workspace 0.0.650 → 0.0.651
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/{__preview-1645068215823.js → __preview-1645365357220.js} +0 -0
- package/dist/capsule.cmd.d.ts +0 -1
- package/dist/capsule.cmd.js +0 -4
- package/dist/capsule.cmd.js.map +1 -1
- package/dist/eject-conf.cmd.js +1 -1
- package/dist/eject-conf.cmd.js.map +1 -1
- package/dist/ui/workspace/workspace-model.d.ts +10 -1
- package/dist/ui/workspace/workspace-model.js +25 -3
- package/dist/ui/workspace/workspace-model.js.map +1 -1
- package/eject-conf.cmd.tsx +1 -1
- package/package-tar/teambit-workspace-0.0.651.tgz +0 -0
- package/package.json +50 -49
- package/ui/workspace/workspace-model.ts +14 -3
- package/package-tar/teambit-workspace-0.0.650.tgz +0 -0
|
File without changes
|
package/dist/capsule.cmd.d.ts
CHANGED
|
@@ -38,7 +38,6 @@ export declare class CapsuleListCmd implements Command {
|
|
|
38
38
|
report(): Promise<string>;
|
|
39
39
|
json(): Promise<{
|
|
40
40
|
workspaceCapsulesRootDir: string;
|
|
41
|
-
scopeCapsulesRootDir: string;
|
|
42
41
|
scopeAspectsCapsulesRootDir: string;
|
|
43
42
|
workspace: string;
|
|
44
43
|
capsules: string[];
|
package/dist/capsule.cmd.js
CHANGED
|
@@ -110,13 +110,11 @@ class CapsuleListCmd {
|
|
|
110
110
|
const list = await this.isolator.list(this.workspace.path);
|
|
111
111
|
const {
|
|
112
112
|
workspaceCapsulesRootDir,
|
|
113
|
-
scopeCapsulesRootDir,
|
|
114
113
|
scopeAspectsCapsulesRootDir
|
|
115
114
|
} = this.getCapsulesRootDirs(); // TODO: improve output
|
|
116
115
|
|
|
117
116
|
return _chalk().default.green(`found ${_chalk().default.cyan(list.capsules.length.toString())} capsule(s) for workspace: ${_chalk().default.cyan(list.workspace)}
|
|
118
117
|
workspace capsules root-dir: ${_chalk().default.cyan(workspaceCapsulesRootDir)}
|
|
119
|
-
scope capsules root-dir: ${_chalk().default.cyan(scopeCapsulesRootDir)}
|
|
120
118
|
scope's aspects capsules root-dir: ${_chalk().default.cyan(scopeAspectsCapsulesRootDir)}
|
|
121
119
|
use --json to get the list of all workspace capsules`);
|
|
122
120
|
}
|
|
@@ -129,11 +127,9 @@ use --json to get the list of all workspace capsules`);
|
|
|
129
127
|
|
|
130
128
|
getCapsulesRootDirs() {
|
|
131
129
|
const workspaceCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.path);
|
|
132
|
-
const scopeCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.path);
|
|
133
130
|
const scopeAspectsCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.getAspectCapsulePath());
|
|
134
131
|
return {
|
|
135
132
|
workspaceCapsulesRootDir,
|
|
136
|
-
scopeCapsulesRootDir,
|
|
137
133
|
scopeAspectsCapsulesRootDir
|
|
138
134
|
};
|
|
139
135
|
}
|
package/dist/capsule.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","CapsuleDeleteCmd","args","all","scopeAspects","capsuleBaseDirToDelete","capsuleBaseDir","deletedDir","deleteCapsules","CapsuleCmd"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAaO,MAAMA,gBAAN,CAA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zB;AACA,WAAO3B,iBAAMQ,KAAN,CAAa,+CAA8CR,iBAAMC,IAAN,CAAW2B,UAAX,CAAuB,EAAlF,CAAP;AACD;;AAtB8C;;;;AAyB1C,MAAME,UAAN,CAAoC;AAAA;AAAA,kDAClC,uBADkC;AAAA,8DAEtB,iBAFsB;AAAA,yDAG1B;AACjB;AACA;AACA;AACA,6CAP2C;AAAA,mDAQjC,EARiC;AAAA,mDASjC,UATiC;AAAA,sDAUnB,EAVmB;AAAA,qDAW/B,EAX+B;AAAA;;AAazC;AACY,QAANnC,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 CapsuleDeleteCmd implements Command {\n name = 'delete';\n description = `delete capsules. with no args, only workspace's capsules are deleted`;\n shortDescription = `delete capsules`;\n group = 'capsules';\n alias = '';\n options = [\n ['', 'scope-aspects', 'delete scope-aspects capsules'],\n ['a', 'all', 'delete all capsules for all workspaces and scopes'],\n ] as CommandOptions;\n\n constructor(private isolator: IsolatorMain, private workspace: Workspace) {}\n\n async report(args: [], { all, scopeAspects }: { all: boolean; scopeAspects: boolean }) {\n const capsuleBaseDirToDelete = (): string | null => {\n if (all) return null;\n if (scopeAspects) return this.workspace.scope.getAspectCapsulePath();\n return this.workspace.path;\n };\n const capsuleBaseDir = capsuleBaseDirToDelete();\n const deletedDir = await this.isolator.deleteCapsules(capsuleBaseDir);\n return chalk.green(`the following capsules dir has been deleted ${chalk.bold(deletedDir)}`);\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","scopeAspectsCapsulesRootDir","getCapsulesRootDirs","cyan","rootDirs","getCapsulesRootDir","scope","getAspectCapsulePath","CapsuleDeleteCmd","args","all","scopeAspects","capsuleBaseDirToDelete","capsuleBaseDir","deletedDir","deleteCapsules","CapsuleCmd"],"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,yCAA1B,CAXQ,EAYR,CAAC,GAAD,EAAM,wBAAN,EAAgC,mCAAhC,CAZQ,CAegE;AAAE;;AAEhE,QAANC,MAAM,CACV,CAACC,YAAY,GAAG,EAAhB,CADU,EAEV;AAA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,EAAS,OAAO,IAAP;AACT,UAAIC,YAAJ,EAAkB,OAAO,KAAKnD,SAAL,CAAe8C,KAAf,CAAqBC,oBAArB,EAAP;AAClB,aAAO,KAAK/C,SAAL,CAAe+B,IAAtB;AACD,KAJD;;AAKA,UAAMsB,cAAc,GAAGD,sBAAsB,EAA7C;AACA,UAAME,UAAU,GAAG,MAAM,KAAKrD,QAAL,CAAcsD,cAAd,CAA6BF,cAA7B,CAAzB;AACA,WAAO1B,iBAAMQ,KAAN,CAAa,+CAA8CR,iBAAMC,IAAN,CAAW0B,UAAX,CAAuB,EAAlF,CAAP;AACD;;AAtB8C;;;;AAyB1C,MAAME,UAAN,CAAoC;AAAA;AAAA,kDAClC,uBADkC;AAAA,8DAEtB,iBAFsB;AAAA,yDAG1B;AACjB;AACA;AACA;AACA,6CAP2C;AAAA,mDAQjC,EARiC;AAAA,mDASjC,UATiC;AAAA,sDAUnB,EAVmB;AAAA,qDAW/B,EAX+B;AAAA;;AAazC;AACY,QAANlC,MAAM,CAAC2B,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, 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'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 scopeAspectsCapsulesRootDir = this.isolator.getCapsulesRootDir(this.workspace.scope.getAspectCapsulePath());\n\n return { workspaceCapsulesRootDir, scopeAspectsCapsulesRootDir };\n }\n}\n\nexport class CapsuleDeleteCmd implements Command {\n name = 'delete';\n description = `delete capsules. with no args, only workspace's capsules are deleted`;\n shortDescription = `delete capsules`;\n group = 'capsules';\n alias = '';\n options = [\n ['', 'scope-aspects', 'delete scope-aspects capsules'],\n ['a', 'all', 'delete all capsules for all workspaces and scopes'],\n ] as CommandOptions;\n\n constructor(private isolator: IsolatorMain, private workspace: Workspace) {}\n\n async report(args: [], { all, scopeAspects }: { all: boolean; scopeAspects: boolean }) {\n const capsuleBaseDirToDelete = (): string | null => {\n if (all) return null;\n if (scopeAspects) return this.workspace.scope.getAspectCapsulePath();\n return this.workspace.path;\n };\n const capsuleBaseDir = capsuleBaseDirToDelete();\n const deletedDir = await this.isolator.deleteCapsules(capsuleBaseDir);\n return chalk.green(`the following capsules dir has been deleted ${chalk.bold(deletedDir)}`);\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/dist/eject-conf.cmd.js
CHANGED
|
@@ -68,7 +68,7 @@ class EjectConfCmd {
|
|
|
68
68
|
const ejectResult = await this.json(args, options);
|
|
69
69
|
const [componentId] = args;
|
|
70
70
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
71
|
-
color: "
|
|
71
|
+
color: "green"
|
|
72
72
|
}, "successfully ejected config for component ", componentId, " in path ", ejectResult.configPath);
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["eject-conf.cmd.tsx"],"names":["EjectConfCmd","constructor","workspace","render","args","options","ejectResult","json","componentId","configPath","report","chalk","bold","green","ejectOptions","propagate","override","id","resolveComponentId","results","ejectConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWe,MAAMA,YAAN,CAAsC;AAWnDC,EAAAA,WAAW,CAASC,SAAT,EAA+B;AAAA,SAAtBA,SAAsB,GAAtBA,SAAsB;AAAA,kDAVnC,iBAUmC;AAAA,yDAT5B,mCAS4B;AAAA,mDARlC,EAQkC;AAAA,mDAPlC,aAOkC;AAAA,8DANvB,qFAMuB;AAAA,qDALhC,CACR,CAAC,GAAD,EAAM,WAAN,EAAmB,wCAAnB,CADQ,EAER,CAAC,GAAD,EAAM,UAAN,EAAkB,wBAAlB,CAFQ,CAKgC;AAAE,GAXO,CAanD;AACA;;;AACY,QAANC,MAAM,CAACC,IAAD,EAAsBC,OAAtB,EAAoD;AAC9D,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,wBACE,+BAAC,WAAD;AAAM,MAAA,KAAK,EAAC;AAAZ,qDAC6CI,WAD7C,eACmEF,WAAW,CAACG,UAD/E,CADF;AAKD;;AAEW,QAANC,MAAM,CAACN,IAAD,EAAsBC,OAAtB,EAAqE;AAC/E,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,WAAQ,6CAA4CO,iBAAMC,IAAN,CAAWJ,WAAX,CAAwB,YAAWG,iBAAME,KAAN,CACrFP,WAAW,CAACG,UADyE,CAErF,EAFF;AAGD;;AAES,QAAJF,IAAI,CAAC,CAACC,WAAD,CAAD,EAA+BH,OAA/B,EAAuF;AAC/F,UAAMS,YAAY,GAAGT,OAArB;;AACA,QAAIS,YAAY,CAACC,SAAb,KAA2B,MAA/B,EAAuC;AACrCD,MAAAA,YAAY,CAACC,SAAb,GAAyB,IAAzB;AACD;;AACD,QAAID,YAAY,CAACE,QAAb,KAA0B,MAA9B,EAAsC;AACpCF,MAAAA,YAAY,CAACE,QAAb,GAAwB,IAAxB;AACD;;AAED,UAAMC,EAAE,GAAG,MAAM,KAAKf,SAAL,CAAegB,kBAAf,CAAkCV,WAAlC,CAAjB;AAEA,UAAMW,OAAO,GAAG,MAAM,KAAKjB,SAAL,CAAekB,WAAf,CAA2BH,EAA3B,EAA+BH,YAA/B,CAAtB;AACA,WAAOK,OAAP;AACD;;AA9CkD","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Text } from 'ink';\nimport React from 'react';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf [id]';\n description = 'ejecting components configuration';\n alias = '';\n group = 'development';\n shortDescription = 'eject the target component configuration file (e.g. create a `component.json` file)';\n options = [\n ['p', 'propagate', 'mark propagate true in the config file'],\n ['o', 'override', 'override file if exist'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n // TODO: remove this ts-ignore\n // @ts-ignore\n async render(args: EjectConfArgs, options: EjectConfOptionsCLI) {\n const ejectResult = await this.json(args, options);\n const [componentId] = args;\n return (\n <Text color=\"
|
|
1
|
+
{"version":3,"sources":["eject-conf.cmd.tsx"],"names":["EjectConfCmd","constructor","workspace","render","args","options","ejectResult","json","componentId","configPath","report","chalk","bold","green","ejectOptions","propagate","override","id","resolveComponentId","results","ejectConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWe,MAAMA,YAAN,CAAsC;AAWnDC,EAAAA,WAAW,CAASC,SAAT,EAA+B;AAAA,SAAtBA,SAAsB,GAAtBA,SAAsB;AAAA,kDAVnC,iBAUmC;AAAA,yDAT5B,mCAS4B;AAAA,mDARlC,EAQkC;AAAA,mDAPlC,aAOkC;AAAA,8DANvB,qFAMuB;AAAA,qDALhC,CACR,CAAC,GAAD,EAAM,WAAN,EAAmB,wCAAnB,CADQ,EAER,CAAC,GAAD,EAAM,UAAN,EAAkB,wBAAlB,CAFQ,CAKgC;AAAE,GAXO,CAanD;AACA;;;AACY,QAANC,MAAM,CAACC,IAAD,EAAsBC,OAAtB,EAAoD;AAC9D,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,wBACE,+BAAC,WAAD;AAAM,MAAA,KAAK,EAAC;AAAZ,qDAC6CI,WAD7C,eACmEF,WAAW,CAACG,UAD/E,CADF;AAKD;;AAEW,QAANC,MAAM,CAACN,IAAD,EAAsBC,OAAtB,EAAqE;AAC/E,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,WAAQ,6CAA4CO,iBAAMC,IAAN,CAAWJ,WAAX,CAAwB,YAAWG,iBAAME,KAAN,CACrFP,WAAW,CAACG,UADyE,CAErF,EAFF;AAGD;;AAES,QAAJF,IAAI,CAAC,CAACC,WAAD,CAAD,EAA+BH,OAA/B,EAAuF;AAC/F,UAAMS,YAAY,GAAGT,OAArB;;AACA,QAAIS,YAAY,CAACC,SAAb,KAA2B,MAA/B,EAAuC;AACrCD,MAAAA,YAAY,CAACC,SAAb,GAAyB,IAAzB;AACD;;AACD,QAAID,YAAY,CAACE,QAAb,KAA0B,MAA9B,EAAsC;AACpCF,MAAAA,YAAY,CAACE,QAAb,GAAwB,IAAxB;AACD;;AAED,UAAMC,EAAE,GAAG,MAAM,KAAKf,SAAL,CAAegB,kBAAf,CAAkCV,WAAlC,CAAjB;AAEA,UAAMW,OAAO,GAAG,MAAM,KAAKjB,SAAL,CAAekB,WAAf,CAA2BH,EAA3B,EAA+BH,YAA/B,CAAtB;AACA,WAAOK,OAAP;AACD;;AA9CkD","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Text } from 'ink';\nimport React from 'react';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf [id]';\n description = 'ejecting components configuration';\n alias = '';\n group = 'development';\n shortDescription = 'eject the target component configuration file (e.g. create a `component.json` file)';\n options = [\n ['p', 'propagate', 'mark propagate true in the config file'],\n ['o', 'override', 'override file if exist'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n // TODO: remove this ts-ignore\n // @ts-ignore\n async render(args: EjectConfArgs, options: EjectConfOptionsCLI) {\n const ejectResult = await this.json(args, options);\n const [componentId] = args;\n return (\n <Text color=\"green\">\n successfully ejected config for component {componentId} in path {ejectResult.configPath}\n </Text>\n );\n }\n\n async report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string> {\n const ejectResult = await this.json(args, options);\n const [componentId] = args;\n return `successfully ejected config for component ${chalk.bold(componentId)} in path ${chalk.green(\n ejectResult.configPath\n )}`;\n }\n\n async json([componentId]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult> {\n const ejectOptions = options;\n if (ejectOptions.propagate === 'true') {\n ejectOptions.propagate = true;\n }\n if (ejectOptions.override === 'true') {\n ejectOptions.override = true;\n }\n\n const id = await this.workspace.resolveComponentId(componentId);\n\n const results = await this.workspace.ejectConfig(id, ejectOptions as EjectConfOptions);\n return results;\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';
|
|
2
|
+
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
2
3
|
import { DeprecationInfo } from '@teambit/deprecation';
|
|
3
4
|
import { Descriptor } from '@teambit/envs';
|
|
4
5
|
import { ComponentStatus } from '../../workspace-component/component-status';
|
|
@@ -31,6 +32,10 @@ export declare class Workspace {
|
|
|
31
32
|
* components container in the workspace.
|
|
32
33
|
*/
|
|
33
34
|
readonly components: ComponentModel[];
|
|
35
|
+
/**
|
|
36
|
+
* components contained in the workspace.
|
|
37
|
+
*/
|
|
38
|
+
readonly componentDescriptors: ComponentDescriptor[];
|
|
34
39
|
constructor(
|
|
35
40
|
/**
|
|
36
41
|
* name of the workspace.
|
|
@@ -47,7 +52,11 @@ export declare class Workspace {
|
|
|
47
52
|
/**
|
|
48
53
|
* components container in the workspace.
|
|
49
54
|
*/
|
|
50
|
-
components: ComponentModel[]
|
|
55
|
+
components: ComponentModel[],
|
|
56
|
+
/**
|
|
57
|
+
* components contained in the workspace.
|
|
58
|
+
*/
|
|
59
|
+
componentDescriptors: ComponentDescriptor[]);
|
|
51
60
|
/**
|
|
52
61
|
* return a component from the workspace.
|
|
53
62
|
*/
|
|
@@ -15,6 +15,16 @@ function _component() {
|
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function _componentDescriptor() {
|
|
19
|
+
const data = require("@teambit/component-descriptor");
|
|
20
|
+
|
|
21
|
+
_componentDescriptor = function () {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
// import { ComponentMeta } from '@teambit/component';
|
|
19
29
|
class Workspace {
|
|
20
30
|
constructor(
|
|
@@ -33,11 +43,16 @@ class Workspace {
|
|
|
33
43
|
/**
|
|
34
44
|
* components container in the workspace.
|
|
35
45
|
*/
|
|
36
|
-
components
|
|
46
|
+
components,
|
|
47
|
+
/**
|
|
48
|
+
* components contained in the workspace.
|
|
49
|
+
*/
|
|
50
|
+
componentDescriptors) {
|
|
37
51
|
this.name = name;
|
|
38
52
|
this.path = path;
|
|
39
53
|
this.icon = icon;
|
|
40
54
|
this.components = components;
|
|
55
|
+
this.componentDescriptors = componentDescriptors;
|
|
41
56
|
}
|
|
42
57
|
/**
|
|
43
58
|
* return a component from the workspace.
|
|
@@ -54,13 +69,20 @@ class Workspace {
|
|
|
54
69
|
components,
|
|
55
70
|
icon
|
|
56
71
|
}) {
|
|
72
|
+
const componentDescriptors = components.map(component => {
|
|
73
|
+
const id = _component().ComponentID.fromObject(component.id);
|
|
74
|
+
|
|
75
|
+
return _componentDescriptor().ComponentDescriptor.fromObject({
|
|
76
|
+
id: id.toString()
|
|
77
|
+
});
|
|
78
|
+
});
|
|
57
79
|
return new Workspace(name, path, icon, components.map(value => {
|
|
58
80
|
return _component().ComponentModel.from(value);
|
|
59
|
-
}));
|
|
81
|
+
}), componentDescriptors);
|
|
60
82
|
}
|
|
61
83
|
|
|
62
84
|
static empty() {
|
|
63
|
-
return new Workspace('', '', '', []);
|
|
85
|
+
return new Workspace('', '', '', [], []);
|
|
64
86
|
}
|
|
65
87
|
|
|
66
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["workspace-model.ts"],"names":["Workspace","constructor","name","path","icon","components","getComponent","id","find","component","fullName","from","map","value","ComponentModel","empty"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;
|
|
1
|
+
{"version":3,"sources":["workspace-model.ts"],"names":["Workspace","constructor","name","path","icon","components","componentDescriptors","getComponent","id","find","component","fullName","from","map","ComponentID","fromObject","ComponentDescriptor","toString","value","ComponentModel","empty"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAFA;AAsBO,MAAMA,SAAN,CAAgB;AACrBC,EAAAA,WAAW;AACT;AACJ;AACA;AACaC,EAAAA,IAJA;AAMT;AACJ;AACA;AACaC,EAAAA,IATA;AAWT;AACJ;AACA;AACaC,EAAAA,IAdA;AAgBT;AACJ;AACA;AACaC,EAAAA,UAnBA;AAqBT;AACJ;AACA;AACaC,EAAAA,oBAxBA,EAyBT;AAAA,SArBSJ,IAqBT,GArBSA,IAqBT;AAAA,SAhBSC,IAgBT,GAhBSA,IAgBT;AAAA,SAXSC,IAWT,GAXSA,IAWT;AAAA,SANSC,UAMT,GANSA,UAMT;AAAA,SADSC,oBACT,GADSA,oBACT;AAAE;AAEJ;AACF;AACA;;;AACEC,EAAAA,YAAY,CAACC,EAAD,EAAkB;AAC5B,WAAO,KAAKH,UAAL,CAAgBI,IAAhB,CAAsBC,SAAD,IAAeA,SAAS,CAACF,EAAV,CAAaG,QAAb,KAA0BH,EAAE,CAACG,QAAjE,CAAP;AACD;;AAEU,SAAJC,IAAI,CAAC;AAAEV,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcE,IAAAA,UAAd;AAA0BD,IAAAA;AAA1B,GAAD,EAAmD;AAC5D,UAAME,oBAAoB,GAAGD,UAAU,CAACQ,GAAX,CAAgBH,SAAD,IAAe;AACzD,YAAMF,EAAE,GAAGM,yBAAYC,UAAZ,CAAuBL,SAAS,CAACF,EAAjC,CAAX;;AACA,aAAOQ,2CAAoBD,UAApB,CAA+B;AAAEP,QAAAA,EAAE,EAAEA,EAAE,CAACS,QAAH;AAAN,OAA/B,CAAP;AACD,KAH4B,CAA7B;AAIA,WAAO,IAAIjB,SAAJ,CACLE,IADK,EAELC,IAFK,EAGLC,IAHK,EAILC,UAAU,CAACQ,GAAX,CAAgBK,KAAD,IAAW;AACxB,aAAOC,4BAAeP,IAAf,CAAoBM,KAApB,CAAP;AACD,KAFD,CAJK,EAOLZ,oBAPK,CAAP;AASD;;AAEW,SAALc,KAAK,GAAG;AACb,WAAO,IAAIpB,SAAJ,CAAc,EAAd,EAAkB,EAAlB,EAAsB,EAAtB,EAA0B,EAA1B,EAA8B,EAA9B,CAAP;AACD;;AArDoB","sourcesContent":["// import { ComponentMeta } from '@teambit/component';\nimport { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\n\nimport { ComponentStatus } from '../../workspace-component/component-status';\n\nexport type WorkspaceModelComponent = {\n id: ComponentID;\n status: ComponentStatus;\n deprecation: DeprecationInfo;\n env: Descriptor;\n};\n\nexport type WorkspaceProps = {\n name: string;\n path: string;\n components: ComponentModelProps[];\n icon: string;\n};\n\nexport class Workspace {\n constructor(\n /**\n * name of the workspace.\n */\n readonly name: string,\n\n /**\n * absolute path of the workspace.\n */\n readonly path: string,\n\n /**\n * icon of the workspace.\n */\n readonly icon: string,\n\n /**\n * components container in the workspace.\n */\n readonly components: ComponentModel[],\n\n /**\n * components contained in the workspace.\n */\n readonly componentDescriptors: ComponentDescriptor[]\n ) {}\n\n /**\n * return a component from the workspace.\n */\n getComponent(id: ComponentID) {\n return this.components.find((component) => component.id.fullName === id.fullName);\n }\n\n static from({ name, path, components, icon }: WorkspaceProps) {\n const componentDescriptors = components.map((component) => {\n const id = ComponentID.fromObject(component.id);\n return ComponentDescriptor.fromObject({ id: id.toString() });\n });\n return new Workspace(\n name,\n path,\n icon,\n components.map((value) => {\n return ComponentModel.from(value);\n }),\n componentDescriptors\n );\n }\n\n static empty() {\n return new Workspace('', '', '', [], []);\n }\n}\n"]}
|
package/eject-conf.cmd.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export default class EjectConfCmd implements Command {
|
|
|
31
31
|
const ejectResult = await this.json(args, options);
|
|
32
32
|
const [componentId] = args;
|
|
33
33
|
return (
|
|
34
|
-
<Text color="
|
|
34
|
+
<Text color="green">
|
|
35
35
|
successfully ejected config for component {componentId} in path {ejectResult.configPath}
|
|
36
36
|
</Text>
|
|
37
37
|
);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.651",
|
|
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.
|
|
9
|
+
"version": "0.0.651"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -41,53 +41,54 @@
|
|
|
41
41
|
"@teambit/component-id": "0.0.401",
|
|
42
42
|
"@teambit/bit-error": "0.0.394",
|
|
43
43
|
"@teambit/legacy-bit-id": "0.0.398",
|
|
44
|
-
"@teambit/logger": "0.0.
|
|
45
|
-
"@teambit/scope": "0.0.
|
|
46
|
-
"@teambit/cli": "0.0.
|
|
47
|
-
"@teambit/isolator": "0.0.
|
|
48
|
-
"@teambit/component-tree": "0.0.
|
|
49
|
-
"@teambit/component.ui.component-status-resolver": "0.0.
|
|
50
|
-
"@teambit/harmony.modules.resolved-component": "0.0.
|
|
51
|
-
"@teambit/dependency-resolver": "0.0.
|
|
52
|
-
"@teambit/compiler": "0.0.
|
|
53
|
-
"@teambit/component": "0.0.
|
|
54
|
-
"@teambit/graphql": "0.0.
|
|
55
|
-
"@teambit/aspect-loader": "0.0.
|
|
56
|
-
"@teambit/bundler": "0.0.
|
|
57
|
-
"@teambit/envs": "0.0.
|
|
58
|
-
"@teambit/pubsub": "0.0.
|
|
59
|
-
"@teambit/ui": "0.0.
|
|
60
|
-
"@teambit/variants": "0.0.
|
|
44
|
+
"@teambit/logger": "0.0.535",
|
|
45
|
+
"@teambit/scope": "0.0.651",
|
|
46
|
+
"@teambit/cli": "0.0.445",
|
|
47
|
+
"@teambit/isolator": "0.0.651",
|
|
48
|
+
"@teambit/component-tree": "0.0.439",
|
|
49
|
+
"@teambit/component.ui.component-status-resolver": "0.0.491",
|
|
50
|
+
"@teambit/harmony.modules.resolved-component": "0.0.484",
|
|
51
|
+
"@teambit/dependency-resolver": "0.0.651",
|
|
52
|
+
"@teambit/compiler": "0.0.651",
|
|
53
|
+
"@teambit/component": "0.0.651",
|
|
54
|
+
"@teambit/graphql": "0.0.651",
|
|
55
|
+
"@teambit/aspect-loader": "0.0.651",
|
|
56
|
+
"@teambit/bundler": "0.0.651",
|
|
57
|
+
"@teambit/envs": "0.0.651",
|
|
58
|
+
"@teambit/pubsub": "0.0.651",
|
|
59
|
+
"@teambit/ui": "0.0.651",
|
|
60
|
+
"@teambit/variants": "0.0.538",
|
|
61
61
|
"@teambit/component-issues": "0.0.46",
|
|
62
|
-
"@teambit/config": "0.0.
|
|
63
|
-
"@teambit/harmony.modules.requireable-component": "0.0.
|
|
64
|
-
"@teambit/importer": "0.0.
|
|
65
|
-
"@teambit/workspace.modules.match-pattern": "0.0.
|
|
66
|
-
"@teambit/command-bar": "0.0.
|
|
67
|
-
"@teambit/design.ui.surfaces.menu.link-item": "0.0.
|
|
68
|
-
"@teambit/graph": "0.0.
|
|
69
|
-
"@teambit/react-router": "0.0.
|
|
70
|
-
"@teambit/sidebar": "0.0.
|
|
71
|
-
"@teambit/ui-foundation.ui.main-dropdown": "0.0.
|
|
72
|
-
"@teambit/ui-foundation.ui.menu": "0.0.
|
|
73
|
-
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.
|
|
74
|
-
"@teambit/toolbox.time.time-format": "0.0.
|
|
75
|
-
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.
|
|
76
|
-
"@teambit/
|
|
77
|
-
"@teambit/
|
|
78
|
-
"@teambit/ui-foundation.ui.
|
|
79
|
-
"@teambit/ui-foundation.ui.
|
|
80
|
-
"@teambit/ui-foundation.ui.
|
|
81
|
-
"@teambit/ui-foundation.ui.
|
|
62
|
+
"@teambit/config": "0.0.458",
|
|
63
|
+
"@teambit/harmony.modules.requireable-component": "0.0.484",
|
|
64
|
+
"@teambit/importer": "0.0.80",
|
|
65
|
+
"@teambit/workspace.modules.match-pattern": "0.0.489",
|
|
66
|
+
"@teambit/command-bar": "0.0.651",
|
|
67
|
+
"@teambit/design.ui.surfaces.menu.link-item": "0.0.378",
|
|
68
|
+
"@teambit/graph": "0.0.651",
|
|
69
|
+
"@teambit/react-router": "0.0.651",
|
|
70
|
+
"@teambit/sidebar": "0.0.651",
|
|
71
|
+
"@teambit/ui-foundation.ui.main-dropdown": "0.0.486",
|
|
72
|
+
"@teambit/ui-foundation.ui.menu": "0.0.486",
|
|
73
|
+
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.488",
|
|
74
|
+
"@teambit/toolbox.time.time-format": "0.0.483",
|
|
75
|
+
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487",
|
|
76
|
+
"@teambit/component-descriptor": "0.0.3",
|
|
77
|
+
"@teambit/deprecation": "0.0.651",
|
|
78
|
+
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487",
|
|
79
|
+
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.193",
|
|
80
|
+
"@teambit/ui-foundation.ui.corner": "0.0.494",
|
|
81
|
+
"@teambit/ui-foundation.ui.notifications.notification-context": "0.0.487",
|
|
82
|
+
"@teambit/ui-foundation.ui.top-bar": "0.0.489",
|
|
82
83
|
"@teambit/design.ui.styles.ellipsis": "0.0.347",
|
|
83
84
|
"@teambit/design.ui.styles.muted-italic": "0.0.35",
|
|
84
85
|
"@teambit/design.ui.tree": "0.0.5",
|
|
85
|
-
"@teambit/ui-foundation.ui.full-loader": "0.0.
|
|
86
|
-
"@teambit/ui-foundation.ui.side-bar": "0.0.
|
|
87
|
-
"@teambit/ui-foundation.ui.tree.drawer": "0.0.
|
|
88
|
-
"@teambit/explorer.ui.gallery.component-grid": "0.0.
|
|
89
|
-
"@teambit/workspace.ui.empty-workspace": "0.0.
|
|
90
|
-
"@teambit/workspace.ui.workspace-component-card": "0.0.
|
|
86
|
+
"@teambit/ui-foundation.ui.full-loader": "0.0.486",
|
|
87
|
+
"@teambit/ui-foundation.ui.side-bar": "0.0.497",
|
|
88
|
+
"@teambit/ui-foundation.ui.tree.drawer": "0.0.490",
|
|
89
|
+
"@teambit/explorer.ui.gallery.component-grid": "0.0.486",
|
|
90
|
+
"@teambit/workspace.ui.empty-workspace": "0.0.489",
|
|
91
|
+
"@teambit/workspace.ui.workspace-component-card": "0.0.493"
|
|
91
92
|
},
|
|
92
93
|
"devDependencies": {
|
|
93
94
|
"@types/lodash": "4.14.165",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"@types/react-router-dom": "5.1.7",
|
|
100
101
|
"@types/pluralize": "0.0.29",
|
|
101
102
|
"@types/classnames": "2.2.11",
|
|
102
|
-
"@types/mocha": "
|
|
103
|
+
"@types/mocha": "9.1.0",
|
|
103
104
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
104
105
|
"@types/jest": "^26.0.0",
|
|
105
106
|
"@types/react-dom": "^17.0.5",
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
},
|
|
108
109
|
"peerDependencies": {
|
|
109
110
|
"@apollo/client": "^3.0.0",
|
|
110
|
-
"@teambit/legacy": "1.0.
|
|
111
|
+
"@teambit/legacy": "1.0.223",
|
|
111
112
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
112
113
|
"react": "^16.8.0 || ^17.0.0"
|
|
113
114
|
},
|
|
@@ -125,7 +126,7 @@
|
|
|
125
126
|
},
|
|
126
127
|
"devDependencies": {
|
|
127
128
|
"@teambit/legacy": "-",
|
|
128
|
-
"@types/mocha": "
|
|
129
|
+
"@types/mocha": "9.1.0",
|
|
129
130
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
130
131
|
"@types/jest": "^26.0.0",
|
|
131
132
|
"@types/react-dom": "^17.0.5",
|
|
@@ -135,7 +136,7 @@
|
|
|
135
136
|
"react": "-"
|
|
136
137
|
},
|
|
137
138
|
"peerDependencies": {
|
|
138
|
-
"@teambit/legacy": "1.0.
|
|
139
|
+
"@teambit/legacy": "1.0.223",
|
|
139
140
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
140
141
|
"react": "^16.8.0 || ^17.0.0"
|
|
141
142
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// import { ComponentMeta } from '@teambit/component';
|
|
2
2
|
import { ComponentID, ComponentModel, ComponentModelProps } from '@teambit/component';
|
|
3
|
+
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
3
4
|
import { DeprecationInfo } from '@teambit/deprecation';
|
|
4
5
|
import { Descriptor } from '@teambit/envs';
|
|
5
6
|
|
|
@@ -39,7 +40,12 @@ export class Workspace {
|
|
|
39
40
|
/**
|
|
40
41
|
* components container in the workspace.
|
|
41
42
|
*/
|
|
42
|
-
readonly components: ComponentModel[]
|
|
43
|
+
readonly components: ComponentModel[],
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* components contained in the workspace.
|
|
47
|
+
*/
|
|
48
|
+
readonly componentDescriptors: ComponentDescriptor[]
|
|
43
49
|
) {}
|
|
44
50
|
|
|
45
51
|
/**
|
|
@@ -50,17 +56,22 @@ export class Workspace {
|
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
static from({ name, path, components, icon }: WorkspaceProps) {
|
|
59
|
+
const componentDescriptors = components.map((component) => {
|
|
60
|
+
const id = ComponentID.fromObject(component.id);
|
|
61
|
+
return ComponentDescriptor.fromObject({ id: id.toString() });
|
|
62
|
+
});
|
|
53
63
|
return new Workspace(
|
|
54
64
|
name,
|
|
55
65
|
path,
|
|
56
66
|
icon,
|
|
57
67
|
components.map((value) => {
|
|
58
68
|
return ComponentModel.from(value);
|
|
59
|
-
})
|
|
69
|
+
}),
|
|
70
|
+
componentDescriptors
|
|
60
71
|
);
|
|
61
72
|
}
|
|
62
73
|
|
|
63
74
|
static empty() {
|
|
64
|
-
return new Workspace('', '', '', []);
|
|
75
|
+
return new Workspace('', '', '', [], []);
|
|
65
76
|
}
|
|
66
77
|
}
|
|
Binary file
|