@teambit/git 0.0.0-cb69adb1211b515e7c3434314b44eba34d90bbf9 → 0.0.0-d126cf426c7ab9ba9d6785e91a5fe62bf54a3a7c

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/dist/git.cmd.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command } from '@teambit/cli';
1
+ import type { Command } from '@teambit/cli';
2
2
  export declare class GitCmd implements Command {
3
3
  name: string;
4
4
  alias: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","GitCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports"],"sources":["git.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\n\nconst COMMAND_NAME = 'git';\n\nexport class GitCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = '';\n description = 'perform git operations';\n options = [];\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"git\", please run \"bit git --help\" to list the subcommands`\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAE1B,MAAMgB,YAAY,GAAG,KAAK;AAEnB,MAAMC,MAAM,CAAoB;EAAAC,YAAA;IAAApB,eAAA,eAC9B,GAAGkB,YAAY,gBAAgB;IAAAlB,eAAA,gBAC9B,EAAE;IAAAA,eAAA,sBACI,wBAAwB;IAAAA,eAAA,kBAC5B,EAAE;IAAAA,eAAA,gBACJ,iBAAiB;IAAAA,eAAA,mBACH,EAAE;EAAA;EACxB;;EAEA,MAAMqB,MAAMA,CAAC,CAACC,sBAAsB,CAAW,EAAE;IAC/C,OAAOC,gBAAK,CAACC,GAAG,CACd,IAAIF,sBAAsB,qFAC5B,CAAC;EACH;AACF;AAACG,OAAA,CAAAN,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","GitCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports"],"sources":["git.cmd.ts"],"sourcesContent":["import type { Command } from '@teambit/cli';\nimport chalk from 'chalk';\n\nconst COMMAND_NAME = 'git';\n\nexport class GitCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = '';\n description = 'perform git operations';\n options = [];\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"git\", please run \"bit git --help\" to list the subcommands`\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAE1B,MAAMgB,YAAY,GAAG,KAAK;AAEnB,MAAMC,MAAM,CAAoB;EAAAC,YAAA;IAAApB,eAAA,eAC9B,GAAGkB,YAAY,gBAAgB;IAAAlB,eAAA,gBAC9B,EAAE;IAAAA,eAAA,sBACI,wBAAwB;IAAAA,eAAA,kBAC5B,EAAE;IAAAA,eAAA,gBACJ,iBAAiB;IAAAA,eAAA,mBACH,EAAE;EAAA;EACxB;;EAEA,MAAMqB,MAAMA,CAAC,CAACC,sBAAsB,CAAW,EAAE;IAC/C,OAAOC,gBAAK,CAACC,GAAG,CACd,IAAIF,sBAAsB,qFAC5B,CAAC;EACH;AACF;AAACG,OAAA,CAAAN,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { CLIMain } from '@teambit/cli';
2
- import { Workspace } from '@teambit/workspace';
1
+ import type { CLIMain } from '@teambit/cli';
2
+ import type { Workspace } from '@teambit/workspace';
3
3
  type SetGitMergeDriverOpts = {
4
4
  global?: boolean;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bitError","_os","_path","_gitconfig","_cli","_workspace","_git","_mergeBitmaps","_setGitMergeDriver","_git2","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GIT_BASE_KEY","GIT_NAME_KEY","GIT_DRIVER_KEY","GIT_NAME_VALUE","GIT_DRIVER_VALUE","GIT_ATTRIBUTES","GitMain","constructor","workspace","config","mergeBitmaps","ancestor","current","other","encoding","currentContent","stripBom","fs","readFileSync","otherContent","opts","mergeStrategy","merged","bitMap","outputFile","setGitMergeDriver","setGitConfig","setGitAttributes","isGit","pathExists","global","BitError","location","gitVal","gitconfig","get","set","attributesPath","getGitAttributesPath","fileExist","writeFile","gitAttributes","readFile","includes","appendFile","fromConfig","xdgConfigHome","process","env","XDG_CONFIG_HOME","join","homedir","str","slice","provider","cli","gitMain","gitCmd","GitCmd","commands","SetGitMergeDriverCmd","MergeBitmapsCmd","register","registerGroup","exports","CLIAspect","WorkspaceAspect","MainRuntime","GitAspect","addRuntime","_default"],"sources":["git.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { BitError } from '@teambit/bit-error';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport gitconfig from '@teambit/gitconfig';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, Workspace, BitmapMergeOptions } from '@teambit/workspace';\nimport { GitAspect } from './git.aspect';\nimport { MergeBitmapsCmd } from './merge-bitmaps.cmd';\nimport { SetGitMergeDriverCmd } from './set-git-merge-driver.cmd';\nimport { GitCmd } from './git.cmd';\n\ntype SetGitMergeDriverOpts = {\n global?: boolean;\n};\n\nconst GIT_BASE_KEY = 'merge.bitmap-driver';\nconst GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;\nconst GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;\n\nconst GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';\n// const binName = process.argv[1];\nconst GIT_DRIVER_VALUE = 'bd git merge-bitmaps %O %A %B';\n\nconst GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';\n\nexport interface GitExtWorkspaceConfig {\n mergeStrategy: 'ours' | 'theirs' | 'manual';\n}\nexport class GitMain {\n constructor(\n private workspace: Workspace,\n /**\n * Git extension configuration.\n */\n readonly config: GitExtWorkspaceConfig\n ) {}\n\n async mergeBitmaps(ancestor: string, current: string, other: string) {\n const encoding = 'utf-8';\n // const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));\n const currentContent = this.stripBom(fs.readFileSync(current, encoding));\n const otherContent = this.stripBom(fs.readFileSync(other, encoding));\n const opts: BitmapMergeOptions = {\n mergeStrategy: this.config.mergeStrategy || 'manual',\n };\n const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent, opts);\n await fs.outputFile(current, merged);\n return merged;\n }\n\n async setGitMergeDriver(opts: SetGitMergeDriverOpts) {\n await this.setGitConfig(opts);\n await this.setGitAttributes(opts);\n return true;\n }\n\n private async setGitConfig(opts: SetGitMergeDriverOpts) {\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const location = opts.global ? 'global' : 'local';\n let gitVal;\n try {\n gitVal = await gitconfig.get(GIT_NAME_KEY, { location });\n } catch {\n // do nothing, it just means that there is no config yet which is fine\n }\n if (gitVal) {\n return; // already set\n }\n await gitconfig.set(GIT_NAME_KEY, GIT_NAME_VALUE, { location });\n await gitconfig.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, { location });\n }\n\n private async setGitAttributes(opts: SetGitMergeDriverOpts) {\n const attributesPath = await this.getGitAttributesPath(opts.global);\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const fileExist = await fs.pathExists(attributesPath);\n if (!fileExist) {\n await fs.writeFile(attributesPath, GIT_ATTRIBUTES);\n } else {\n const gitAttributes = await fs.readFile(attributesPath, 'utf8');\n if (gitAttributes.includes(GIT_ATTRIBUTES)) {\n return; // already set\n }\n await fs.appendFile(attributesPath, `\\n${GIT_ATTRIBUTES}`);\n }\n }\n\n private async getGitAttributesPath(global = false) {\n const fromConfig = await gitconfig.get('core.attributesFile', { location: global ? 'global' : 'local' });\n if (fromConfig) {\n return fromConfig;\n }\n if (!global) {\n return '.gitattributes';\n }\n const xdgConfigHome = process.env.XDG_CONFIG_HOME;\n if (xdgConfigHome) {\n return join(xdgConfigHome, 'git', 'attributes');\n }\n return join(homedir(), '.config', 'git', 'attributes');\n }\n\n private stripBom(str) {\n return str[0] === '\\uFEFF' ? str.slice(1) : str;\n }\n\n static slots = [];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace]: [CLIMain, Workspace], config: GitExtWorkspaceConfig) {\n const gitMain = new GitMain(workspace, config);\n const gitCmd = new GitCmd();\n gitCmd.commands = [new SetGitMergeDriverCmd(gitMain), new MergeBitmapsCmd(gitMain)];\n cli.register(gitCmd);\n cli.registerGroup('git', 'Git');\n return gitMain;\n }\n}\n\nGitAspect.addRuntime(GitMain);\n\nexport default GitMain;\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA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C,KAAIC,yCAAoB,EAACJ,OAAO,CAAC,EAAE,KAAIK,+BAAe,EAACL,OAAO,CAAC,CAAC;IACnFD,GAAG,CAACO,QAAQ,CAACL,MAAM,CAAC;IACpBF,GAAG,CAACQ,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/B,OAAOP,OAAO;EAChB;AACF;AAACQ,OAAA,CAAA1D,OAAA,GAAAA,OAAA;AAAAxB,eAAA,CAnGYwB,OAAO,WAoFH,EAAE;AACjB;AACA;AAAAxB,eAAA,CAtFWwB,OAAO,kBAuFI,CAAC2D,gBAAS,EAAEC,4BAAe,CAAC;AAAApF,eAAA,CAvFvCwB,OAAO,aAyFD6D,kBAAW;AAY9BC,gBAAS,CAACC,UAAU,CAAC/D,OAAO,CAAC;AAAC,IAAAgE,QAAA,GAAAN,OAAA,CAAAnF,OAAA,GAEfyB,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bitError","_os","_path","_gitconfig","_cli","_workspace","_git","_mergeBitmaps","_setGitMergeDriver","_git2","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GIT_BASE_KEY","GIT_NAME_KEY","GIT_DRIVER_KEY","GIT_NAME_VALUE","GIT_DRIVER_VALUE","GIT_ATTRIBUTES","GitMain","constructor","workspace","config","mergeBitmaps","ancestor","current","other","encoding","currentContent","stripBom","fs","readFileSync","otherContent","opts","mergeStrategy","merged","bitMap","outputFile","setGitMergeDriver","setGitConfig","setGitAttributes","isGit","pathExists","global","BitError","location","gitVal","gitconfig","get","set","attributesPath","getGitAttributesPath","fileExist","writeFile","gitAttributes","readFile","includes","appendFile","fromConfig","xdgConfigHome","process","env","XDG_CONFIG_HOME","join","homedir","str","slice","provider","cli","gitMain","gitCmd","GitCmd","commands","SetGitMergeDriverCmd","MergeBitmapsCmd","register","registerGroup","exports","CLIAspect","WorkspaceAspect","MainRuntime","GitAspect","addRuntime","_default"],"sources":["git.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { BitError } from '@teambit/bit-error';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport gitconfig from '@teambit/gitconfig';\nimport type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Workspace, BitmapMergeOptions } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { GitAspect } from './git.aspect';\nimport { MergeBitmapsCmd } from './merge-bitmaps.cmd';\nimport { SetGitMergeDriverCmd } from './set-git-merge-driver.cmd';\nimport { GitCmd } from './git.cmd';\n\ntype SetGitMergeDriverOpts = {\n global?: boolean;\n};\n\nconst GIT_BASE_KEY = 'merge.bitmap-driver';\nconst GIT_NAME_KEY = `${GIT_BASE_KEY}.name`;\nconst GIT_DRIVER_KEY = `${GIT_BASE_KEY}.driver`;\n\nconst GIT_NAME_VALUE = 'A custom merge driver used to resolve conflicts in .bitmap files';\n// const binName = process.argv[1];\nconst GIT_DRIVER_VALUE = 'bd git merge-bitmaps %O %A %B';\n\nconst GIT_ATTRIBUTES = '.bitmap merge=bitmap-driver';\n\nexport interface GitExtWorkspaceConfig {\n mergeStrategy: 'ours' | 'theirs' | 'manual';\n}\nexport class GitMain {\n constructor(\n private workspace: Workspace,\n /**\n * Git extension configuration.\n */\n readonly config: GitExtWorkspaceConfig\n ) {}\n\n async mergeBitmaps(ancestor: string, current: string, other: string) {\n const encoding = 'utf-8';\n // const ancestorContent = this.stripBom(fs.readFileSync(ancestor, encoding));\n const currentContent = this.stripBom(fs.readFileSync(current, encoding));\n const otherContent = this.stripBom(fs.readFileSync(other, encoding));\n const opts: BitmapMergeOptions = {\n mergeStrategy: this.config.mergeStrategy || 'manual',\n };\n const merged = this.workspace.bitMap.mergeBitmaps(currentContent, otherContent, opts);\n await fs.outputFile(current, merged);\n return merged;\n }\n\n async setGitMergeDriver(opts: SetGitMergeDriverOpts) {\n await this.setGitConfig(opts);\n await this.setGitAttributes(opts);\n return true;\n }\n\n private async setGitConfig(opts: SetGitMergeDriverOpts) {\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const location = opts.global ? 'global' : 'local';\n let gitVal;\n try {\n gitVal = await gitconfig.get(GIT_NAME_KEY, { location });\n } catch {\n // do nothing, it just means that there is no config yet which is fine\n }\n if (gitVal) {\n return; // already set\n }\n await gitconfig.set(GIT_NAME_KEY, GIT_NAME_VALUE, { location });\n await gitconfig.set(GIT_DRIVER_KEY, GIT_DRIVER_VALUE, { location });\n }\n\n private async setGitAttributes(opts: SetGitMergeDriverOpts) {\n const attributesPath = await this.getGitAttributesPath(opts.global);\n const isGit = await fs.pathExists('.git');\n if (!isGit && !opts.global) {\n throw new BitError('This is not a git repository');\n }\n const fileExist = await fs.pathExists(attributesPath);\n if (!fileExist) {\n await fs.writeFile(attributesPath, GIT_ATTRIBUTES);\n } else {\n const gitAttributes = await fs.readFile(attributesPath, 'utf8');\n if (gitAttributes.includes(GIT_ATTRIBUTES)) {\n return; // already set\n }\n await fs.appendFile(attributesPath, `\\n${GIT_ATTRIBUTES}`);\n }\n }\n\n private async getGitAttributesPath(global = false) {\n const fromConfig = await gitconfig.get('core.attributesFile', { location: global ? 'global' : 'local' });\n if (fromConfig) {\n return fromConfig;\n }\n if (!global) {\n return '.gitattributes';\n }\n const xdgConfigHome = process.env.XDG_CONFIG_HOME;\n if (xdgConfigHome) {\n return join(xdgConfigHome, 'git', 'attributes');\n }\n return join(homedir(), '.config', 'git', 'attributes');\n }\n\n private stripBom(str) {\n return str[0] === '\\uFEFF' ? str.slice(1) : str;\n }\n\n static slots = [];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace]: [CLIMain, Workspace], config: GitExtWorkspaceConfig) {\n const gitMain = new GitMain(workspace, config);\n const gitCmd = new GitCmd();\n gitCmd.commands = [new SetGitMergeDriverCmd(gitMain), new MergeBitmapsCmd(gitMain)];\n cli.register(gitCmd);\n cli.registerGroup('git', 'Git');\n return gitMain;\n }\n}\n\nGitAspect.addRuntime(GitMain);\n\nexport default GitMain;\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,KAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,IAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OA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F,GAAG,CAACQ,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/B,OAAOP,OAAO;EAChB;AACF;AAACQ,OAAA,CAAA1D,OAAA,GAAAA,OAAA;AAAAxB,eAAA,CAnGYwB,OAAO,WAoFH,EAAE;AACjB;AACA;AAAAxB,eAAA,CAtFWwB,OAAO,kBAuFI,CAAC2D,gBAAS,EAAEC,4BAAe,CAAC;AAAApF,eAAA,CAvFvCwB,OAAO,aAyFD6D,kBAAW;AAY9BC,gBAAS,CAACC,UAAU,CAAC/D,OAAO,CAAC;AAAC,IAAAgE,QAAA,GAAAN,OAAA,CAAAnF,OAAA,GAEfyB,OAAO","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { GitMain } from './git.main.runtime';
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { GitMain } from './git.main.runtime';
3
3
  export declare class MergeBitmapsCmd implements Command {
4
4
  private git;
5
5
  name: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","MergeBitmapsCmd","constructor","git","report","ancestor","current","other","res","mergeBitmaps","chalk","green","red","exports"],"sources":["merge-bitmaps.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'merge-bitmaps';\n\n// - `%O`: ancestor’s version of the conflicting file\n// - `%A`: current version of the conflicting file\n// - `%B`: other branch's version of the conflicting file\n\nexport class MergeBitmapsCmd implements Command {\n name = `${COMMAND_NAME} <ancestor> <current> <other>`;\n alias = '';\n description = `a special command to merge conflicting bitmap files during git merge`;\n options = [] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n private = true;\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report([ancestor, current, other]: string[]) {\n const res = await this.git.mergeBitmaps(ancestor, current, other);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1B,MAAMgB,YAAY,GAAG,eAAe;;AAEpC;AACA;AACA;;AAEO,MAAMC,eAAe,CAAoB;EAQ9C;;EAEAC,WAAWA,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAArB,eAAA,eATzB,GAAGkB,YAAY,+BAA+B;IAAAlB,eAAA,gBAC7C,EAAE;IAAAA,eAAA,sBACI,sEAAsE;IAAAA,eAAA,kBAC1E,EAAE;IAAAA,eAAA,gBACJ,iBAAiB;IAAAA,eAAA,mBACH,EAAE;IAAAA,eAAA,kBACd,IAAI;EAGqB;EAEnC,MAAMsB,MAAMA,CAAC,CAACC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAW,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACL,GAAG,CAACM,YAAY,CAACJ,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAC;IACjE,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","MergeBitmapsCmd","constructor","git","report","ancestor","current","other","res","mergeBitmaps","chalk","green","red","exports"],"sources":["merge-bitmaps.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport type { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'merge-bitmaps';\n\n// - `%O`: ancestor’s version of the conflicting file\n// - `%A`: current version of the conflicting file\n// - `%B`: other branch's version of the conflicting file\n\nexport class MergeBitmapsCmd implements Command {\n name = `${COMMAND_NAME} <ancestor> <current> <other>`;\n alias = '';\n description = `a special command to merge conflicting bitmap files during git merge`;\n options = [] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n private = true;\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report([ancestor, current, other]: string[]) {\n const res = await this.git.mergeBitmaps(ancestor, current, other);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1B,MAAMgB,YAAY,GAAG,eAAe;;AAEpC;AACA;AACA;;AAEO,MAAMC,eAAe,CAAoB;EAQ9C;;EAEAC,WAAWA,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAArB,eAAA,eATzB,GAAGkB,YAAY,+BAA+B;IAAAlB,eAAA,gBAC7C,EAAE;IAAAA,eAAA,sBACI,sEAAsE;IAAAA,eAAA,kBAC1E,EAAE;IAAAA,eAAA,gBACJ,iBAAiB;IAAAA,eAAA,mBACH,EAAE;IAAAA,eAAA,kBACd,IAAI;EAGqB;EAEnC,MAAMsB,MAAMA,CAAC,CAACC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAW,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACL,GAAG,CAACM,YAAY,CAACJ,QAAQ,EAAEC,OAAO,EAAEC,KAAK,CAAC;IACjE,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { GitMain } from './git.main.runtime';
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { GitMain } from './git.main.runtime';
3
3
  type SetGitMergeDriverFlags = {
4
4
  global?: boolean;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","SetGitMergeDriverCmd","constructor","git","report","_args","flags","res","setGitMergeDriver","chalk","green","red","exports"],"sources":["set-git-merge-driver.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'set-merge-driver';\n\ntype SetGitMergeDriverFlags = {\n global?: boolean;\n};\n\nexport class SetGitMergeDriverCmd implements Command {\n name = COMMAND_NAME;\n alias = 'smd';\n description = `setup bit's git merge driver for bitmap files`;\n options = [['g', 'global', 'set the git merge driver globally']] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report(_args, flags: SetGitMergeDriverFlags) {\n const res = await this.git.setGitMergeDriver(flags);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1B,MAAMgB,YAAY,GAAG,kBAAkB;AAMhC,MAAMC,oBAAoB,CAAoB;EAOnD;;EAEAC,WAAWA,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAArB,eAAA,eARzBkB,YAAY;IAAAlB,eAAA,gBACX,KAAK;IAAAA,eAAA,sBACC,+CAA+C;IAAAA,eAAA,kBACnD,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,mCAAmC,CAAC,CAAC;IAAAA,eAAA,gBACxD,iBAAiB;IAAAA,eAAA,mBACH,EAAE;EAGW;EAEnC,MAAMsB,MAAMA,CAACC,KAAK,EAAEC,KAA6B,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACJ,GAAG,CAACK,iBAAiB,CAACF,KAAK,CAAC;IACnD,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAACC,OAAA,CAAAX,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","SetGitMergeDriverCmd","constructor","git","report","_args","flags","res","setGitMergeDriver","chalk","green","red","exports"],"sources":["set-git-merge-driver.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport type { GitMain } from './git.main.runtime';\n\nconst COMMAND_NAME = 'set-merge-driver';\n\ntype SetGitMergeDriverFlags = {\n global?: boolean;\n};\n\nexport class SetGitMergeDriverCmd implements Command {\n name = COMMAND_NAME;\n alias = 'smd';\n description = `setup bit's git merge driver for bitmap files`;\n options = [['g', 'global', 'set the git merge driver globally']] as CommandOptions;\n group = 'workspace-tools';\n commands: Command[] = [];\n // helpUrl = '';\n\n constructor(private git: GitMain) {}\n\n async report(_args, flags: SetGitMergeDriverFlags) {\n const res = await this.git.setGitMergeDriver(flags);\n if (res) {\n return chalk.green('git merge driver was successfully set');\n }\n return chalk.red('git merge driver was not set');\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1B,MAAMgB,YAAY,GAAG,kBAAkB;AAMhC,MAAMC,oBAAoB,CAAoB;EAOnD;;EAEAC,WAAWA,CAASC,GAAY,EAAE;IAAA,KAAdA,GAAY,GAAZA,GAAY;IAAArB,eAAA,eARzBkB,YAAY;IAAAlB,eAAA,gBACX,KAAK;IAAAA,eAAA,sBACC,+CAA+C;IAAAA,eAAA,kBACnD,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,mCAAmC,CAAC,CAAC;IAAAA,eAAA,gBACxD,iBAAiB;IAAAA,eAAA,mBACH,EAAE;EAGW;EAEnC,MAAMsB,MAAMA,CAACC,KAAK,EAAEC,KAA6B,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACJ,GAAG,CAACK,iBAAiB,CAACF,KAAK,CAAC;IACnD,IAAIC,GAAG,EAAE;MACP,OAAOE,gBAAK,CAACC,KAAK,CAAC,uCAAuC,CAAC;IAC7D;IACA,OAAOD,gBAAK,CAACE,GAAG,CAAC,8BAA8B,CAAC;EAClD;AACF;AAACC,OAAA,CAAAX,oBAAA,GAAAA,oBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/git",
3
- "version": "0.0.0-cb69adb1211b515e7c3434314b44eba34d90bbf9",
3
+ "version": "0.0.0-d126cf426c7ab9ba9d6785e91a5fe62bf54a3a7c",
4
4
  "homepage": "https://bit.cloud/teambit/git/git",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.git",
8
8
  "name": "git",
9
- "version": "cb69adb1211b515e7c3434314b44eba34d90bbf9"
9
+ "version": "d126cf426c7ab9ba9d6785e91a5fe62bf54a3a7c"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -14,13 +14,13 @@
14
14
  "fs-extra": "10.0.0",
15
15
  "@teambit/harmony": "0.4.7",
16
16
  "@teambit/bit-error": "0.0.404",
17
- "@teambit/cli": "0.0.0-ae5382ca79387782f52cb390e51e7bb72b4de1a9",
18
- "@teambit/workspace": "0.0.0-cc233e5023a8f3bb3e355adf4753e0a1ec97c8a4"
17
+ "@teambit/cli": "0.0.0-7ff5f9809e493c472c849b9c0c6374f1d09a9a4c",
18
+ "@teambit/workspace": "0.0.0-055c6483532055c0e3fd7c8642a39795927ea115"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/fs-extra": "9.0.7",
22
22
  "@types/mocha": "9.1.0",
23
- "@teambit/harmony.envs.core-aspect-env": "0.0.69"
23
+ "@teambit/harmony.envs.core-aspect-env": "0.0.72"
24
24
  },
25
25
  "peerDependencies": {},
26
26
  "license": "Apache-2.0",