@teambit/cli 0.0.453 → 0.0.454

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.
@@ -5,7 +5,8 @@ export declare class CLIParser {
5
5
  private commands;
6
6
  private groups;
7
7
  parser: yargs.Argv<{}>;
8
- constructor(commands: Command[], groups: GroupsType, parser?: yargs.Argv<{}>);
8
+ private docsDomain;
9
+ constructor(commands: Command[], groups: GroupsType, parser: yargs.Argv<{}>, docsDomain: string);
9
10
  parse(args?: string[]): Promise<void>;
10
11
  private setHelpMiddleware;
11
12
  private handleCommandFailure;
@@ -126,10 +126,11 @@ function _commandNotFound() {
126
126
  }
127
127
 
128
128
  class CLIParser {
129
- constructor(commands, groups, parser = _yargs().default) {
129
+ constructor(commands, groups, parser = _yargs().default, docsDomain) {
130
130
  this.commands = commands;
131
131
  this.groups = groups;
132
132
  this.parser = parser;
133
+ this.docsDomain = docsDomain;
133
134
  }
134
135
 
135
136
  async parse(args = process.argv.slice(2)) {
@@ -215,7 +216,7 @@ class CLIParser {
215
216
  }
216
217
 
217
218
  printHelp() {
218
- const help = (0, _help().formatHelp)(this.commands, this.groups); // eslint-disable-next-line no-console
219
+ const help = (0, _help().formatHelp)(this.commands, this.groups, this.docsDomain); // eslint-disable-next-line no-console
219
220
 
220
221
  console.log(help);
221
222
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["cli-parser.ts"],"names":["CLIParser","constructor","commands","groups","parser","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","middleware","_","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","startsWith","includes","consumer","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","parserConfiguration","yarnCommand","builder","cmd","subCommand","YargsAdapter","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","cmdLine","description","options","globalOptions","subCommands","optionsStarted","globalStarted","subCommandsStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","optionsStr","subCommandsStr","descriptionColored","desc","extendedDescription","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","find"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,SAAN,CAAgB;AACrBC,EAAAA,WAAW,CAASC,QAAT,EAAsCC,MAAtC,EAAiEC,MAAM,GAAGC,gBAA1E,EAAiF;AAAA,SAAxEH,QAAwE,GAAxEA,QAAwE;AAAA,SAA3CC,MAA2C,GAA3CA,MAA2C;AAAA,SAAhBC,MAAgB,GAAhBA,MAAgB;AAAE;;AAEnF,QAALE,KAAK,CAACC,IAAI,GAAGC,OAAO,CAACC,IAAR,CAAaC,KAAb,CAAmB,CA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;;AACA5E,IAAAA,OAAO,CAACC,GAAR,CAAY4E,WAAZ;AACD;;AAEO9B,EAAAA,iBAAiB,GAAwB;AAC/C,UAAMnF,IAAI,GAAGC,OAAO,CAACC,IAAR,CAAaC,KAAb,CAAmB,CAAnB,CAAb;AACA,UAAM+G,cAAc,GAAGlH,IAAI,CAAC,CAAD,CAA3B;AACA,UAAMmH,iBAAiB,GAAGnH,IAAI,CAAC,CAAD,CAA9B;;AACA,QAAI,CAACkH,cAAL,EAAqB;AACnB,aAAOE,SAAP;AACD;;AACD,UAAMC,cAAc,GAAG,CAAC9D,GAAD,EAAe+D,GAAf,KAA+B;AACpD,aACE/D,GAAG,CAACa,IAAJ,CAASvB,UAAT,CAAqB,GAAEyE,GAAI,GAA3B,KAAkC;AAClC/D,MAAAA,GAAG,CAACa,IAAJ,KAAakD,GADb,IACoB;AACpB/D,MAAAA,GAAG,CAACK,KAAJ,KAAc0D,GAHhB,CADoD,CAKjD;AACJ,KAND;;AAOA,UAAM3G,OAAO,GAAG,KAAKhB,QAAL,CAAc4H,IAAd,CAAoBhE,GAAD,IAAS8D,cAAc,CAAC9D,GAAD,EAAM2D,cAAN,CAA1C,CAAhB;;AACA,QAAI,CAACvG,OAAL,EAAc;AACZ,aAAOyG,SAAP;AACD;;AACD,QAAI,CAACzG,OAAO,CAAChB,QAAT,IAAqB,CAACwH,iBAA1B,EAA6C;AAC3C,aAAOxG,OAAP,CAD2C,CAC3B;AACjB;;AACD,UAAM6C,UAAU,GAAG7C,OAAO,CAAChB,QAAR,CAAiB4H,IAAjB,CAAuBhE,GAAD,IAAS8D,cAAc,CAAC9D,GAAD,EAAM4D,iBAAN,CAA7C,CAAnB;AACA,WAAO3D,UAAU,IAAI7C,OAArB;AACD;;AAjPoB","sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs, { CommandModule } from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\n\nexport class CLIParser {\n constructor(private commands: Command[], private groups: GroupsType, public parser = yargs) {}\n\n async parse(args = process.argv.slice(2)) {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n yargs.command(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n // this is the main help page\n this.printHelp();\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n if (!logger.isDaemon) process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n yargs.showHelp(this.logCommandHelp.bind(this));\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n if (!logger.isDaemon) process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp() {\n const help = formatHelp(this.commands, this.groups);\n // eslint-disable-next-line no-console\n console.log(help);\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n yarnCommand.builder = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n return yargs;\n };\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): CommandModule {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.handler = yarnCommand.handler.bind(yarnCommand);\n\n return yarnCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n */\n private logCommandHelp(help: string) {\n const command = this.findCommandByArgv();\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in yellow\n const descriptionColored = description.map((desc) => chalk.yellow(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${subCommandsStr}${optionsStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n // eslint-disable-next-line no-console\n console.log(finalOutput);\n }\n\n private findCommandByArgv(): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = this.commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n }\n}\n"]}
1
+ {"version":3,"sources":["cli-parser.ts"],"names":["CLIParser","constructor","commands","groups","parser","yargs","docsDomain","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","middleware","_","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","startsWith","includes","consumer","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","parserConfiguration","yarnCommand","builder","cmd","subCommand","YargsAdapter","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","cmdLine","description","options","globalOptions","subCommands","optionsStarted","globalStarted","subCommandsStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","optionsStr","subCommandsStr","descriptionColored","desc","extendedDescription","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","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AAG,CAAC9D,GAAD,EAAe+D,GAAf,KAA+B;AACpD,aACE/D,GAAG,CAACa,IAAJ,CAASvB,UAAT,CAAqB,GAAEyE,GAAI,GAA3B,KAAkC;AAClC/D,MAAAA,GAAG,CAACa,IAAJ,KAAakD,GADb,IACoB;AACpB/D,MAAAA,GAAG,CAACK,KAAJ,KAAc0D,GAHhB,CADoD,CAKjD;AACJ,KAND;;AAOA,UAAM3G,OAAO,GAAG,KAAKjB,QAAL,CAAc6H,IAAd,CAAoBhE,GAAD,IAAS8D,cAAc,CAAC9D,GAAD,EAAM2D,cAAN,CAA1C,CAAhB;;AACA,QAAI,CAACvG,OAAL,EAAc;AACZ,aAAOyG,SAAP;AACD;;AACD,QAAI,CAACzG,OAAO,CAACjB,QAAT,IAAqB,CAACyH,iBAA1B,EAA6C;AAC3C,aAAOxG,OAAP,CAD2C,CAC3B;AACjB;;AACD,UAAM6C,UAAU,GAAG7C,OAAO,CAACjB,QAAR,CAAiB6H,IAAjB,CAAuBhE,GAAD,IAAS8D,cAAc,CAAC9D,GAAD,EAAM4D,iBAAN,CAA7C,CAAnB;AACA,WAAO3D,UAAU,IAAI7C,OAArB;AACD;;AAtPoB","sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs, { CommandModule } from 'yargs';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\n\nexport class CLIParser {\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n public parser = yargs,\n private docsDomain: string\n ) {}\n\n async parse(args = process.argv.slice(2)) {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n yargs.command(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n // this is the main help page\n this.printHelp();\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n if (!logger.isDaemon) process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n yargs.showHelp(this.logCommandHelp.bind(this));\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n if (!logger.isDaemon) process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp() {\n const help = formatHelp(this.commands, this.groups, this.docsDomain);\n // eslint-disable-next-line no-console\n console.log(help);\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n yarnCommand.builder = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n return yargs;\n };\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): CommandModule {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.handler = yarnCommand.handler.bind(yarnCommand);\n\n return yarnCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n */\n private logCommandHelp(help: string) {\n const command = this.findCommandByArgv();\n\n const replacer = (_, p1, p2) => `${p1}${chalk.green(p2)}`;\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((opt) => opt.replace(/(--)([\\w-]+)/, replacer).replace(/(-)([\\w-]+)/, replacer));\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in yellow\n const descriptionColored = description.map((desc) => chalk.yellow(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${subCommandsStr}${optionsStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n // eslint-disable-next-line no-console\n console.log(finalOutput);\n }\n\n private findCommandByArgv(): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = this.commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n }\n}\n"]}
package/dist/cli.cmd.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare class CliGenerateCmd implements Command {
14
14
  }
15
15
  export declare class CliCmd implements Command {
16
16
  private cliMain;
17
+ private docsDomain;
17
18
  name: string;
18
19
  description: string;
19
20
  alias: string;
@@ -21,6 +22,6 @@ export declare class CliCmd implements Command {
21
22
  loader: boolean;
22
23
  group: string;
23
24
  options: CommandOptions;
24
- constructor(cliMain: CLIMain);
25
+ constructor(cliMain: CLIMain, docsDomain: string);
25
26
  report(): Promise<string>;
26
27
  }
package/dist/cli.cmd.js CHANGED
@@ -108,8 +108,9 @@ class CliGenerateCmd {
108
108
  exports.CliGenerateCmd = CliGenerateCmd;
109
109
 
110
110
  class CliCmd {
111
- constructor(cliMain) {
111
+ constructor(cliMain, docsDomain) {
112
112
  this.cliMain = cliMain;
113
+ this.docsDomain = docsDomain;
113
114
  (0, _defineProperty2().default)(this, "name", 'cli');
114
115
  (0, _defineProperty2().default)(this, "description", 'EXPERIMENTAL. enters bit cli program and generates commands list');
115
116
  (0, _defineProperty2().default)(this, "alias", '');
@@ -129,7 +130,7 @@ class CliCmd {
129
130
  completer: (line, cb) => completer(line, cb, this.cliMain)
130
131
  });
131
132
 
132
- const cliParser = new (_cliParser().CLIParser)(this.cliMain.commands, this.cliMain.groups);
133
+ const cliParser = new (_cliParser().CLIParser)(this.cliMain.commands, this.cliMain.groups, undefined, this.docsDomain);
133
134
  rl.prompt();
134
135
  return new Promise(resolve => {
135
136
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
@@ -1 +1 @@
1
- {"version":3,"sources":["cli.cmd.ts"],"names":["CliGenerateCmd","constructor","cliMain","report","args","metadata","GenerateCommandsDoc","commands","generate","CliCmd","logger","isDaemon","rl","readline","createInterface","input","process","stdin","output","stdout","prompt","completer","line","cb","cliParser","CLIParser","groups","Promise","resolve","on","cmd","trim","split","parse","err","lineSplit","values","length","completeCommand","then","consumer","comps","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","filter","c","includes","catch","name","startsWith"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AARA;AAUO,MAAMA,cAAN,CAAwC;AAc7CC,EAAAA,WAAW,CAASC,OAAT,EAA2B;AAAA,SAAlBA,OAAkB,GAAlBA,OAAkB;AAAA,kDAb/B,UAa+B;AAAA,yDAZxB,8DAYwB;AAAA,mDAX9B,EAW8B;AAAA,oDAV7B,KAU6B;AAAA,mDAT9B,SAS8B;AAAA,qDAR5B,CACR,CACE,EADF,EAEE,UAFF,EAGE,gIAHF,CADQ,CAQ4B;AAAE;;AAE5B,QAANC,MAAM,CAACC,IAAD,EAAO;AAAEC,IAAAA;AAAF,GAAP,EAAoD;AAC9D,WAAO,KAAIC,oCAAJ,EAAwB,KAAKJ,OAAL,CAAaK,QAArC,EAA+C;AAAEF,MAAAA;AAAF,KAA/C,EAA6DG,QAA7D,EAAP;AACD;;AAlB4C;;;;AAqBxC,MAAMC,MAAN,CAAgC;AASrCR,EAAAA,WAAW,CAASC,OAAT,EAA2B;AAAA,SAAlBA,OAAkB,GAAlBA,OAAkB;AAAA,kDAR/B,KAQ+B;AAAA,yDAPxB,kEAOwB;AAAA,mDAN9B,EAM8B;AAAA,sDALhB,EAKgB;AAAA,oDAJ7B,KAI6B;AAAA,mDAH9B,SAG8B;AAAA,qDAF5B,EAE4B;AAAE;;AAE5B,QAANC,M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AvB;;AACA,MAAID,SAAS,CAACE,MAAV,IAAoB,CAAxB,EAA2B;AACzBD,IAAAA,MAAM,GAAGE,eAAe,CAAChB,IAAD,EAAOpB,OAAP,CAAxB;AACAqB,IAAAA,EAAE,CAAC,IAAD,EAAO,CAACa,MAAD,EAASd,IAAT,CAAP,CAAF;AACD;;AACD,yCACGiB,IADH,CACSC,QAAD,IAAc;AAClB,UAAMC,KAAK,GAAG,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEE,wBAAV,CAAmCC,GAAnC,CAAwCC,EAAD,IAAQA,EAAE,CAACC,sBAAH,EAA/C,MAA+E,EAA7F;AACAT,IAAAA,MAAM,GAAGK,KAAK,CAACK,MAAN,CAAcC,CAAD,IAAOA,CAAC,CAACC,QAAF,CAAWb,SAAS,CAAC,CAAD,CAApB,CAApB,CAAT,CAFkB,CAGlB;;AACAZ,IAAAA,EAAE,CAAC,IAAD,EAAO,CAACa,MAAD,EAASd,IAAT,CAAP,CAAF;AACD,GANH,EAOG2B,KAPH,CAOUf,GAAD,IAAS;AACd;AACAX,IAAAA,EAAE,CAACW,GAAD,EAAM,CAAC,EAAD,EAAKZ,IAAL,CAAN,CAAF;AACD,GAVH;AAWD;;AAED,SAASgB,eAAT,CAAyBhB,IAAzB,EAAuCpB,OAAvC,EAAmE;AACjE,QAAMK,QAAQ,GAAGL,OAAO,CAACK,QAAR,CAAiBuC,MAAjB,CAAyBhB,GAAD,IAASA,GAAG,CAACoB,IAAJ,CAASC,UAAT,CAAoB7B,IAApB,CAAjC,CAAjB;AACA,SAAOf,QAAQ,CAACoC,GAAT,CAAcI,CAAD,IAAOA,CAAC,CAACG,IAAtB,EAA4BP,GAA5B,CAAiCO,IAAD,IAAUA,IAAI,CAAClB,KAAL,CAAW,GAAX,EAAgB,CAAhB,CAA1C,CAAP;AACD","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport readline from 'readline';\nimport { CLIParser } from './cli-parser';\nimport { CLIMain } from './cli.main.runtime';\nimport { GenerateCommandsDoc, GenerateOpts } from './generate-doc-md';\n\nexport class CliGenerateCmd implements Command {\n name = 'generate';\n description = 'EXPERIMENTAL. generate an .md file with all commands details';\n alias = '';\n loader = false;\n group = 'general';\n options = [\n [\n '',\n 'metadata',\n 'metadata/front-matter to place at the top of the .md file, enter as an object e.g. --metadata.id=cli --metadata.title=commands',\n ],\n ] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report(args, { metadata }: GenerateOpts): Promise<string> {\n return new GenerateCommandsDoc(this.cliMain.commands, { metadata }).generate();\n }\n}\n\nexport class CliCmd implements Command {\n name = 'cli';\n description = 'EXPERIMENTAL. enters bit cli program and generates commands list';\n alias = '';\n commands: Command[] = [];\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report(): Promise<string> {\n logger.isDaemon = true;\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n prompt: 'bit > ',\n completer: (line, cb) => completer(line, cb, this.cliMain),\n });\n\n const cliParser = new CLIParser(this.cliMain.commands, this.cliMain.groups);\n\n rl.prompt();\n\n return new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n rl.on('line', async (line) => {\n const cmd = line.trim().split(' ');\n try {\n await cliParser.parse(cmd);\n } catch (err: any) {\n await handleErrorAndExit(err, cmd[0]);\n }\n rl.prompt();\n }).on('close', () => {\n resolve('Have a great day!');\n });\n });\n }\n}\n\nfunction completer(line: string, cb: Function, cliMain: CLIMain) {\n const lineSplit = line.split(' ');\n let values: string[] = [];\n if (lineSplit.length <= 1) {\n values = completeCommand(line, cliMain);\n cb(null, [values, line]);\n }\n loadConsumerIfExist()\n .then((consumer) => {\n const comps = consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()) || [];\n values = comps.filter((c) => c.includes(lineSplit[1]));\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(null, [values, line]);\n })\n .catch((err) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err, [[], line]);\n });\n}\n\nfunction completeCommand(line: string, cliMain: CLIMain): string[] {\n const commands = cliMain.commands.filter((cmd) => cmd.name.startsWith(line));\n return commands.map((c) => c.name).map((name) => name.split(' ')[0]);\n}\n"]}
1
+ {"version":3,"sources":["cli.cmd.ts"],"names":["CliGenerateCmd","constructor","cliMain","report","args","metadata","GenerateCommandsDoc","commands","generate","CliCmd","docsDomain","logger","isDaemon","rl","readline","createInterface","input","process","stdin","output","stdout","prompt","completer","line","cb","cliParser","CLIParser","groups","undefined","Promise","resolve","on","cmd","trim","split","parse","err","lineSplit","values","length","completeCommand","then","consumer","comps","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","filter","c","includes","catch","name","startsWith"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AARA;AAUO,MAAMA,cAAN,CAAwC;AAc7CC,EAAAA,WAAW,CAASC,OAAT,EAA2B;AAAA,SAAlBA,OAAkB,GAAlBA,OAAkB;AAAA,kDAb/B,UAa+B;AAAA,yDAZxB,8DAYwB;AAAA,mDAX9B,EAW8B;AAAA,oDAV7B,KAU6B;AAAA,mDAT9B,SAS8B;AAAA,qDAR5B,CACR,CACE,EADF,EAEE,UAFF,EAGE,gIAHF,CADQ,CAQ4B;AAAE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,KAPH,CAOUf,GAAD,IAAS;AACd;AACAZ,IAAAA,EAAE,CAACY,GAAD,EAAM,CAAC,EAAD,EAAKb,IAAL,CAAN,CAAF;AACD,GAVH;AAWD;;AAED,SAASiB,eAAT,CAAyBjB,IAAzB,EAAuCrB,OAAvC,EAAmE;AACjE,QAAMK,QAAQ,GAAGL,OAAO,CAACK,QAAR,CAAiByC,MAAjB,CAAyBhB,GAAD,IAASA,GAAG,CAACoB,IAAJ,CAASC,UAAT,CAAoB9B,IAApB,CAAjC,CAAjB;AACA,SAAOhB,QAAQ,CAACsC,GAAT,CAAcI,CAAD,IAAOA,CAAC,CAACG,IAAtB,EAA4BP,GAA5B,CAAiCO,IAAD,IAAUA,IAAI,CAAClB,KAAL,CAAW,GAAX,EAAgB,CAAhB,CAA1C,CAAP;AACD","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport readline from 'readline';\nimport { CLIParser } from './cli-parser';\nimport { CLIMain } from './cli.main.runtime';\nimport { GenerateCommandsDoc, GenerateOpts } from './generate-doc-md';\n\nexport class CliGenerateCmd implements Command {\n name = 'generate';\n description = 'EXPERIMENTAL. generate an .md file with all commands details';\n alias = '';\n loader = false;\n group = 'general';\n options = [\n [\n '',\n 'metadata',\n 'metadata/front-matter to place at the top of the .md file, enter as an object e.g. --metadata.id=cli --metadata.title=commands',\n ],\n ] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report(args, { metadata }: GenerateOpts): Promise<string> {\n return new GenerateCommandsDoc(this.cliMain.commands, { metadata }).generate();\n }\n}\n\nexport class CliCmd implements Command {\n name = 'cli';\n description = 'EXPERIMENTAL. enters bit cli program and generates commands list';\n alias = '';\n commands: Command[] = [];\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain, private docsDomain: string) {}\n\n async report(): Promise<string> {\n logger.isDaemon = true;\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n prompt: 'bit > ',\n completer: (line, cb) => completer(line, cb, this.cliMain),\n });\n\n const cliParser = new CLIParser(this.cliMain.commands, this.cliMain.groups, undefined, this.docsDomain);\n\n rl.prompt();\n\n return new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n rl.on('line', async (line) => {\n const cmd = line.trim().split(' ');\n try {\n await cliParser.parse(cmd);\n } catch (err: any) {\n await handleErrorAndExit(err, cmd[0]);\n }\n rl.prompt();\n }).on('close', () => {\n resolve('Have a great day!');\n });\n });\n }\n}\n\nfunction completer(line: string, cb: Function, cliMain: CLIMain) {\n const lineSplit = line.split(' ');\n let values: string[] = [];\n if (lineSplit.length <= 1) {\n values = completeCommand(line, cliMain);\n cb(null, [values, line]);\n }\n loadConsumerIfExist()\n .then((consumer) => {\n const comps = consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()) || [];\n values = comps.filter((c) => c.includes(lineSplit[1]));\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(null, [values, line]);\n })\n .catch((err) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err, [[], line]);\n });\n}\n\nfunction completeCommand(line: string, cliMain: CLIMain): string[] {\n const commands = cliMain.commands.filter((cmd) => cmd.name.startsWith(line));\n return commands.map((c) => c.name).map((name) => name.split(' ')[0]);\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { SlotRegistry } from '@teambit/harmony';
2
2
  import { Command } from '@teambit/legacy/dist/cli/command';
3
+ import type { CommunityMain } from '@teambit/community';
3
4
  import { GroupsType } from '@teambit/legacy/dist/cli/command-groups';
4
5
  export declare type CommandList = Array<Command>;
5
6
  export declare type OnStart = (hasWorkspace: boolean) => Promise<void>;
@@ -8,8 +9,9 @@ export declare type CommandsSlot = SlotRegistry<CommandList>;
8
9
  export declare class CLIMain {
9
10
  private commandsSlot;
10
11
  private onStartSlot;
12
+ private community;
11
13
  groups: GroupsType;
12
- constructor(commandsSlot: CommandsSlot, onStartSlot: OnStartSlot);
14
+ constructor(commandsSlot: CommandsSlot, onStartSlot: OnStartSlot, community: CommunityMain);
13
15
  /**
14
16
  * registers a new command in to the CLI.
15
17
  */
@@ -40,8 +42,8 @@ export declare class CLIMain {
40
42
  run(hasWorkspace: boolean): Promise<void>;
41
43
  private invokeOnStart;
42
44
  private setDefaults;
43
- static dependencies: never[];
45
+ static dependencies: import("@teambit/harmony").Aspect[];
44
46
  static runtime: import("@teambit/harmony").RuntimeDefinition;
45
47
  static slots: (((registerFn: () => string) => SlotRegistry<CommandList>) | ((registerFn: () => string) => SlotRegistry<OnStart>))[];
46
- static provider(deps: any, config: any, [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]): Promise<CLIMain>;
48
+ static provider([community]: [CommunityMain], config: any, [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]): Promise<CLIMain>;
47
49
  }
@@ -57,6 +57,16 @@ function _extensionsLoader() {
57
57
  return data;
58
58
  }
59
59
 
60
+ function _community() {
61
+ const data = require("@teambit/community");
62
+
63
+ _community = function () {
64
+ return data;
65
+ };
66
+
67
+ return data;
68
+ }
69
+
60
70
  function _commandGroups() {
61
71
  const data = require("@teambit/legacy/dist/cli/command-groups");
62
72
 
@@ -159,9 +169,10 @@ function _help() {
159
169
 
160
170
  class CLIMain {
161
171
  // if it's not cloned, it is cached across loadBit() instances
162
- constructor(commandsSlot, onStartSlot) {
172
+ constructor(commandsSlot, onStartSlot, community) {
163
173
  this.commandsSlot = commandsSlot;
164
174
  this.onStartSlot = onStartSlot;
175
+ this.community = community;
165
176
  (0, _defineProperty2().default)(this, "groups", (0, _lodash().clone)(_commandGroups().groups));
166
177
  }
167
178
  /**
@@ -233,7 +244,7 @@ class CLIMain {
233
244
 
234
245
  async run(hasWorkspace) {
235
246
  await this.invokeOnStart(hasWorkspace);
236
- const CliParser = new (_cliParser().CLIParser)(this.commands, this.groups);
247
+ const CliParser = new (_cliParser().CLIParser)(this.commands, this.groups, undefined, this.community.getDocsDomain());
237
248
  await CliParser.parse();
238
249
  }
239
250
 
@@ -261,8 +272,8 @@ class CLIMain {
261
272
  }
262
273
  }
263
274
 
264
- static async provider(deps, config, [commandsSlot, onStartSlot]) {
265
- const cliMain = new CLIMain(commandsSlot, onStartSlot);
275
+ static async provider([community], config, [commandsSlot, onStartSlot]) {
276
+ const cliMain = new CLIMain(commandsSlot, onStartSlot, community);
266
277
  const legacyExtensions = await (0, _extensionsLoader().default)(); // Make sure to register all the hooks actions in the global hooks manager
267
278
 
268
279
  legacyExtensions.forEach(extension => {
@@ -280,8 +291,8 @@ class CLIMain {
280
291
  const legacyCommands = legacyRegistry.commands.concat(legacyRegistry.extensionsCommands || []);
281
292
  const legacyCommandsAdapters = legacyCommands.map(command => new (_legacyCommandAdapter().LegacyCommandAdapter)(command, cliMain));
282
293
  const cliGenerateCmd = new (_cli3().CliGenerateCmd)(cliMain);
283
- const cliCmd = new (_cli3().CliCmd)(cliMain);
284
- const helpCmd = new (_help().HelpCmd)(cliMain);
294
+ const cliCmd = new (_cli3().CliCmd)(cliMain, community.getDocsDomain());
295
+ const helpCmd = new (_help().HelpCmd)(cliMain, community.getDocsDomain());
285
296
  cliCmd.commands.push(cliGenerateCmd);
286
297
  cliMain.register(...legacyCommandsAdapters, new (_completion().CompletionCmd)(), cliCmd, helpCmd);
287
298
  return cliMain;
@@ -290,7 +301,7 @@ class CLIMain {
290
301
  }
291
302
 
292
303
  exports.CLIMain = CLIMain;
293
- (0, _defineProperty2().default)(CLIMain, "dependencies", []);
304
+ (0, _defineProperty2().default)(CLIMain, "dependencies", [_community().CommunityAspect]);
294
305
  (0, _defineProperty2().default)(CLIMain, "runtime", _cli2().MainRuntime);
295
306
  (0, _defineProperty2().default)(CLIMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
296
307
 
@@ -1 +1 @@
1
- {"version":3,"sources":["cli.main.runtime.ts"],"names":["CLIMain","constructor","commandsSlot","onStartSlot","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","name","map","set","values","flat","getCommand","find","registerGroup","description","AlreadyExistsError","registerOnStart","onStartFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","parse","onStartFns","promises","onStart","Promise","all","alias","shortDescription","group","options","private","loader","undefined","internal","provider","deps","config","cliMain","legacyExtensions","extension","registerHookActionsOnHooksManager","extensionsCommands","reduce","acc","curr","length","concat","legacyRegistry","legacyCommands","legacyCommandsAdapters","LegacyCommandAdapter","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","MainRuntime","Slot","withType","CLIAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQO,MAAMA,OAAN,CAAc;AACwB;AAE3CC,EAAAA,WAAW,CAASC,YAAT,EAA6CC,WAA7C,EAAuE;AAAA,SAA9DD,Y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EAAyBxD,OAAzB,EAAkC2C,OAAlC,CAAhC,CAA/B;AACA,UAAMc,cAAc,GAAG,KAAIC,sBAAJ,EAAmBf,OAAnB,CAAvB;AACA,UAAMgB,MAAM,GAAG,KAAIC,cAAJ,EAAWjB,OAAX,CAAf;AACA,UAAMkB,OAAO,GAAG,KAAIC,eAAJ,EAAYnB,OAAZ,CAAhB;AACAgB,IAAAA,MAAM,CAAC7D,QAAP,CAAgBiE,IAAhB,CAAqBN,cAArB;AACAd,IAAAA,OAAO,CAAC9C,QAAR,CAAiB,GAAG0D,sBAApB,EAA4C,KAAIS,2BAAJ,GAA5C,EAAiEL,MAAjE,EAAyEE,OAAzE;AACA,WAAOlB,OAAP;AACD;;AA1HkB;;;gCAARnD,O,kBA6FW,E;gCA7FXA,O,aA8FMyE,mB;gCA9FNzE,O,WA+FI,CAAC0E,gBAAKC,QAAL,EAAD,EAA+BD,gBAAKC,QAAL,EAA/B,C;;AA8BjBC,kBAAUC,UAAV,CAAqB7E,OAArB","sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { buildRegistry } from '@teambit/legacy/dist/cli';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport LegacyLoadExtensions from '@teambit/legacy/dist/legacy-extensions/extensions-loader';\nimport { groups, GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { AlreadyExistsError } from './exceptions/already-exists';\nimport { getCommandId } from './get-command-id';\nimport { LegacyCommandAdapter } from './legacy-command-adapter';\nimport { CLIParser } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean) => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n\n constructor(private commandsSlot: CommandsSlot, private onStartSlot: OnStartSlot) {}\n\n /**\n * registers a new command in to the CLI.\n */\n register(...commands: CommandList) {\n commands.forEach((command) => {\n this.setDefaults(command);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n command.commands!.forEach((cmd) => this.setDefaults(cmd));\n });\n this.commandsSlot.register(commands);\n }\n\n /**\n * helpful for having the same command name in different environments (legacy and Harmony)\n */\n unregister(commandName: string) {\n this.commandsSlot.toArray().forEach(([aspectId, commands]) => {\n const filteredCommands = commands.filter((command) => {\n return getCommandId(command.name) !== commandName;\n });\n this.commandsSlot.map.set(aspectId, filteredCommands);\n });\n }\n\n /**\n * list of all registered commands. (legacy and new).\n */\n get commands(): CommandList {\n return this.commandsSlot.values().flat();\n }\n\n /**\n * get an instance of a registered command. (useful for aspects to modify and extend existing commands)\n */\n getCommand(name: string): Command | undefined {\n return this.commands.find((command) => command.name === name);\n }\n\n /**\n * when running `bit help`, commands are grouped by categories.\n * this method helps registering a new group by providing its name and a description.\n * the name is what needs to be assigned to the `group` property of the Command interface.\n * the description is what shown in the `bit help` output.\n */\n registerGroup(name: string, description: string) {\n if (this.groups[name]) {\n throw new AlreadyExistsError('group', name);\n }\n this.groups[name] = description;\n }\n\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * execute commands registered to this aspect.\n */\n async run(hasWorkspace: boolean) {\n await this.invokeOnStart(hasWorkspace);\n const CliParser = new CLIParser(this.commands, this.groups);\n await CliParser.parse();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const promises = onStartFns.map(async (onStart) => onStart(hasWorkspace));\n return Promise.all(promises);\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.shortDescription = command.shortDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n if (command.loader === undefined) {\n if (command.internal) {\n command.loader = false;\n } else {\n command.loader = true;\n }\n }\n }\n\n static dependencies = [];\n static runtime = MainRuntime;\n static slots = [Slot.withType<CommandList>(), Slot.withType<OnStart>()];\n\n static async provider(deps, config, [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]) {\n const cliMain = new CLIMain(commandsSlot, onStartSlot);\n const legacyExtensions = await LegacyLoadExtensions();\n // Make sure to register all the hooks actions in the global hooks manager\n legacyExtensions.forEach((extension) => {\n extension.registerHookActionsOnHooksManager();\n });\n\n const extensionsCommands = legacyExtensions.reduce((acc, curr) => {\n if (curr.commands && curr.commands.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n acc = acc.concat(curr.commands);\n }\n return acc;\n }, []);\n\n const legacyRegistry = buildRegistry(extensionsCommands);\n const legacyCommands = legacyRegistry.commands.concat(legacyRegistry.extensionsCommands || []);\n const legacyCommandsAdapters = legacyCommands.map((command) => new LegacyCommandAdapter(command, cliMain));\n const cliGenerateCmd = new CliGenerateCmd(cliMain);\n const cliCmd = new CliCmd(cliMain);\n const helpCmd = new HelpCmd(cliMain);\n cliCmd.commands.push(cliGenerateCmd);\n cliMain.register(...legacyCommandsAdapters, new CompletionCmd(), cliCmd, helpCmd);\n return cliMain;\n }\n}\n\nCLIAspect.addRuntime(CLIMain);\n"]}
1
+ {"version":3,"sources":["cli.main.runtime.ts"],"names":["CLIMain","constructor","commandsSlot","onStartSlot","community","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","name","map","set","values","flat","getCommand","find","registerGroup","description","AlreadyExistsError","registerOnStart","onStartFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","undefined","getDocsDomain","parse","onStartFns","promises","onStart","Promise","all","alias","shortDescription","group","options","private","loader","internal","provider","config","cliMain","legacyExtensions","extension","registerHookActionsOnHooksManager","extensionsCommands","reduce","acc","curr","length","concat","legacyRegistry","legacyCommands","legacyCommandsAdapters","LegacyCommandAdapter","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","CommunityAspect","MainRuntime","Slot","withType","CLIAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQO,MAAMA,OAAN,CAAc;AACwB;AAE3CC,EAAAA,WAAW,CAASC,YAAT,EAA6CC,WAA7C,EAA+EC,SAA/E,EAAyG;AAAA,SAAhGF,YAAgG,GAAhGA,YAAgG;AAAA,SAA5DC,WAA4D,GAA5DA,WAA4D;AAAA,SAA1BC,SAA0B,GAA1BA,SAA0B;AAAA,oDAFxF,qBAAMC,uBAAN,CAEwF;AAAE;AAEtH;AACF;AACA;;;AACEC,EAAAA,QAAQ,CAAC,GAAGC,QAAJ,EAA2B;AACjCA,IAAAA,QAAQ,CAACC,OAAT,CAAkBC,OAAD,IAAa;AAC5B,WAAKC,WAAL,CAAi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,EAAoBhD,SAAS,CAACgC,aAAV,EAApB,CAAf;AACA,UAAMkC,OAAO,GAAG,KAAIC,eAAJ,EAAYnB,OAAZ,EAAqBhD,SAAS,CAACgC,aAAV,EAArB,CAAhB;AACAgC,IAAAA,MAAM,CAAC7D,QAAP,CAAgBiE,IAAhB,CAAqBN,cAArB;AACAd,IAAAA,OAAO,CAAC9C,QAAR,CAAiB,GAAG0D,sBAApB,EAA4C,KAAIS,2BAAJ,GAA5C,EAAiEL,MAAjE,EAAyEE,OAAzE;AACA,WAAOlB,OAAP;AACD;;AA9HkB;;;gCAARpD,O,kBA6FW,CAAC0E,4BAAD,C;gCA7FX1E,O,aA8FM2E,mB;gCA9FN3E,O,WA+FI,CAAC4E,gBAAKC,QAAL,EAAD,EAA+BD,gBAAKC,QAAL,EAA/B,C;;AAkCjBC,kBAAUC,UAAV,CAAqB/E,OAArB","sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { buildRegistry } from '@teambit/legacy/dist/cli';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport LegacyLoadExtensions from '@teambit/legacy/dist/legacy-extensions/extensions-loader';\nimport { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\n\nimport { groups, GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { AlreadyExistsError } from './exceptions/already-exists';\nimport { getCommandId } from './get-command-id';\nimport { LegacyCommandAdapter } from './legacy-command-adapter';\nimport { CLIParser } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean) => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n\n constructor(private commandsSlot: CommandsSlot, private onStartSlot: OnStartSlot, private community: CommunityMain) {}\n\n /**\n * registers a new command in to the CLI.\n */\n register(...commands: CommandList) {\n commands.forEach((command) => {\n this.setDefaults(command);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n command.commands!.forEach((cmd) => this.setDefaults(cmd));\n });\n this.commandsSlot.register(commands);\n }\n\n /**\n * helpful for having the same command name in different environments (legacy and Harmony)\n */\n unregister(commandName: string) {\n this.commandsSlot.toArray().forEach(([aspectId, commands]) => {\n const filteredCommands = commands.filter((command) => {\n return getCommandId(command.name) !== commandName;\n });\n this.commandsSlot.map.set(aspectId, filteredCommands);\n });\n }\n\n /**\n * list of all registered commands. (legacy and new).\n */\n get commands(): CommandList {\n return this.commandsSlot.values().flat();\n }\n\n /**\n * get an instance of a registered command. (useful for aspects to modify and extend existing commands)\n */\n getCommand(name: string): Command | undefined {\n return this.commands.find((command) => command.name === name);\n }\n\n /**\n * when running `bit help`, commands are grouped by categories.\n * this method helps registering a new group by providing its name and a description.\n * the name is what needs to be assigned to the `group` property of the Command interface.\n * the description is what shown in the `bit help` output.\n */\n registerGroup(name: string, description: string) {\n if (this.groups[name]) {\n throw new AlreadyExistsError('group', name);\n }\n this.groups[name] = description;\n }\n\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * execute commands registered to this aspect.\n */\n async run(hasWorkspace: boolean) {\n await this.invokeOnStart(hasWorkspace);\n const CliParser = new CLIParser(this.commands, this.groups, undefined, this.community.getDocsDomain());\n await CliParser.parse();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const promises = onStartFns.map(async (onStart) => onStart(hasWorkspace));\n return Promise.all(promises);\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.shortDescription = command.shortDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n if (command.loader === undefined) {\n if (command.internal) {\n command.loader = false;\n } else {\n command.loader = true;\n }\n }\n }\n\n static dependencies = [CommunityAspect];\n static runtime = MainRuntime;\n static slots = [Slot.withType<CommandList>(), Slot.withType<OnStart>()];\n\n static async provider(\n [community]: [CommunityMain],\n config,\n [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]\n ) {\n const cliMain = new CLIMain(commandsSlot, onStartSlot, community);\n const legacyExtensions = await LegacyLoadExtensions();\n // Make sure to register all the hooks actions in the global hooks manager\n legacyExtensions.forEach((extension) => {\n extension.registerHookActionsOnHooksManager();\n });\n\n const extensionsCommands = legacyExtensions.reduce((acc, curr) => {\n if (curr.commands && curr.commands.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n acc = acc.concat(curr.commands);\n }\n return acc;\n }, []);\n\n const legacyRegistry = buildRegistry(extensionsCommands);\n const legacyCommands = legacyRegistry.commands.concat(legacyRegistry.extensionsCommands || []);\n const legacyCommandsAdapters = legacyCommands.map((command) => new LegacyCommandAdapter(command, cliMain));\n const cliGenerateCmd = new CliGenerateCmd(cliMain);\n const cliCmd = new CliCmd(cliMain, community.getDocsDomain());\n const helpCmd = new HelpCmd(cliMain, community.getDocsDomain());\n cliCmd.commands.push(cliGenerateCmd);\n cliMain.register(...legacyCommandsAdapters, new CompletionCmd(), cliCmd, helpCmd);\n return cliMain;\n }\n}\n\nCLIAspect.addRuntime(CLIMain);\n"]}
@@ -2,12 +2,13 @@ import { Command, CommandOptions } from '@teambit/cli';
2
2
  import { CLIMain } from './cli.main.runtime';
3
3
  export declare class HelpCmd implements Command {
4
4
  private cliMain;
5
+ private docsDomain;
5
6
  name: string;
6
7
  description: string;
7
8
  alias: string;
8
9
  loader: boolean;
9
10
  group: string;
10
11
  options: CommandOptions;
11
- constructor(cliMain: CLIMain);
12
+ constructor(cliMain: CLIMain, docsDomain: string);
12
13
  report(): Promise<string>;
13
14
  }
package/dist/help.cmd.js CHANGED
@@ -31,8 +31,9 @@ function _help() {
31
31
 
32
32
  class HelpCmd {
33
33
  // default command (meaning, if no args are provided, this will be used), see https://github.com/yargs/yargs/blob/master/docs/advanced.md#default-commands
34
- constructor(cliMain) {
34
+ constructor(cliMain, docsDomain) {
35
35
  this.cliMain = cliMain;
36
+ this.docsDomain = docsDomain;
36
37
  (0, _defineProperty2().default)(this, "name", 'help');
37
38
  (0, _defineProperty2().default)(this, "description", 'shows help');
38
39
  (0, _defineProperty2().default)(this, "alias", '$0');
@@ -42,7 +43,7 @@ class HelpCmd {
42
43
  }
43
44
 
44
45
  async report() {
45
- return (0, _help().formatHelp)(this.cliMain.commands, this.cliMain.groups);
46
+ return (0, _help().formatHelp)(this.cliMain.commands, this.cliMain.groups, this.docsDomain);
46
47
  }
47
48
 
48
49
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["help.cmd.ts"],"names":["HelpCmd","constructor","cliMain","report","commands","groups"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,OAAN,CAAiC;AAGxB;AAKdC,EAAAA,WAAW,CAASC,OAAT,EAA2B;AAAA,SAAlBA,OAAkB,GAAlBA,OAAkB;AAAA,kDAP/B,MAO+B;AAAA,yDANxB,YAMwB;AAAA,mDAL9B,IAK8B;AAAA,oDAJ7B,KAI6B;AAAA,mDAH9B,SAG8B;AAAA,qDAF5B,EAE4B;AAAE;;AAE5B,QAANC,MAAM,GAAG;AACb,WAAO,wBAAW,KAAKD,OAAL,CAAaE,QAAxB,EAAkC,KAAKF,OAAL,CAAaG,MAA/C,CAAP;AACD;;AAZqC","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { CLIMain } from './cli.main.runtime';\nimport { formatHelp } from './help';\n\nexport class HelpCmd implements Command {\n name = 'help';\n description = 'shows help';\n alias = '$0'; // default command (meaning, if no args are provided, this will be used), see https://github.com/yargs/yargs/blob/master/docs/advanced.md#default-commands\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report() {\n return formatHelp(this.cliMain.commands, this.cliMain.groups);\n }\n}\n"]}
1
+ {"version":3,"sources":["help.cmd.ts"],"names":["HelpCmd","constructor","cliMain","docsDomain","report","commands","groups"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,OAAN,CAAiC;AAGxB;AAKdC,EAAAA,WAAW,CAASC,OAAT,EAAmCC,UAAnC,EAAuD;AAAA,SAA9CD,OAA8C,GAA9CA,OAA8C;AAAA,SAApBC,UAAoB,GAApBA,UAAoB;AAAA,kDAP3D,MAO2D;AAAA,yDANpD,YAMoD;AAAA,mDAL1D,IAK0D;AAAA,oDAJzD,KAIyD;AAAA,mDAH1D,SAG0D;AAAA,qDAFxD,EAEwD;AAAE;;AAExD,QAANC,MAAM,GAAG;AACb,WAAO,wBAAW,KAAKF,OAAL,CAAaG,QAAxB,EAAkC,KAAKH,OAAL,CAAaI,MAA/C,EAAuD,KAAKH,UAA5D,CAAP;AACD;;AAZqC","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { CLIMain } from './cli.main.runtime';\nimport { formatHelp } from './help';\n\nexport class HelpCmd implements Command {\n name = 'help';\n description = 'shows help';\n alias = '$0'; // default command (meaning, if no args are provided, this will be used), see https://github.com/yargs/yargs/blob/master/docs/advanced.md#default-commands\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain, private docsDomain: string) {}\n\n async report() {\n return formatHelp(this.cliMain.commands, this.cliMain.groups, this.docsDomain);\n }\n}\n"]}
package/dist/help.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { GroupsType } from '@teambit/legacy/dist/cli/command-groups';
2
2
  import { CommandList } from './cli.main.runtime';
3
- export declare function formatHelp(commands: CommandList, groups: GroupsType): string;
3
+ export declare function formatHelp(commands: CommandList, groups: GroupsType, docsDomain: string): string;
package/dist/help.js CHANGED
@@ -54,10 +54,10 @@ const TITLE_LEFT_SPACES_NUMBER = 2;
54
54
  const COMMAND_LEFT_SPACES_NUMBER = 4;
55
55
  const NAME_WITH_SPACES_LENGTH = 15;
56
56
 
57
- function formatHelp(commands, groups) {
57
+ function formatHelp(commands, groups, docsDomain) {
58
58
  const helpProps = groupCommands(commands, groups);
59
59
  const commandsStr = formatCommandsHelp(helpProps);
60
- return `${getHeader()}
60
+ return `${getHeader(docsDomain)}
61
61
 
62
62
  ${commandsStr}
63
63
 
@@ -98,10 +98,10 @@ function commandTemplate(name, description) {
98
98
  return res;
99
99
  }
100
100
 
101
- function getHeader() {
101
+ function getHeader(docsDomain) {
102
102
  return `${_chalk().default.bold('usage: bit [--version] [--help] <command> [<args>]')}
103
103
 
104
- ${_chalk().default.yellow('bit documentation: https://harmony-docs.bit.dev')}`;
104
+ ${_chalk().default.yellow(`bit documentation: https://${docsDomain}`)}`;
105
105
  }
106
106
 
107
107
  function getFooter() {
package/dist/help.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["help.ts"],"names":["SPACE","TITLE_LEFT_SPACES_NUMBER","COMMAND_LEFT_SPACES_NUMBER","NAME_WITH_SPACES_LENGTH","formatHelp","commands","groups","helpProps","groupCommands","commandsStr","formatCommandsHelp","getHeader","getFooter","help","filter","command","private","shortDescription","description","reduce","partialHelp","groupName","group","cmdId","name","Object","keys","map","commandsSectionTemplate","join","section","titleSpace","repeat","title","chalk","underline","bold","blue","cmdName","commandTemplate","res","nameSpace","nameWithRightSpace","green","yellow"],"mappings":";;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,KAAK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EsB,iBAAMU,MAAN,CAAa,yFAAb,CAAwG,EAAlH;AACD","sourcesContent":["import chalk from 'chalk';\nimport rightpad from 'pad-right';\nimport { capitalize } from 'lodash';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { CommandList } from './cli.main.runtime';\nimport { getCommandId } from './get-command-id';\n\nconst SPACE = ' ';\nconst TITLE_LEFT_SPACES_NUMBER = 2;\nconst COMMAND_LEFT_SPACES_NUMBER = 4;\nconst NAME_WITH_SPACES_LENGTH = 15;\n\ntype HelpProps = {\n [groupName: string]: GroupContent;\n};\n\ntype GroupContent = {\n commands: { [cmdName: string]: string };\n description: string;\n};\n\nexport function formatHelp(commands: CommandList, groups: GroupsType) {\n const helpProps = groupCommands(commands, groups);\n const commandsStr = formatCommandsHelp(helpProps);\n\n return `${getHeader()}\n\n${commandsStr}\n\n${getFooter()}`;\n}\n\nfunction groupCommands(commands: CommandList, groups: GroupsType): HelpProps {\n const help: HelpProps = commands\n .filter((command) => !command.private && (command.shortDescription || command.description))\n .reduce(function (partialHelp, command) {\n const groupName = command.group as string; // at this stage, it must be set\n partialHelp[groupName] = partialHelp[groupName] || {\n commands: {},\n description: groups[groupName] || capitalize(command.group),\n };\n const cmdId = getCommandId(command.name);\n partialHelp[groupName].commands[cmdId] = command.shortDescription || command.description;\n return partialHelp;\n }, {});\n return help;\n}\n\nfunction formatCommandsHelp(helpProps: HelpProps): string {\n return Object.keys(helpProps)\n .map((groupName) => commandsSectionTemplate(helpProps[groupName]))\n .join('\\n\\n');\n}\n\nfunction commandsSectionTemplate(section: GroupContent): string {\n const titleSpace = SPACE.repeat(TITLE_LEFT_SPACES_NUMBER);\n const title = `${titleSpace}${chalk.underline.bold.blue(section.description)}`;\n const commands = Object.keys(section.commands)\n .map((cmdName) => commandTemplate(cmdName, section.commands[cmdName]))\n .join('\\n');\n const res = `${title}\\n${commands}`;\n return res;\n}\n\nfunction commandTemplate(name: string, description: string): string {\n const nameSpace = SPACE.repeat(COMMAND_LEFT_SPACES_NUMBER);\n const nameWithRightSpace = rightpad(name, NAME_WITH_SPACES_LENGTH, SPACE);\n const res = `${nameSpace}${chalk.green(nameWithRightSpace)}${description}`;\n return res;\n}\n\nfunction getHeader(): string {\n return `${chalk.bold('usage: bit [--version] [--help] <command> [<args>]')}\n\n${chalk.yellow('bit documentation: https://harmony-docs.bit.dev')}`;\n}\n\nfunction getFooter(): string {\n return `${chalk.yellow(\"please use 'bit <command> --help' for more information and guides on specific commands.\")}`;\n}\n"]}
1
+ {"version":3,"sources":["help.ts"],"names":["SPACE","TITLE_LEFT_SPACES_NUMBER","COMMAND_LEFT_SPACES_NUMBER","NAME_WITH_SPACES_LENGTH","formatHelp","commands","groups","docsDomain","helpProps","groupCommands","commandsStr","formatCommandsHelp","getHeader","getFooter","help","filter","command","private","shortDescription","description","reduce","partialHelp","groupName","group","cmdId","name","Object","keys","map","commandsSectionTemplate","join","section","titleSpace","repeat","title","chalk","underline","bold","blue","cmdName","commandTemplate","res","nameSpace","nameWithRightSpace","green","yellow"],"mappings":";;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,KAAK,GAAG,GAAd;AACA,MAAMC,wBAAwB,GAAG,CAAjC;AACA,MAAMC,0BAA0B,GAAG,CAAnC;AACA,MAAMC,uBAAuB,GAAG,EAAhC;;AAWO,SAASC,UAAT,CAAoBC,QAApB,EAA2CC,MAA3C,EAA+DC,UAA/D,EAAmF;AACxF,QAAMC,SAAS,GAAGC,aAAa,CAACJ,QAAD,EAAWC,MAAX,CAA/B;AACA,QAAMI,WAAW,GAAGC,kBAAkB,CAACH,SAAD,CAAtC;AAEA,SAAQ,GAAEI,SAAS,CAACL,UAAD,CAAa;AAClC;AACA,EAAEG,WAA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C,IAAhB,CAAqBC,IAArB,CAA0BP,OAAO,CAACZ,WAAlC,CAA+C,EAA7E;AACA,QAAMd,QAAQ,GAAGqB,MAAM,CAACC,IAAP,CAAYI,OAAO,CAAC1B,QAApB,EACduB,GADc,CACTW,OAAD,IAAaC,eAAe,CAACD,OAAD,EAAUR,OAAO,CAAC1B,QAAR,CAAiBkC,OAAjB,CAAV,CADlB,EAEdT,IAFc,CAET,IAFS,CAAjB;AAGA,QAAMW,GAAG,GAAI,GAAEP,KAAM,KAAI7B,QAAS,EAAlC;AACA,SAAOoC,GAAP;AACD;;AAED,SAASD,eAAT,CAAyBf,IAAzB,EAAuCN,WAAvC,EAAoE;AAClE,QAAMuB,SAAS,GAAG1C,KAAK,CAACiC,MAAN,CAAa/B,0BAAb,CAAlB;AACA,QAAMyC,kBAAkB,GAAG,yBAASlB,IAAT,EAAetB,uBAAf,EAAwCH,KAAxC,CAA3B;AACA,QAAMyC,GAAG,GAAI,GAAEC,SAAU,GAAEP,iBAAMS,KAAN,CAAYD,kBAAZ,CAAgC,GAAExB,WAAY,EAAzE;AACA,SAAOsB,GAAP;AACD;;AAED,SAAS7B,SAAT,CAAmBL,UAAnB,EAA+C;AAC7C,SAAQ,GAAE4B,iBAAME,IAAN,CAAW,oDAAX,CAAiE;AAC7E;AACA,EAAEF,iBAAMU,MAAN,CAAc,8BAA6BtC,UAAW,EAAtD,CAAyD,EAFzD;AAGD;;AAED,SAASM,SAAT,GAA6B;AAC3B,SAAQ,GAAEsB,iBAAMU,MAAN,CAAa,yFAAb,CAAwG,EAAlH;AACD","sourcesContent":["import chalk from 'chalk';\nimport rightpad from 'pad-right';\nimport { capitalize } from 'lodash';\nimport { GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { CommandList } from './cli.main.runtime';\nimport { getCommandId } from './get-command-id';\n\nconst SPACE = ' ';\nconst TITLE_LEFT_SPACES_NUMBER = 2;\nconst COMMAND_LEFT_SPACES_NUMBER = 4;\nconst NAME_WITH_SPACES_LENGTH = 15;\n\ntype HelpProps = {\n [groupName: string]: GroupContent;\n};\n\ntype GroupContent = {\n commands: { [cmdName: string]: string };\n description: string;\n};\n\nexport function formatHelp(commands: CommandList, groups: GroupsType, docsDomain: string) {\n const helpProps = groupCommands(commands, groups);\n const commandsStr = formatCommandsHelp(helpProps);\n\n return `${getHeader(docsDomain)}\n\n${commandsStr}\n\n${getFooter()}`;\n}\n\nfunction groupCommands(commands: CommandList, groups: GroupsType): HelpProps {\n const help: HelpProps = commands\n .filter((command) => !command.private && (command.shortDescription || command.description))\n .reduce(function (partialHelp, command) {\n const groupName = command.group as string; // at this stage, it must be set\n partialHelp[groupName] = partialHelp[groupName] || {\n commands: {},\n description: groups[groupName] || capitalize(command.group),\n };\n const cmdId = getCommandId(command.name);\n partialHelp[groupName].commands[cmdId] = command.shortDescription || command.description;\n return partialHelp;\n }, {});\n return help;\n}\n\nfunction formatCommandsHelp(helpProps: HelpProps): string {\n return Object.keys(helpProps)\n .map((groupName) => commandsSectionTemplate(helpProps[groupName]))\n .join('\\n\\n');\n}\n\nfunction commandsSectionTemplate(section: GroupContent): string {\n const titleSpace = SPACE.repeat(TITLE_LEFT_SPACES_NUMBER);\n const title = `${titleSpace}${chalk.underline.bold.blue(section.description)}`;\n const commands = Object.keys(section.commands)\n .map((cmdName) => commandTemplate(cmdName, section.commands[cmdName]))\n .join('\\n');\n const res = `${title}\\n${commands}`;\n return res;\n}\n\nfunction commandTemplate(name: string, description: string): string {\n const nameSpace = SPACE.repeat(COMMAND_LEFT_SPACES_NUMBER);\n const nameWithRightSpace = rightpad(name, NAME_WITH_SPACES_LENGTH, SPACE);\n const res = `${nameSpace}${chalk.green(nameWithRightSpace)}${description}`;\n return res;\n}\n\nfunction getHeader(docsDomain: string): string {\n return `${chalk.bold('usage: bit [--version] [--help] <command> [<args>]')}\n\n${chalk.yellow(`bit documentation: https://${docsDomain}`)}`;\n}\n\nfunction getFooter(): string {\n return `${chalk.yellow(\"please use 'bit <command> --help' for more information and guides on specific commands.\")}`;\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.453",
3
+ "version": "0.0.454",
4
4
  "homepage": "https://bit.dev/teambit/harmony/cli",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "cli",
9
- "version": "0.0.453"
9
+ "version": "0.0.454"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -18,6 +18,7 @@
18
18
  "pad-right": "0.2.2",
19
19
  "@babel/runtime": "7.12.18",
20
20
  "core-js": "^3.0.0",
21
+ "@teambit/community": "0.0.2",
21
22
  "@teambit/bit-error": "0.0.394"
22
23
  },
23
24
  "devDependencies": {
@@ -32,7 +33,7 @@
32
33
  "@types/node": "12.20.4"
33
34
  },
34
35
  "peerDependencies": {
35
- "@teambit/legacy": "1.0.232",
36
+ "@teambit/legacy": "1.0.233",
36
37
  "react-dom": "^16.8.0 || ^17.0.0",
37
38
  "react": "^16.8.0 || ^17.0.0"
38
39
  },
@@ -60,7 +61,7 @@
60
61
  "react": "-"
61
62
  },
62
63
  "peerDependencies": {
63
- "@teambit/legacy": "1.0.232",
64
+ "@teambit/legacy": "1.0.233",
64
65
  "react-dom": "^16.8.0 || ^17.0.0",
65
66
  "react": "^16.8.0 || ^17.0.0"
66
67
  }
@@ -1 +1 @@
1
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.453/dist/cli.docs.md')]
1
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.454/dist/cli.docs.md')]
Binary file