@teambit/component-log 0.0.491 → 0.0.492

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 +1 @@
1
- {"version":3,"names":["ComponentLogAspect","Aspect","create","id"],"sources":["component-log.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ComponentLogAspect = Aspect.create({\n id: 'teambit.component/component-log',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,kBAAkB,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC9CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["_harmony","data","require","ComponentLogAspect","Aspect","create","id","exports"],"sources":["component-log.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ComponentLogAspect = Aspect.create({\n id: 'teambit.component/component-log',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,kBAAkB,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC9CC,EAAE,EAAE;AACN,CAAC,CAAC;AAACC,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["component-log.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/component-log.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAA2D,EAAG,CAEhG;AAAC"}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","Logo","default","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["component-log.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/component-log.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,IAAI,GAAGA,CAAA,kBAClBJ,MAAA,GAAAK,OAAA,CAAAC,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEV,MAAA,GAAAK,OAAA,CAAAC,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAA2D,CAAE,CACzF,CACN;AAACC,OAAA,CAAAT,IAAA,GAAAA,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentLogMain","constructor","workspace","getLogs","id","isRemote","shortHash","consumer","bitId","BitId","parse","remote","getRemoteByName","scope","log","OutsideWorkspaceError","componentId","resolveComponentId","logs","forEach","date","moment","Date","parseInt","format","undefined","getLogsWithParents","graph","buildSnapGraph","sorted","toposort","map","node","stringifyLogInfoOneLine","attr","getFileLog","filePath","getComponentIdByPath","Error","rootDir","componentDir","relative","toString","filePathAsLinux","pathNormalizeToLinux","filePathRelativeInComponent","replace","results","lastFile","pMapSeries","logItem","component","get","changeVersion","tag","hash","fileInComp","filesystem","files","find","f","lastResult","length","lastHash","fileHash","toSourceAsLinuxEOL","diff","getFilesDiff","push","username","email","message","fileDiff","diffOutput","logInfo","parents","join","chalk","yellow","provider","cli","componentLog","register","LogCmd","LogFileCmd","CLIAspect","WorkspaceAspect","MainRuntime","ComponentLogAspect","addRuntime"],"sources":["component-log.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport moment from 'moment';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils/path';\nimport { getFilesDiff } from '@teambit/legacy/dist/consumer/component-ops/components-diff';\nimport chalk from 'chalk';\nimport getRemoteByName from '@teambit/legacy/dist/remotes/get-remote-by-name';\nimport { ComponentLogAspect } from './component-log.aspect';\nimport LogCmd from './log-cmd';\nimport { buildSnapGraph } from './snap-graph';\nimport { LogFileCmd } from './log-file-cmd';\n\nexport type FileLog = {\n hash: string;\n tag?: string;\n username?: string;\n email?: string;\n date: string;\n message: string;\n fileHash: string;\n fileDiff?: string;\n};\n\nexport class ComponentLogMain {\n constructor(private workspace: Workspace | undefined) {}\n\n async getLogs(id: string, isRemote?: boolean, shortHash = false) {\n if (isRemote) {\n const consumer = this.workspace?.consumer;\n const bitId: BitId = BitId.parse(id, true);\n const remote = await getRemoteByName(bitId.scope as string, consumer);\n return remote.log(bitId);\n }\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentId = await this.workspace.resolveComponentId(id);\n const logs = await this.workspace.scope.getLogs(componentId, shortHash);\n logs.forEach((log) => {\n log.date = log.date ? moment(new Date(parseInt(log.date))).format('YYYY-MM-DD HH:mm:ss') : undefined;\n });\n return logs;\n }\n\n async getLogsWithParents(id: string) {\n const logs = await this.getLogs(id, false, true);\n const graph = buildSnapGraph(logs);\n const sorted = graph.toposort();\n return sorted.map((node) => this.stringifyLogInfoOneLine(node.attr));\n }\n\n async getFileLog(filePath: string) {\n const workspace = this.workspace;\n if (!workspace) throw new OutsideWorkspaceError();\n const componentId = await workspace.getComponentIdByPath(filePath);\n if (!componentId) throw new Error(`unable to find component for file ${filePath}`);\n\n const rootDir = workspace.componentDir(componentId, undefined, { relative: true });\n\n const logs = await this.getLogs(componentId.toString());\n\n const filePathAsLinux = pathNormalizeToLinux(filePath);\n const filePathRelativeInComponent = filePathAsLinux.replace(`${rootDir}/`, '');\n\n const results: FileLog[] = [];\n let lastFile;\n await pMapSeries(logs, async (logItem) => {\n const component = await workspace.get(componentId.changeVersion(logItem.tag || logItem.hash));\n const fileInComp = component.filesystem.files.find((f) => f.relative === filePathRelativeInComponent);\n const lastResult = results[results.length - 1];\n const lastHash = lastResult?.fileHash;\n let fileHash: string;\n if (!fileInComp) {\n if (!lastHash) return;\n fileHash = '<REMOVED>';\n } else {\n fileHash = fileInComp.toSourceAsLinuxEOL().hash().toString();\n }\n if (fileHash === lastHash) return;\n\n let diff;\n if (lastFile && fileInComp) {\n diff = await getFilesDiff([lastFile], [fileInComp], logItem.hash, lastResult.hash, undefined);\n }\n\n lastFile = fileInComp;\n\n results.push({\n hash: logItem.hash,\n tag: logItem.tag,\n username: logItem.username,\n email: logItem.email,\n date: logItem.date || '<N/A>',\n message: logItem.message,\n fileDiff: diff?.length ? diff[0].diffOutput : undefined,\n fileHash,\n });\n });\n return results;\n }\n\n private stringifyLogInfoOneLine(logInfo: ComponentLogInfo) {\n const parents = logInfo.parents.length ? `Parent(s): ${logInfo.parents.join(', ')}` : '<N/A>';\n return `${chalk.yellow(logInfo.hash)} ${logInfo.username || ''} ${logInfo.date || ''} ${\n logInfo.message\n }, ${parents}`;\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace]: [CLIMain, Workspace]) {\n const componentLog = new ComponentLogMain(workspace);\n cli.register(new LogCmd(componentLog), new LogFileCmd(componentLog));\n return componentLog;\n }\n}\n\nComponentLogAspect.addRuntime(ComponentLogMain);\n\nexport type ComponentLogInfo = {\n hash: string;\n message: string;\n onLane?: boolean;\n parents: string[];\n username?: string;\n email?: string;\n date?: string;\n tag?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4C;AAAA;AAarC,MAAMA,gBAAgB,CAAC;EAC5BC,WAAW,CAASC,SAAgC,EAAE;IAAA,KAAlCA,SAAgC,GAAhCA,SAAgC;EAAG;EAEvD,MAAMC,OAAO,CAACC,EAAU,EAAEC,QAAkB,EAAEC,SAAS,GAAG,KAAK,EAAE;IAC/D,IAAID,QAAQ,EAAE;MAAA;MACZ,MAAME,QAAQ,sBAAG,IAAI,CAACL,SAAS,oDAAd,gBAAgBK,QAAQ;MACzC,MAAMC,KAAY,GAAGC,oBAAK,CAACC,KAAK,CAACN,EAAE,EAAE,IAAI,CAAC;MAC1C,MAAMO,MAAM,GAAG,MAAM,IAAAC,0BAAe,EAACJ,KAAK,CAACK,KAAK,EAAYN,QAAQ,CAAC;MACrE,OAAOI,MAAM,CAACG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AY,CAAC,EAAE,KAAIG,wBAAU,EAACH,YAAY,CAAC,CAAC;IACpE,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCA3FYjF,gBAAgB,WAmFZ,EAAE;AAAA,gCAnFNA,gBAAgB,kBAoFL,CAACqF,gBAAS,EAAEC,oBAAe,CAAC;AAAA,gCApFvCtF,gBAAgB,aAqFVuF,kBAAW;AAQ9BC,kCAAkB,CAACC,UAAU,CAACzF,gBAAgB,CAAC"}
1
+ {"version":3,"names":["_cli","data","require","_legacyBitId","_moment","_interopRequireDefault","_workspace","_interopRequireWildcard","_pMapSeries","_path","_componentsDiff","_chalk","_getRemoteByName","_componentLog","_logCmd","_snapGraph","_logFileCmd","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ComponentLogMain","constructor","workspace","getLogs","id","isRemote","shortHash","_this$workspace","consumer","bitId","BitId","parse","remote","getRemoteByName","scope","log","OutsideWorkspaceError","componentId","resolveComponentId","logs","forEach","date","moment","Date","parseInt","format","undefined","getLogsWithParents","graph","buildSnapGraph","sorted","toposort","map","node","stringifyLogInfoOneLine","attr","getFileLog","filePath","getComponentIdByPath","Error","rootDir","componentDir","relative","toString","filePathAsLinux","pathNormalizeToLinux","filePathRelativeInComponent","replace","results","lastFile","pMapSeries","logItem","_diff","component","changeVersion","tag","hash","fileInComp","filesystem","files","find","f","lastResult","length","lastHash","fileHash","toSourceAsLinuxEOL","diff","getFilesDiff","push","username","email","message","fileDiff","diffOutput","logInfo","parents","join","chalk","yellow","provider","cli","componentLog","register","LogCmd","LogFileCmd","exports","_defineProperty2","CLIAspect","WorkspaceAspect","MainRuntime","ComponentLogAspect","addRuntime"],"sources":["component-log.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport moment from 'moment';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport pMapSeries from 'p-map-series';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils/path';\nimport { getFilesDiff } from '@teambit/legacy/dist/consumer/component-ops/components-diff';\nimport chalk from 'chalk';\nimport getRemoteByName from '@teambit/legacy/dist/remotes/get-remote-by-name';\nimport { ComponentLogAspect } from './component-log.aspect';\nimport LogCmd from './log-cmd';\nimport { buildSnapGraph } from './snap-graph';\nimport { LogFileCmd } from './log-file-cmd';\n\nexport type FileLog = {\n hash: string;\n tag?: string;\n username?: string;\n email?: string;\n date: string;\n message: string;\n fileHash: string;\n fileDiff?: string;\n};\n\nexport class ComponentLogMain {\n constructor(private workspace: Workspace | undefined) {}\n\n async getLogs(id: string, isRemote?: boolean, shortHash = false) {\n if (isRemote) {\n const consumer = this.workspace?.consumer;\n const bitId: BitId = BitId.parse(id, true);\n const remote = await getRemoteByName(bitId.scope as string, consumer);\n return remote.log(bitId);\n }\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentId = await this.workspace.resolveComponentId(id);\n const logs = await this.workspace.scope.getLogs(componentId, shortHash);\n logs.forEach((log) => {\n log.date = log.date ? moment(new Date(parseInt(log.date))).format('YYYY-MM-DD HH:mm:ss') : undefined;\n });\n return logs;\n }\n\n async getLogsWithParents(id: string) {\n const logs = await this.getLogs(id, false, true);\n const graph = buildSnapGraph(logs);\n const sorted = graph.toposort();\n return sorted.map((node) => this.stringifyLogInfoOneLine(node.attr));\n }\n\n async getFileLog(filePath: string) {\n const workspace = this.workspace;\n if (!workspace) throw new OutsideWorkspaceError();\n const componentId = await workspace.getComponentIdByPath(filePath);\n if (!componentId) throw new Error(`unable to find component for file ${filePath}`);\n\n const rootDir = workspace.componentDir(componentId, undefined, { relative: true });\n\n const logs = await this.getLogs(componentId.toString());\n\n const filePathAsLinux = pathNormalizeToLinux(filePath);\n const filePathRelativeInComponent = filePathAsLinux.replace(`${rootDir}/`, '');\n\n const results: FileLog[] = [];\n let lastFile;\n await pMapSeries(logs, async (logItem) => {\n const component = await workspace.get(componentId.changeVersion(logItem.tag || logItem.hash));\n const fileInComp = component.filesystem.files.find((f) => f.relative === filePathRelativeInComponent);\n const lastResult = results[results.length - 1];\n const lastHash = lastResult?.fileHash;\n let fileHash: string;\n if (!fileInComp) {\n if (!lastHash) return;\n fileHash = '<REMOVED>';\n } else {\n fileHash = fileInComp.toSourceAsLinuxEOL().hash().toString();\n }\n if (fileHash === lastHash) return;\n\n let diff;\n if (lastFile && fileInComp) {\n diff = await getFilesDiff([lastFile], [fileInComp], logItem.hash, lastResult.hash, undefined);\n }\n\n lastFile = fileInComp;\n\n results.push({\n hash: logItem.hash,\n tag: logItem.tag,\n username: logItem.username,\n email: logItem.email,\n date: logItem.date || '<N/A>',\n message: logItem.message,\n fileDiff: diff?.length ? diff[0].diffOutput : undefined,\n fileHash,\n });\n });\n return results;\n }\n\n private stringifyLogInfoOneLine(logInfo: ComponentLogInfo) {\n const parents = logInfo.parents.length ? `Parent(s): ${logInfo.parents.join(', ')}` : '<N/A>';\n return `${chalk.yellow(logInfo.hash)} ${logInfo.username || ''} ${logInfo.date || ''} ${\n logInfo.message\n }, ${parents}`;\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace]: [CLIMain, Workspace]) {\n const componentLog = new ComponentLogMain(workspace);\n cli.register(new LogCmd(componentLog), new LogFileCmd(componentLog));\n return componentLog;\n }\n}\n\nComponentLogAspect.addRuntime(ComponentLogMain);\n\nexport type ComponentLogInfo = {\n hash: string;\n message: string;\n onLane?: boolean;\n parents: string[];\n username?: string;\n email?: string;\n date?: string;\n tag?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EA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BAAgB,aAqFV0F,kBAAW;AAQ9BC,kCAAkB,CAACC,UAAU,CAAC5F,gBAAgB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentLogAspect"],"sources":["index.ts"],"sourcesContent":["import { ComponentLogAspect } from './component-log.aspect';\n\nexport type { ComponentLogMain } from './component-log.main.runtime';\nexport default ComponentLogAspect;\nexport { ComponentLogAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4D,eAG7CA,kCAAkB;AAAA"}
1
+ {"version":3,"names":["_componentLog","data","require","_default","ComponentLogAspect","exports","default"],"sources":["index.ts"],"sourcesContent":["import { ComponentLogAspect } from './component-log.aspect';\n\nexport type { ComponentLogMain } from './component-log.main.runtime';\nexport default ComponentLogAspect;\nexport { ComponentLogAspect };\n"],"mappings":";;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4D,IAAAE,QAAA,GAG7CC,kCAAkB;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
package/dist/log-cmd.js CHANGED
@@ -31,8 +31,6 @@ function _cliTable() {
31
31
  return data;
32
32
  }
33
33
  class LogCmd {
34
- // should support log against remote
35
-
36
34
  constructor(componentLog) {
37
35
  this.componentLog = componentLog;
38
36
  (0, _defineProperty2().default)(this, "name", 'log <id>');
@@ -44,6 +42,7 @@ class LogCmd {
44
42
  (0, _defineProperty2().default)(this, "options", [['r', 'remote', 'show log of a remote component'], ['', 'parents', 'show parents and lanes data'], ['o', 'one-line', 'show each log entry in one line'], ['j', 'json', 'json format']]);
45
43
  (0, _defineProperty2().default)(this, "migration", true);
46
44
  (0, _defineProperty2().default)(this, "remoteOp", true);
45
+ // should support log against remote
47
46
  (0, _defineProperty2().default)(this, "skipWorkspace", true);
48
47
  (0, _defineProperty2().default)(this, "arguments", [{
49
48
  name: 'id',
@@ -1 +1 @@
1
- {"version":3,"names":["LogCmd","constructor","componentLog","name","description","report","id","remote","parents","oneLine","logs","getLogsWithParents","join","getLogs","logOneLine","reverse","map","paintLog","json","paintAuthor","email","username","c","white","log","message","date","tag","hash","title","yellow","getEmptyTableWithoutStyle","Table","chars","top","bottom","left","mid","right","middle","style","table","push","toString"],"sources":["log-cmd.ts"],"sourcesContent":["import c from 'chalk';\nimport Table from 'cli-table';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentLogMain } from './component-log.main.runtime';\n\nexport default class LogCmd implements Command {\n name = 'log <id>';\n description = 'show components(s) version history';\n helpUrl = 'docs/components/navigating-history';\n extendedDescription: string;\n group = 'info';\n alias = '';\n options = [\n ['r', 'remote', 'show log of a remote component'],\n ['', 'parents', 'show parents and lanes data'],\n ['o', 'one-line', 'show each log entry in one line'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // should support log against remote\n skipWorkspace = true;\n arguments = [{ name: 'id', description: 'component-id or component-name' }];\n\n constructor(private componentLog: ComponentLogMain) {}\n\n async report(\n [id]: [string],\n { remote = false, parents = false, oneLine = false }: { remote: boolean; parents: boolean; oneLine?: boolean }\n ) {\n if (parents) {\n const logs = await this.componentLog.getLogsWithParents(id);\n return logs.join('\\n');\n }\n const logs = await this.componentLog.getLogs(id, remote);\n if (oneLine) {\n return logOneLine(logs.reverse());\n }\n // reverse to show from the latest to earliest\n return logs.reverse().map(paintLog).join('\\n');\n }\n\n async json([id]: [string], { remote = false, parents = false }: { remote: boolean; parents: boolean }) {\n if (parents) {\n return this.componentLog.getLogsWithParents(id);\n }\n return this.componentLog.getLogs(id, remote);\n }\n}\n\nexport function paintAuthor(email: string | null | undefined, username: string | null | undefined) {\n if (email && username) {\n return c.white(`author: ${username} <${email}>\\n`);\n }\n if (email && !username) {\n return c.white(`author: <${email}>\\n`);\n }\n if (!email && username) {\n return c.white(`author: ${username}\\n`);\n }\n\n return '';\n}\n\nfunction paintLog(log: LegacyComponentLog): string {\n const { message, date, tag, hash, username, email } = log;\n const title = tag ? `tag ${tag} (${hash})\\n` : `snap ${hash}\\n`;\n return (\n c.yellow(title) +\n paintAuthor(email, username) +\n (date ? c.white(`date: ${date}\\n`) : '') +\n (message ? c.white(`\\n ${message}\\n`) : '')\n );\n}\n\n/**\n * table with no style and no borders, just to align the columns.\n */\nexport function getEmptyTableWithoutStyle() {\n return new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n middle: ' ',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n });\n}\n\nfunction logOneLine(logs: LegacyComponentLog[]) {\n const table = getEmptyTableWithoutStyle();\n\n logs.map(({ hash, tag, username, date, message }) =>\n table.push([hash, tag || '', username || '', date || '', message || ''])\n );\n\n return table.toString();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKe,MAAMA,MAAM,CAAoB;EAc5B;;EAIjBC,WAAW,CAASC,YAA8B,EAAE;IAAA,KAAhCA,YAA8B,GAA9BA,YAA8B;IAAA,8CAjB3C,UAAU;IAAA,qDACH,oCAAoC;IAAA,iDACxC,oCAAoC;IAAA;IAAA,+CAEtC,MAAM;IAAA,+CACN,EAAE;IAAA,iDACA,CACR,CAAC,GAAG,EAAE,QAAQ,EAAE,gCAAgC,CAAC,EACjD,CAAC,EAAE,EAAE,SAAS,EAAE,6BAA6B,CAAC,EAC9C,CAAC,GAAG,EAAE,UAAU,EAAE,iCAAiC,CAAC,EACpD,CAAC,GAAG,EAAE,MA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KAAK,EAAE;MAAE,cAAc,EAAE,CAAC;MAAE,eAAe,EAAE;IAAE;EACjD,CAAC,CAAC;AACJ;AAEA,SAAS1B,UAAU,CAACJ,IAA0B,EAAE;EAC9C,MAAM+B,KAAK,GAAGV,yBAAyB,EAAE;EAEzCrB,IAAI,CAACM,GAAG,CAAC,CAAC;IAAEY,IAAI;IAAED,GAAG;IAAEN,QAAQ;IAAEK,IAAI;IAAED;EAAQ,CAAC,KAC9CgB,KAAK,CAACC,IAAI,CAAC,CAACd,IAAI,EAAED,GAAG,IAAI,EAAE,EAAEN,QAAQ,IAAI,EAAE,EAAEK,IAAI,IAAI,EAAE,EAAED,OAAO,IAAI,EAAE,CAAC,CAAC,CACzE;EAED,OAAOgB,KAAK,CAACE,QAAQ,EAAE;AACzB"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cliTable","LogCmd","constructor","componentLog","_defineProperty2","default","name","description","report","id","remote","parents","oneLine","logs","getLogsWithParents","join","getLogs","logOneLine","reverse","map","paintLog","json","exports","paintAuthor","email","username","c","white","log","message","date","tag","hash","title","yellow","getEmptyTableWithoutStyle","Table","chars","top","bottom","left","mid","right","middle","style","table","push","toString"],"sources":["log-cmd.ts"],"sourcesContent":["import c from 'chalk';\nimport Table from 'cli-table';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentLogMain } from './component-log.main.runtime';\n\nexport default class LogCmd implements Command {\n name = 'log <id>';\n description = 'show components(s) version history';\n helpUrl = 'docs/components/navigating-history';\n extendedDescription: string;\n group = 'info';\n alias = '';\n options = [\n ['r', 'remote', 'show log of a remote component'],\n ['', 'parents', 'show parents and lanes data'],\n ['o', 'one-line', 'show each log entry in one line'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n migration = true;\n remoteOp = true; // should support log against remote\n skipWorkspace = true;\n arguments = [{ name: 'id', description: 'component-id or component-name' }];\n\n constructor(private componentLog: ComponentLogMain) {}\n\n async report(\n [id]: [string],\n { remote = false, parents = false, oneLine = false }: { remote: boolean; parents: boolean; oneLine?: boolean }\n ) {\n if (parents) {\n const logs = await this.componentLog.getLogsWithParents(id);\n return logs.join('\\n');\n }\n const logs = await this.componentLog.getLogs(id, remote);\n if (oneLine) {\n return logOneLine(logs.reverse());\n }\n // reverse to show from the latest to earliest\n return logs.reverse().map(paintLog).join('\\n');\n }\n\n async json([id]: [string], { remote = false, parents = false }: { remote: boolean; parents: boolean }) {\n if (parents) {\n return this.componentLog.getLogsWithParents(id);\n }\n return this.componentLog.getLogs(id, remote);\n }\n}\n\nexport function paintAuthor(email: string | null | undefined, username: string | null | undefined) {\n if (email && username) {\n return c.white(`author: ${username} <${email}>\\n`);\n }\n if (email && !username) {\n return c.white(`author: <${email}>\\n`);\n }\n if (!email && username) {\n return c.white(`author: ${username}\\n`);\n }\n\n return '';\n}\n\nfunction paintLog(log: LegacyComponentLog): string {\n const { message, date, tag, hash, username, email } = log;\n const title = tag ? `tag ${tag} (${hash})\\n` : `snap ${hash}\\n`;\n return (\n c.yellow(title) +\n paintAuthor(email, username) +\n (date ? c.white(`date: ${date}\\n`) : '') +\n (message ? c.white(`\\n ${message}\\n`) : '')\n );\n}\n\n/**\n * table with no style and no borders, just to align the columns.\n */\nexport function getEmptyTableWithoutStyle() {\n return new Table({\n chars: {\n top: '',\n 'top-mid': '',\n 'top-left': '',\n 'top-right': '',\n bottom: '',\n 'bottom-mid': '',\n 'bottom-left': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n right: '',\n 'right-mid': '',\n middle: ' ',\n },\n style: { 'padding-left': 0, 'padding-right': 0 },\n });\n}\n\nfunction logOneLine(logs: LegacyComponentLog[]) {\n const table = getEmptyTableWithoutStyle();\n\n logs.map(({ hash, tag, username, date, message }) =>\n table.push([hash, tag || '', username || '', date || '', message || ''])\n );\n\n return table.toString();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAAA,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AACM,GAAG,CAAC,CAAC;IAAEa,IAAI;IAAED,GAAG;IAAEN,QAAQ;IAAEK,IAAI;IAAED;EAAQ,CAAC,KAC9CgB,KAAK,CAACC,IAAI,CAAC,CAACd,IAAI,EAAED,GAAG,IAAI,EAAE,EAAEN,QAAQ,IAAI,EAAE,EAAEK,IAAI,IAAI,EAAE,EAAED,OAAO,IAAI,EAAE,CAAC,CACzE,CAAC;EAED,OAAOgB,KAAK,CAACE,QAAQ,CAAC,CAAC;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"names":["LogFileCmd","constructor","componentLog","name","description","report","filePath","oneLine","results","getFileLog","table","getEmptyTableWithoutStyle","forEach","hash","tag","username","date","message","fileHash","push","toString","output","map","email","fileDiff","title","author","paintAuthor","body","chalk","green","split","line","join","yellow","white"],"sources":["log-file-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { ComponentLogMain } from './component-log.main.runtime';\nimport { getEmptyTableWithoutStyle, paintAuthor } from './log-cmd';\n\nexport class LogFileCmd implements Command {\n name = 'log-file <filepath>';\n description = 'EXPERIMENTAL. show file history';\n group = 'info';\n alias = '';\n options = [['o', 'one-line', 'show each log entry in one line']] as CommandOptions;\n arguments = [{ name: 'filepath', description: 'file path relative to the workspace' }];\n\n constructor(private componentLog: ComponentLogMain) {}\n\n async report([filePath]: [string], { oneLine = false }: { oneLine?: boolean }) {\n const results = await this.componentLog.getFileLog(filePath);\n if (oneLine) {\n const table = getEmptyTableWithoutStyle();\n results.forEach(({ hash, tag, username, date, message, fileHash }) => {\n table.push([hash, tag || '', username || '', date, message, fileHash]);\n });\n return table.toString();\n }\n const output = results.map(({ hash, tag, username, email, date, message, fileDiff }) => {\n const title = tag ? `tag ${tag} (${hash})\\n` : `snap ${hash}\\n`;\n const author = paintAuthor(email, username);\n const body = (fileDiff || chalk.green('<FILE-ADDED>'))\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n');\n return (\n chalk.yellow(title) +\n author +\n (date ? chalk.white(`date: ${date}\\n`) : '') +\n (message ? chalk.white(`message: ${message}\\n\\n`) : '\\n') +\n body\n );\n });\n return output.join('\\n');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,UAAU,CAAoB;EAQzCC,WAAW,CAASC,YAA8B,EAAE;IAAA,KAAhCA,YAA8B,GAA9BA,YAA8B;IAAA,8CAP3C,qBAAqB;IAAA,qDACd,iCAAiC;IAAA,+CACvC,MAAM;IAAA,+CACN,EAAE;IAAA,iDACA,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,iCAAiC,CAAC,CAAC;IAAA,mDACpD,CAAC;MAAEC,IAAI,EAAE,UAAU;MAAEC,WAAW,EAAE;IAAsC,CAAC,CAAC;EAEjC;EAErD,MAAMC,MAAM,CAAC,CAACC,QAAQ,CAAW,EAAE;IAAEC,OAAO,GAAG;EAA6B,CAAC,EAAE;IAC7E,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACN,YAAY,CAACO,UAAU,CAACH,QAAQ,CAAC;IAC5D,IAAIC,OAAO,EAAE;MACX,MAAMG,KAAK,GAAG,IAAAC,mCAAyB,GAAE;MACzCH,OAAO,CAACI,OAAO,CAAC,CAAC;QAAEC,IAAI;QAAEC,GAAG;QAAEC,QAAQ;QAAEC,IAAI;QAAEC,OAAO;QAAEC;MAAS,CAAC,KAAK;QACpER,KAAK,CAACS,IAAI,CAAC,CAACN,IAAI,EAAEC,GAAG,IAAI,EAAE,EAAEC,QAAQ,IAAI,EAAE,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,CAAC,CAAC;MACxE,CAAC,CAAC;MACF,OAAOR,KAAK,CAACU,QAAQ,EAAE;IACzB;IACA,MAAMC,MAAM,GAAGb,OAAO,CAACc,GAAG,CAAC,CAAC;MAAET,IAAI;MAAEC,GAAG;MAAEC,QAAQ;MAAEQ,KAAK;MAAEP,IAAI;MAAEC,OAAO;MAAEO;IAAS,CAAC,KAAK;MACtF,MAAMC,KAAK,GAAGX,GAAG,GAAI,OAAMA,GAAI,KAAID,IAAK,KAAI,GAAI,QAAOA,IAAK,IAAG;MAC/D,MAAMa,MAAM,GAAG,IAAAC,qBAAW,EAACJ,KAAK,EAAER,QAAQ,CAAC;MAC3C,MAAMa,IAAI,GAAG,CAACJ,QAAQ,IAAIK,gBAAK,CAACC,KAAK,CAAC,cAAc,CAAC,EAClDC,KAAK,CAAC,IAAI,CAAC,CACXT,GAAG,CAAEU,IAAI,IAAM,SAAQA,IAAK,EAAC,CAAC,CAC9BC,IAAI,CAAC,IAAI,CAAC;MACb,OACEJ,gBAAK,CAACK,MAAM,CAACT,KAAK,CAAC,GACnBC,MAAM,IACLV,IAAI,GAAGa,gBAAK,CAACM,KAAK,CAAE,SAAQnB,IAAK,IAAG,CAAC,GAAG,EAAE,CAAC,IAC3CC,OAAO,GAAGY,gBAAK,CAACM,KAAK,CAAE,YAAWlB,OAAQ,MAAK,CAAC,GAAG,IAAI,CAAC,GACzDW,IAAI;IAER,CAAC,CAAC;IACF,OAAOP,MAAM,CAACY,IAAI,CAAC,IAAI,CAAC;EAC1B;AACF;AAAC"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_logCmd","LogFileCmd","constructor","componentLog","_defineProperty2","default","name","description","report","filePath","oneLine","results","getFileLog","table","getEmptyTableWithoutStyle","forEach","hash","tag","username","date","message","fileHash","push","toString","output","map","email","fileDiff","title","author","paintAuthor","body","chalk","green","split","line","join","yellow","white","exports"],"sources":["log-file-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { ComponentLogMain } from './component-log.main.runtime';\nimport { getEmptyTableWithoutStyle, paintAuthor } from './log-cmd';\n\nexport class LogFileCmd implements Command {\n name = 'log-file <filepath>';\n description = 'EXPERIMENTAL. show file history';\n group = 'info';\n alias = '';\n options = [['o', 'one-line', 'show each log entry in one line']] as CommandOptions;\n arguments = [{ name: 'filepath', description: 'file path relative to the workspace' }];\n\n constructor(private componentLog: ComponentLogMain) {}\n\n async report([filePath]: [string], { oneLine = false }: { oneLine?: boolean }) {\n const results = await this.componentLog.getFileLog(filePath);\n if (oneLine) {\n const table = getEmptyTableWithoutStyle();\n results.forEach(({ hash, tag, username, date, message, fileHash }) => {\n table.push([hash, tag || '', username || '', date, message, fileHash]);\n });\n return table.toString();\n }\n const output = results.map(({ hash, tag, username, email, date, message, fileDiff }) => {\n const title = tag ? `tag ${tag} (${hash})\\n` : `snap ${hash}\\n`;\n const author = paintAuthor(email, username);\n const body = (fileDiff || chalk.green('<FILE-ADDED>'))\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n');\n return (\n chalk.yellow(title) +\n author +\n (date ? chalk.white(`date: ${date}\\n`) : '') +\n (message ? chalk.white(`message: ${message}\\n\\n`) : '\\n') +\n body\n );\n });\n return output.join('\\n');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMI,UAAU,CAAoB;EAQzCC,WAAWA,CAASC,YAA8B,EAAE;IAAA,KAAhCA,YAA8B,GAA9BA,YAA8B;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAP3C,qBAAqB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACd,iCAAiC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACvC,MAAM;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACN,EAAE;IAAA,I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AC,IAAI,CAAC,CACXT,GAAG,CAAEU,IAAI,IAAM,SAAQA,IAAK,EAAC,CAAC,CAC9BC,IAAI,CAAC,IAAI,CAAC;MACb,OACEJ,gBAAK,CAACK,MAAM,CAACT,KAAK,CAAC,GACnBC,MAAM,IACLV,IAAI,GAAGa,gBAAK,CAACM,KAAK,CAAE,SAAQnB,IAAK,IAAG,CAAC,GAAG,EAAE,CAAC,IAC3CC,OAAO,GAAGY,gBAAK,CAACM,KAAK,CAAE,YAAWlB,OAAQ,MAAK,CAAC,GAAG,IAAI,CAAC,GACzDW,IAAI;IAER,CAAC,CAAC;IACF,OAAOP,MAAM,CAACY,IAAI,CAAC,IAAI,CAAC;EAC1B;AACF;AAACG,OAAA,CAAAtC,UAAA,GAAAA,UAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-log@0.0.491/dist/component-log.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-log@0.0.491/dist/component-log.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-log@0.0.492/dist/component-log.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-log@0.0.492/dist/component-log.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1 +1 @@
1
- {"version":3,"names":["buildSnapGraph","componentLog","graph","Graph","forEach","snap","setNode","Node","hash","parents","parent","setEdge","Edge"],"sources":["snap-graph.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { ComponentLogInfo } from './component-log.main.runtime';\n\nexport function buildSnapGraph(componentLog: ComponentLogInfo[]) {\n const graph = new Graph<ComponentLogInfo, string>();\n // add nodes\n componentLog.forEach((snap) => {\n graph.setNode(new Node(snap.hash, snap));\n });\n // add edges\n componentLog.forEach((snap) => {\n snap.parents.forEach((parent) => {\n graph.setEdge(new Edge(snap.hash, parent, 'parent'));\n });\n });\n return graph;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,cAAc,CAACC,YAAgC,EAAE;EAC/D,MAAMC,KAAK,GAAG,KAAIC,cAAK,GAA4B;EACnD;EACAF,YAAY,CAACG,OAAO,CAAEC,IAAI,IAAK;IAC7BH,KAAK,CAACI,OAAO,CAAC,KAAIC,aAAI,EAACF,IAAI,CAACG,IAAI,EAAEH,IAAI,CAAC,CAAC;EAC1C,CAAC,CAAC;EACF;EACAJ,YAAY,CAACG,OAAO,CAAEC,IAAI,IAAK;IAC7BA,IAAI,CAACI,OAAO,CAACL,OAAO,CAAEM,MAAM,IAAK;MAC/BR,KAAK,CAACS,OAAO,CAAC,KAAIC,aAAI,EAACP,IAAI,CAACG,IAAI,EAAEE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOR,KAAK;AACd"}
1
+ {"version":3,"names":["_graph","data","require","buildSnapGraph","componentLog","graph","Graph","forEach","snap","setNode","Node","hash","parents","parent","setEdge","Edge"],"sources":["snap-graph.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { ComponentLogInfo } from './component-log.main.runtime';\n\nexport function buildSnapGraph(componentLog: ComponentLogInfo[]) {\n const graph = new Graph<ComponentLogInfo, string>();\n // add nodes\n componentLog.forEach((snap) => {\n graph.setNode(new Node(snap.hash, snap));\n });\n // add edges\n componentLog.forEach((snap) => {\n snap.parents.forEach((parent) => {\n graph.setEdge(new Edge(snap.hash, parent, 'parent'));\n });\n });\n return graph;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,SAASE,cAAcA,CAACC,YAAgC,EAAE;EAC/D,MAAMC,KAAK,GAAG,KAAIC,cAAK,EAA2B,CAAC;EACnD;EACAF,YAAY,CAACG,OAAO,CAAEC,IAAI,IAAK;IAC7BH,KAAK,CAACI,OAAO,CAAC,KAAIC,aAAI,EAACF,IAAI,CAACG,IAAI,EAAEH,IAAI,CAAC,CAAC;EAC1C,CAAC,CAAC;EACF;EACAJ,YAAY,CAACG,OAAO,CAAEC,IAAI,IAAK;IAC7BA,IAAI,CAACI,OAAO,CAACL,OAAO,CAAEM,MAAM,IAAK;MAC/BR,KAAK,CAACS,OAAO,CAAC,KAAIC,aAAI,EAACP,IAAI,CAACG,IAAI,EAAEE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOR,KAAK;AACd"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component-log",
3
- "version": "0.0.491",
3
+ "version": "0.0.492",
4
4
  "homepage": "https://bit.cloud/teambit/component/component-log",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component-log",
9
- "version": "0.0.491"
9
+ "version": "0.0.492"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -18,8 +18,8 @@
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/legacy-bit-id": "0.0.423",
20
20
  "@teambit/graph.cleargraph": "0.0.1",
21
- "@teambit/cli": "0.0.746",
22
- "@teambit/workspace": "0.0.1114",
21
+ "@teambit/cli": "0.0.747",
22
+ "@teambit/workspace": "0.0.1115",
23
23
  "@teambit/legacy-component-log": "0.0.400"
24
24
  },
25
25
  "devDependencies": {