@teambit/cli 0.0.614 → 0.0.616
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/cli-parser.js +4 -3
- package/dist/cli-parser.js.map +1 -1
- package/dist/help.cmd.d.ts +3 -1
- package/dist/help.cmd.js +5 -3
- package/dist/help.cmd.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +4 -4
- package/dist/help.js.map +1 -1
- package/{preview-1669765084342.js → dist/preview-1669911866429.js} +2 -2
- package/package-tar/teambit-cli-0.0.616.tgz +0 -0
- package/package.json +5 -5
- package/package-tar/teambit-cli-0.0.614.tgz +0 -0
package/dist/cli-parser.js
CHANGED
|
@@ -121,8 +121,9 @@ class CLIParser {
|
|
|
121
121
|
setHelpMiddleware() {
|
|
122
122
|
_yargs().default.middleware(argv => {
|
|
123
123
|
if (argv._.length === 0 && argv.help) {
|
|
124
|
+
const shouldShowInternalCommands = Boolean(argv.internal);
|
|
124
125
|
// this is the main help page
|
|
125
|
-
this.printHelp();
|
|
126
|
+
this.printHelp(shouldShowInternalCommands);
|
|
126
127
|
process.exit(0);
|
|
127
128
|
}
|
|
128
129
|
if (argv.help) {
|
|
@@ -163,8 +164,8 @@ class CLIParser {
|
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
printHelp() {
|
|
167
|
-
const help = (0, _help().formatHelp)(this.commands, this.groups, this.docsDomain);
|
|
167
|
+
printHelp(shouldShowInternalCommands = false) {
|
|
168
|
+
const help = (0, _help().formatHelp)(this.commands, this.groups, this.docsDomain, shouldShowInternalCommands);
|
|
168
169
|
// eslint-disable-next-line no-console
|
|
169
170
|
console.log(help);
|
|
170
171
|
}
|
package/dist/cli-parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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","isHelpFlagEntered","includes","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","find"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs 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 const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n }\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 const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.builder = yarnCommand.builder.bind(yarnCommand);\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 * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\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 const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = 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 (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\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 argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\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"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA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F,IAAI,GAAGC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;IAClC,MAAMkI,cAAc,GAAGrI,IAAI,CAAC,CAAC,CAAC;IAC9B,MAAMsI,iBAAiB,GAAGtI,IAAI,CAAC,CAAC,CAAC;IACjC,IAAI,CAACqI,cAAc,EAAE;MACnB,OAAOE,SAAS;IAClB;IACA,MAAMC,cAAc,GAAG,CAAC7E,GAAY,EAAE8E,GAAW,KAAK;MACpD,OACE9E,GAAG,CAACiB,IAAI,CAACrC,UAAU,CAAE,GAAEkG,GAAI,GAAE,CAAC;MAAI;MAClC9E,GAAG,CAACiB,IAAI,KAAK6D,GAAG;MAAI;MACpB9E,GAAG,CAACQ,KAAK,KAAKsE,GAAG,CACjB,CAAC;IACL,CAAC;;IACD,MAAM9H,OAAO,GAAG,IAAI,CAACjB,QAAQ,CAACgJ,IAAI,CAAE/E,GAAG,IAAK6E,cAAc,CAAC7E,GAAG,EAAE0E,cAAc,CAAC,CAAC;IAChF,IAAI,CAAC1H,OAAO,EAAE;MACZ,OAAO4H,SAAS;IAClB;IACA,IAAI,CAAC5H,OAAO,CAACjB,QAAQ,IAAI,CAAC4I,iBAAiB,EAAE;MAC3C,OAAO3H,OAAO,CAAC,CAAC;IAClB;;IACA,MAAMiD,UAAU,GAAGjD,OAAO,CAACjB,QAAQ,CAACgJ,IAAI,CAAE/E,GAAG,IAAK6E,cAAc,CAAC7E,GAAG,EAAE2E,iBAAiB,CAAC,CAAC;IACzF,OAAO1E,UAAU,IAAIjD,OAAO;EAC9B;AACF;AAAC"}
|
|
1
|
+
{"version":3,"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","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","isDaemon","fail","msg","err","stop","isHelpFlagEntered","includes","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","replacer","p1","p2","green","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","i","currentLine","STANDARD_GROUP","push","optionsColored","opt","replace","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str","find"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs 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 const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\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 const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n }\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(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, this.docsDomain, shouldShowInternalCommands);\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 const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n yargs.command(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n yargs.command(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yarnCommand = new YargsAdapter(command);\n yarnCommand.builder = yarnCommand.builder.bind(yarnCommand);\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 * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\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 const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = 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 (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\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 argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\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"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA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O,CAACC,GAAG,CAAC2F,WAAW,CAAC;EAC1B;EAEQzC,iBAAiB,GAAwB;IAC/C,MAAM9F,IAAI,GAAGC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;IAClC,MAAMqI,cAAc,GAAGxI,IAAI,CAAC,CAAC,CAAC;IAC9B,MAAMyI,iBAAiB,GAAGzI,IAAI,CAAC,CAAC,CAAC;IACjC,IAAI,CAACwI,cAAc,EAAE;MACnB,OAAOE,SAAS;IAClB;IACA,MAAMC,cAAc,GAAG,CAAC7E,GAAY,EAAE8E,GAAW,KAAK;MACpD,OACE9E,GAAG,CAACiB,IAAI,CAACrC,UAAU,CAAE,GAAEkG,GAAI,GAAE,CAAC;MAAI;MAClC9E,GAAG,CAACiB,IAAI,KAAK6D,GAAG;MAAI;MACpB9E,GAAG,CAACQ,KAAK,KAAKsE,GAAG,CACjB,CAAC;IACL,CAAC;;IACD,MAAMjI,OAAO,GAAG,IAAI,CAACjB,QAAQ,CAACmJ,IAAI,CAAE/E,GAAG,IAAK6E,cAAc,CAAC7E,GAAG,EAAE0E,cAAc,CAAC,CAAC;IAChF,IAAI,CAAC7H,OAAO,EAAE;MACZ,OAAO+H,SAAS;IAClB;IACA,IAAI,CAAC/H,OAAO,CAACjB,QAAQ,IAAI,CAAC+I,iBAAiB,EAAE;MAC3C,OAAO9H,OAAO,CAAC,CAAC;IAClB;;IACA,MAAMoD,UAAU,GAAGpD,OAAO,CAACjB,QAAQ,CAACmJ,IAAI,CAAE/E,GAAG,IAAK6E,cAAc,CAAC7E,GAAG,EAAE2E,iBAAiB,CAAC,CAAC;IACzF,OAAO1E,UAAU,IAAIpD,OAAO;EAC9B;AACF;AAAC"}
|
package/dist/help.cmd.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export declare class HelpCmd implements Command {
|
|
|
10
10
|
group: string;
|
|
11
11
|
options: CommandOptions;
|
|
12
12
|
constructor(cliMain: CLIMain, docsDomain: string);
|
|
13
|
-
report(
|
|
13
|
+
report(_: any, { internal }: {
|
|
14
|
+
internal: boolean;
|
|
15
|
+
}): Promise<string>;
|
|
14
16
|
}
|
package/dist/help.cmd.js
CHANGED
|
@@ -31,10 +31,12 @@ class HelpCmd {
|
|
|
31
31
|
(0, _defineProperty2().default)(this, "alias", '$0');
|
|
32
32
|
(0, _defineProperty2().default)(this, "loader", false);
|
|
33
33
|
(0, _defineProperty2().default)(this, "group", 'general');
|
|
34
|
-
(0, _defineProperty2().default)(this, "options", []);
|
|
34
|
+
(0, _defineProperty2().default)(this, "options", [['', 'internal', 'show internal commands']]);
|
|
35
35
|
}
|
|
36
|
-
async report(
|
|
37
|
-
|
|
36
|
+
async report(_, {
|
|
37
|
+
internal
|
|
38
|
+
}) {
|
|
39
|
+
return (0, _help().formatHelp)(this.cliMain.commands, this.cliMain.groups, this.docsDomain, internal);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
exports.HelpCmd = HelpCmd;
|
package/dist/help.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HelpCmd","constructor","cliMain","docsDomain","report","formatHelp","commands","groups"],"sources":["help.cmd.ts"],"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"],"mappings":";;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,OAAO,CAAoB;EAGxB;;EAKdC,WAAW,CAASC,OAAgB,EAAUC,UAAkB,EAAE;IAAA,KAA9CD,OAAgB,GAAhBA,OAAgB;IAAA,KAAUC,UAAkB,GAAlBA,UAAkB;IAAA,8CAPzD,MAAM;IAAA,qDACC,YAAY;IAAA,+CAClB,IAAI;IAAA,gDACH,KAAK;IAAA,+CACN,SAAS;IAAA,iDACP,EAAE;
|
|
1
|
+
{"version":3,"names":["HelpCmd","constructor","cliMain","docsDomain","report","_","internal","formatHelp","commands","groups"],"sources":["help.cmd.ts"],"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 = [['', 'internal', 'show internal commands']] as CommandOptions;\n\n constructor(private cliMain: CLIMain, private docsDomain: string) {}\n\n async report(_, { internal }: { internal: boolean }) {\n return formatHelp(this.cliMain.commands, this.cliMain.groups, this.docsDomain, internal);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,OAAO,CAAoB;EAGxB;;EAKdC,WAAW,CAASC,OAAgB,EAAUC,UAAkB,EAAE;IAAA,KAA9CD,OAAgB,GAAhBA,OAAgB;IAAA,KAAUC,UAAkB,GAAlBA,UAAkB;IAAA,8CAPzD,MAAM;IAAA,qDACC,YAAY;IAAA,+CAClB,IAAI;IAAA,gDACH,KAAK;IAAA,+CACN,SAAS;IAAA,iDACP,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;EAEa;EAEnE,MAAMC,MAAM,CAACC,CAAC,EAAE;IAAEC;EAAgC,CAAC,EAAE;IACnD,OAAO,IAAAC,kBAAU,EAAC,IAAI,CAACL,OAAO,CAACM,QAAQ,EAAE,IAAI,CAACN,OAAO,CAACO,MAAM,EAAE,IAAI,CAACN,UAAU,EAAEG,QAAQ,CAAC;EAC1F;AACF;AAAC"}
|
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, docsDomain: string): string;
|
|
3
|
+
export declare function formatHelp(commands: CommandList, groups: GroupsType, docsDomain: string, showPrivateCommands?: boolean): string;
|
package/dist/help.js
CHANGED
|
@@ -38,8 +38,8 @@ const SPACE = ' ';
|
|
|
38
38
|
const TITLE_LEFT_SPACES_NUMBER = 2;
|
|
39
39
|
const COMMAND_LEFT_SPACES_NUMBER = 4;
|
|
40
40
|
const NAME_WITH_SPACES_LENGTH = 15;
|
|
41
|
-
function formatHelp(commands, groups, docsDomain) {
|
|
42
|
-
const helpProps = groupCommands(commands, groups);
|
|
41
|
+
function formatHelp(commands, groups, docsDomain, showPrivateCommands = false) {
|
|
42
|
+
const helpProps = groupCommands(commands, groups, showPrivateCommands);
|
|
43
43
|
const commandsStr = formatCommandsHelp(helpProps);
|
|
44
44
|
return `${getHeader(docsDomain)}
|
|
45
45
|
|
|
@@ -47,8 +47,8 @@ ${commandsStr}
|
|
|
47
47
|
|
|
48
48
|
${getFooter()}`;
|
|
49
49
|
}
|
|
50
|
-
function groupCommands(commands, groups) {
|
|
51
|
-
const help = commands.filter(command => !command.private && command.description).reduce(function (partialHelp, command) {
|
|
50
|
+
function groupCommands(commands, groups, showPrivateCommands = false) {
|
|
51
|
+
const help = commands.filter(command => showPrivateCommands ? true : !command.private && command.description).reduce(function (partialHelp, command) {
|
|
52
52
|
const groupName = command.group; // at this stage, it must be set
|
|
53
53
|
partialHelp[groupName] = partialHelp[groupName] || {
|
|
54
54
|
commands: {},
|
package/dist/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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","description","reduce","partialHelp","groupName","group","capitalize","cmdId","getCommandId","name","Object","keys","map","commandsSectionTemplate","join","section","titleSpace","repeat","title","chalk","underline","bold","blue","cmdName","commandTemplate","res","nameSpace","nameWithRightSpace","rightpad","green","yellow"],"sources":["help.ts"],"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.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.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"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,KAAK,GAAG,GAAG;AACjB,MAAMC,wBAAwB,GAAG,CAAC;AAClC,MAAMC,0BAA0B,GAAG,CAAC;AACpC,MAAMC,uBAAuB,GAAG,EAAE;AAW3B,SAASC,UAAU,CAACC,QAAqB,EAAEC,MAAkB,EAAEC,UAAkB,EAAE;
|
|
1
|
+
{"version":3,"names":["SPACE","TITLE_LEFT_SPACES_NUMBER","COMMAND_LEFT_SPACES_NUMBER","NAME_WITH_SPACES_LENGTH","formatHelp","commands","groups","docsDomain","showPrivateCommands","helpProps","groupCommands","commandsStr","formatCommandsHelp","getHeader","getFooter","help","filter","command","private","description","reduce","partialHelp","groupName","group","capitalize","cmdId","getCommandId","name","Object","keys","map","commandsSectionTemplate","join","section","titleSpace","repeat","title","chalk","underline","bold","blue","cmdName","commandTemplate","res","nameSpace","nameWithRightSpace","rightpad","green","yellow"],"sources":["help.ts"],"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, showPrivateCommands = false) {\n const helpProps = groupCommands(commands, groups, showPrivateCommands);\n const commandsStr = formatCommandsHelp(helpProps);\n\n return `${getHeader(docsDomain)}\n\n${commandsStr}\n\n${getFooter()}`;\n}\n\nfunction groupCommands(commands: CommandList, groups: GroupsType, showPrivateCommands = false): HelpProps {\n const help: HelpProps = commands\n .filter((command) => (showPrivateCommands ? true : !command.private && 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.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"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,KAAK,GAAG,GAAG;AACjB,MAAMC,wBAAwB,GAAG,CAAC;AAClC,MAAMC,0BAA0B,GAAG,CAAC;AACpC,MAAMC,uBAAuB,GAAG,EAAE;AAW3B,SAASC,UAAU,CAACC,QAAqB,EAAEC,MAAkB,EAAEC,UAAkB,EAAEC,mBAAmB,GAAG,KAAK,EAAE;EACrH,MAAMC,SAAS,GAAGC,aAAa,CAACL,QAAQ,EAAEC,MAAM,EAAEE,mBAAmB,CAAC;EACtE,MAAMG,WAAW,GAAGC,kBAAkB,CAACH,SAAS,CAAC;EAEjD,OAAQ,GAAEI,SAAS,CAACN,UAAU,CAAE;AAClC;AACA,EAAEI,WAAY;AACd;AACA,EAAEG,SAAS,EAAG,EAAC;AACf;AAEA,SAASJ,aAAa,CAACL,QAAqB,EAAEC,MAAkB,EAAEE,mBAAmB,GAAG,KAAK,EAAa;EACxG,MAAMO,IAAe,GAAGV,QAAQ,CAC7BW,MAAM,CAAEC,OAAO,IAAMT,mBAAmB,GAAG,IAAI,GAAG,CAACS,OAAO,CAACC,OAAO,IAAID,OAAO,CAACE,WAAY,CAA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ACb,MAAMW,GAAG,GAAI,GAAEP,KAAM,KAAI/B,QAAS,EAAC;EACnC,OAAOsC,GAAG;AACZ;AAEA,SAASD,eAAe,CAACf,IAAY,EAAER,WAAmB,EAAU;EAClE,MAAMyB,SAAS,GAAG5C,KAAK,CAACmC,MAAM,CAACjC,0BAA0B,CAAC;EAC1D,MAAM2C,kBAAkB,GAAG,IAAAC,mBAAQ,EAACnB,IAAI,EAAExB,uBAAuB,EAAEH,KAAK,CAAC;EACzE,MAAM2C,GAAG,GAAI,GAAEC,SAAU,GAAEP,gBAAK,CAACU,KAAK,CAACF,kBAAkB,CAAE,GAAE1B,WAAY,EAAC;EAC1E,OAAOwB,GAAG;AACZ;AAEA,SAAS9B,SAAS,CAACN,UAAkB,EAAU;EAC7C,OAAQ,GAAE8B,gBAAK,CAACE,IAAI,CAAC,oDAAoD,CAAE;AAC7E;AACA,EAAEF,gBAAK,CAACW,MAAM,CAAE,8BAA6BzC,UAAW,EAAC,CAAE,EAAC;AAC5D;AAEA,SAASO,SAAS,GAAW;EAC3B,OAAQ,GAAEuB,gBAAK,CAACW,MAAM,CAAC,yFAAyF,CAAE,EAAC;AACrH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.616/dist/cli.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.616/dist/cli.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.616",
|
|
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.
|
|
9
|
+
"version": "0.0.616"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"@babel/runtime": "7.20.0",
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@teambit/harmony": "0.3.3",
|
|
21
|
-
"@teambit/community": "0.0.
|
|
22
|
-
"@teambit/logger": "0.0.
|
|
21
|
+
"@teambit/community": "0.0.164",
|
|
22
|
+
"@teambit/logger": "0.0.709",
|
|
23
23
|
"@teambit/bit-error": "0.0.402"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/node": "12.20.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@teambit/legacy": "1.0.
|
|
37
|
+
"@teambit/legacy": "1.0.397",
|
|
38
38
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
39
39
|
"react": "^16.8.0 || ^17.0.0"
|
|
40
40
|
},
|
|
Binary file
|