@teambit/cli 0.0.1309 → 0.0.1311
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.main.runtime.js +8 -1
- package/dist/cli.main.runtime.js.map +1 -1
- package/dist/command-runner.d.ts +2 -0
- package/dist/command-runner.js +28 -1
- package/dist/command-runner.js.map +1 -1
- package/dist/command.d.ts +7 -0
- package/dist/command.js.map +1 -1
- package/dist/details.cmd.d.ts +12 -0
- package/dist/details.cmd.js +78 -0
- package/dist/details.cmd.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/output-formatter.d.ts +2 -0
- package/dist/output-formatter.js +7 -0
- package/dist/output-formatter.js.map +1 -1
- package/dist/{preview-1775420363455.js → preview-1775570658295.js} +2 -2
- package/package.json +6 -4
package/dist/cli.main.runtime.js
CHANGED
|
@@ -95,6 +95,13 @@ function _version() {
|
|
|
95
95
|
};
|
|
96
96
|
return data;
|
|
97
97
|
}
|
|
98
|
+
function _details() {
|
|
99
|
+
const data = require("./details.cmd");
|
|
100
|
+
_details = function () {
|
|
101
|
+
return data;
|
|
102
|
+
};
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
98
105
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
99
106
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
100
107
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -247,7 +254,7 @@ class CLIMain {
|
|
|
247
254
|
const cliCmd = new (_cli2().CliCmd)(cliMain);
|
|
248
255
|
const helpCmd = new (_help().HelpCmd)(cliMain);
|
|
249
256
|
cliCmd.commands.push(cliGenerateCmd);
|
|
250
|
-
cliMain.register(new (_completion().CompletionCmd)(), cliCmd, helpCmd, new (_version().VersionCmd)());
|
|
257
|
+
cliMain.register(new (_completion().CompletionCmd)(), cliCmd, helpCmd, new (_version().VersionCmd)(), new (_details().DetailsCmd)());
|
|
251
258
|
return cliMain;
|
|
252
259
|
}
|
|
253
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_harmony","data","require","_legacy","_pMapSeries","_interopRequireDefault","_commandGroups","_logger","_lodash","_cli","_getCommandId","_cliParser","_completion","_cli2","_help","_version","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIMain","constructor","commandsSlot","onStartSlot","onCommandStartSlot","onBeforeExitSlot","logger","clone","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","getCommandId","name","map","set","values","flat","getCommand","find","getCommandByNameOrAlias","alias","registerGroup","description","consoleWarning","registerOnStart","onStartFn","registerOnCommandStart","onCommandStartFn","registerOnBeforeExit","onBeforeExitFn","legacyLogger","registerOnBeforeExitFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","commandRunner","parse","runCommand","onStartFns","foundCmd","findCommandByArgv","currentCommandName","process","argv","pMapSeries","onStart","extendedDescription","group","options","private","trim","loader","undefined","loadAspects","helpUrl","isFullUrl","provider","loggerMain","config","createLogger","CLIAspect","id","cliMain","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","VersionCmd","exports","LoggerAspect","MainRuntime","Slot","withType","addRuntime","url","startsWith"],"sources":["cli.main.runtime.ts"],"sourcesContent":["import type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { logger as legacyLogger } from '@teambit/legacy.logger';\nimport type { CLIArgs, Flags, Command } from './command';\nimport pMapSeries from 'p-map-series';\nimport type { GroupsType } from './command-groups';\nimport { groups } from './command-groups';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { getCommandId } from './get-command-id';\nimport { CLIParser, findCommandByArgv } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\nimport { VersionCmd } from './version.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean, currentCommand: string, commandObject?: Command) => Promise<void>;\nexport type OnCommandStart = (commandName: string, args: CLIArgs, flags: Flags) => Promise<void>;\nexport type OnBeforeExitFn = () => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type OnCommandStartSlot = SlotRegistry<OnCommandStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\nexport type OnBeforeExitSlot = SlotRegistry<OnBeforeExitFn>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n constructor(\n private commandsSlot: CommandsSlot,\n private onStartSlot: OnStartSlot,\n readonly onCommandStartSlot: OnCommandStartSlot,\n private onBeforeExitSlot: OnBeforeExitSlot,\n private logger: Logger\n ) {}\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 (e.g. legacy and non-legacy).\n * for example `cli.unregister('tag');` removes the \"bit tag\" command.\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) => getCommandId(command.name) === name);\n }\n\n getCommandByNameOrAlias(name: string): Command | undefined {\n const command = this.getCommand(name);\n if (command) return command;\n return this.commands.find((cmd) => cmd.alias === 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 this.logger.consoleWarning(`CLI group \"${name}\" is already registered`);\n } else {\n this.groups[name] = description;\n }\n }\n\n /**\n * onStart is when bootstrapping the CLI. (it happens before onCommandStart)\n */\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * onCommandStart is when a command is about to start and we have the command object and the parsed args and flags\n * already. (it happens after onStart)\n */\n registerOnCommandStart(onCommandStartFn: OnCommandStart) {\n this.onCommandStartSlot.register(onCommandStartFn);\n return this;\n }\n\n /**\n * This will register a function to be called before the process exits.\n * This will run only for \"regular\" exits\n * e.g.\n * yes - command run and finished successfully\n * yes - command run and failed gracefully (code 1)\n * not SIGKILL (kill -9)\n * not SIGINT (Ctrl+C)\n * not SIGTERM (kill)\n * not uncaughtException\n * not unhandledRejection\n *\n * @param onBeforeExitFn\n * @returns\n */\n registerOnBeforeExit(onBeforeExitFn: OnBeforeExitFn) {\n this.onBeforeExitSlot.register(onBeforeExitFn);\n legacyLogger.registerOnBeforeExitFn(onBeforeExitFn);\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, this.onCommandStartSlot);\n const commandRunner = await CliParser.parse();\n await commandRunner.runCommand();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const foundCmd = findCommandByArgv(this.commands);\n const currentCommandName = process.argv[2];\n await pMapSeries(onStartFns, (onStart) => onStart(hasWorkspace, currentCommandName, foundCmd));\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.extendedDescription = command.extendedDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n command.name = command.name.trim();\n if (command.loader === undefined) {\n command.loader = true;\n }\n if (command.loadAspects === undefined) {\n command.loadAspects = true;\n }\n if (command.helpUrl && !isFullUrl(command.helpUrl)) {\n command.helpUrl = `https://bit.dev/${command.helpUrl}`;\n }\n }\n\n static dependencies = [LoggerAspect];\n static runtime = MainRuntime;\n static slots = [\n Slot.withType<CommandList>(),\n Slot.withType<OnStart>(),\n Slot.withType<OnCommandStart>(),\n Slot.withType<OnBeforeExitFn>(),\n ];\n\n static async provider(\n [loggerMain]: [LoggerMain],\n config,\n [commandsSlot, onStartSlot, onCommandStartSlot, onBeforeExitSlot]: [\n CommandsSlot,\n OnStartSlot,\n OnCommandStartSlot,\n OnBeforeExitSlot,\n ]\n ) {\n const logger = loggerMain.createLogger(CLIAspect.id);\n const cliMain = new CLIMain(commandsSlot, onStartSlot, onCommandStartSlot, onBeforeExitSlot, logger);\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(new CompletionCmd(), cliCmd, helpCmd, new VersionCmd());\n return cliMain;\n }\n}\n\nCLIAspect.addRuntime(CLIMain);\n\nfunction isFullUrl(url: string) {\n return url.startsWith('http://') || url.startsWith('https://');\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,M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AAAAxG,eAAA,CAjJjBkB,OAAO,WAkJH,CACbuF,eAAI,CAACC,QAAQ,CAAc,CAAC,EAC5BD,eAAI,CAACC,QAAQ,CAAU,CAAC,EACxBD,eAAI,CAACC,QAAQ,CAAiB,CAAC,EAC/BD,eAAI,CAACC,QAAQ,CAAiB,CAAC,CAChC;AAuBHhB,gBAAS,CAACiB,UAAU,CAACzF,OAAO,CAAC;AAE7B,SAASmE,SAASA,CAACuB,GAAW,EAAE;EAC9B,OAAOA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,UAAU,CAAC;AAChE","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_harmony","data","require","_legacy","_pMapSeries","_interopRequireDefault","_commandGroups","_logger","_lodash","_cli","_getCommandId","_cliParser","_completion","_cli2","_help","_version","_details","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIMain","constructor","commandsSlot","onStartSlot","onCommandStartSlot","onBeforeExitSlot","logger","clone","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","getCommandId","name","map","set","values","flat","getCommand","find","getCommandByNameOrAlias","alias","registerGroup","description","consoleWarning","registerOnStart","onStartFn","registerOnCommandStart","onCommandStartFn","registerOnBeforeExit","onBeforeExitFn","legacyLogger","registerOnBeforeExitFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","commandRunner","parse","runCommand","onStartFns","foundCmd","findCommandByArgv","currentCommandName","process","argv","pMapSeries","onStart","extendedDescription","group","options","private","trim","loader","undefined","loadAspects","helpUrl","isFullUrl","provider","loggerMain","config","createLogger","CLIAspect","id","cliMain","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","VersionCmd","DetailsCmd","exports","LoggerAspect","MainRuntime","Slot","withType","addRuntime","url","startsWith"],"sources":["cli.main.runtime.ts"],"sourcesContent":["import type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { logger as legacyLogger } from '@teambit/legacy.logger';\nimport type { CLIArgs, Flags, Command } from './command';\nimport pMapSeries from 'p-map-series';\nimport type { GroupsType } from './command-groups';\nimport { groups } from './command-groups';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { getCommandId } from './get-command-id';\nimport { CLIParser, findCommandByArgv } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\nimport { VersionCmd } from './version.cmd';\nimport { DetailsCmd } from './details.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean, currentCommand: string, commandObject?: Command) => Promise<void>;\nexport type OnCommandStart = (commandName: string, args: CLIArgs, flags: Flags) => Promise<void>;\nexport type OnBeforeExitFn = () => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type OnCommandStartSlot = SlotRegistry<OnCommandStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\nexport type OnBeforeExitSlot = SlotRegistry<OnBeforeExitFn>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n constructor(\n private commandsSlot: CommandsSlot,\n private onStartSlot: OnStartSlot,\n readonly onCommandStartSlot: OnCommandStartSlot,\n private onBeforeExitSlot: OnBeforeExitSlot,\n private logger: Logger\n ) {}\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 (e.g. legacy and non-legacy).\n * for example `cli.unregister('tag');` removes the \"bit tag\" command.\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) => getCommandId(command.name) === name);\n }\n\n getCommandByNameOrAlias(name: string): Command | undefined {\n const command = this.getCommand(name);\n if (command) return command;\n return this.commands.find((cmd) => cmd.alias === 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 this.logger.consoleWarning(`CLI group \"${name}\" is already registered`);\n } else {\n this.groups[name] = description;\n }\n }\n\n /**\n * onStart is when bootstrapping the CLI. (it happens before onCommandStart)\n */\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * onCommandStart is when a command is about to start and we have the command object and the parsed args and flags\n * already. (it happens after onStart)\n */\n registerOnCommandStart(onCommandStartFn: OnCommandStart) {\n this.onCommandStartSlot.register(onCommandStartFn);\n return this;\n }\n\n /**\n * This will register a function to be called before the process exits.\n * This will run only for \"regular\" exits\n * e.g.\n * yes - command run and finished successfully\n * yes - command run and failed gracefully (code 1)\n * not SIGKILL (kill -9)\n * not SIGINT (Ctrl+C)\n * not SIGTERM (kill)\n * not uncaughtException\n * not unhandledRejection\n *\n * @param onBeforeExitFn\n * @returns\n */\n registerOnBeforeExit(onBeforeExitFn: OnBeforeExitFn) {\n this.onBeforeExitSlot.register(onBeforeExitFn);\n legacyLogger.registerOnBeforeExitFn(onBeforeExitFn);\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, this.onCommandStartSlot);\n const commandRunner = await CliParser.parse();\n await commandRunner.runCommand();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const foundCmd = findCommandByArgv(this.commands);\n const currentCommandName = process.argv[2];\n await pMapSeries(onStartFns, (onStart) => onStart(hasWorkspace, currentCommandName, foundCmd));\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.extendedDescription = command.extendedDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n command.name = command.name.trim();\n if (command.loader === undefined) {\n command.loader = true;\n }\n if (command.loadAspects === undefined) {\n command.loadAspects = true;\n }\n if (command.helpUrl && !isFullUrl(command.helpUrl)) {\n command.helpUrl = `https://bit.dev/${command.helpUrl}`;\n }\n }\n\n static dependencies = [LoggerAspect];\n static runtime = MainRuntime;\n static slots = [\n Slot.withType<CommandList>(),\n Slot.withType<OnStart>(),\n Slot.withType<OnCommandStart>(),\n Slot.withType<OnBeforeExitFn>(),\n ];\n\n static async provider(\n [loggerMain]: [LoggerMain],\n config,\n [commandsSlot, onStartSlot, onCommandStartSlot, onBeforeExitSlot]: [\n CommandsSlot,\n OnStartSlot,\n OnCommandStartSlot,\n OnBeforeExitSlot,\n ]\n ) {\n const logger = loggerMain.createLogger(CLIAspect.id);\n const cliMain = new CLIMain(commandsSlot, onStartSlot, onCommandStartSlot, onBeforeExitSlot, logger);\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(new CompletionCmd(), cliCmd, helpCmd, new VersionCmd(), new DetailsCmd());\n return c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G,KAAIC,eAAO,EAACN,OAAO,CAAC;IACpCG,MAAM,CAACnE,QAAQ,CAACuE,IAAI,CAACN,cAAc,CAAC;IACpCD,OAAO,CAACjE,QAAQ,CAAC,KAAIyE,2BAAa,EAAC,CAAC,EAAEL,MAAM,EAAEE,OAAO,EAAE,KAAII,qBAAU,EAAC,CAAC,EAAE,KAAIC,qBAAU,EAAC,CAAC,CAAC;IAC1F,OAAOV,OAAO;EAChB;AACF;AAACW,OAAA,CAAArF,OAAA,GAAAA,OAAA;AAAAlB,eAAA,CA5KYkB,OAAO,kBAgJI,CAACsF,sBAAY,CAAC;AAAAxG,eAAA,CAhJzBkB,OAAO,aAiJDuF,kBAAW;AAAAzG,eAAA,CAjJjBkB,OAAO,WAkJH,CACbwF,eAAI,CAACC,QAAQ,CAAc,CAAC,EAC5BD,eAAI,CAACC,QAAQ,CAAU,CAAC,EACxBD,eAAI,CAACC,QAAQ,CAAiB,CAAC,EAC/BD,eAAI,CAACC,QAAQ,CAAiB,CAAC,CAChC;AAuBHjB,gBAAS,CAACkB,UAAU,CAAC1F,OAAO,CAAC;AAE7B,SAASmE,SAASA,CAACwB,GAAW,EAAE;EAC9B,OAAOA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,UAAU,CAAC;AAChE","ignoreList":[]}
|
package/dist/command-runner.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CLIArgs, Command, Flags } from './command';
|
|
2
2
|
import type { OnCommandStartSlot } from './cli.main.runtime';
|
|
3
|
+
export declare const LAST_COMMAND_DETAILS_DIR: string;
|
|
3
4
|
type CommandResult = {
|
|
4
5
|
data: any;
|
|
5
6
|
exitCode: number;
|
|
@@ -23,6 +24,7 @@ export declare class CommandRunner {
|
|
|
23
24
|
*/
|
|
24
25
|
private runJsonHandler;
|
|
25
26
|
private runReportHandler;
|
|
27
|
+
private persistDetails;
|
|
26
28
|
private runWaitHandler;
|
|
27
29
|
/**
|
|
28
30
|
* the loader and logger.console write output to the console during the command execution.
|
package/dist/command-runner.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CommandRunner = void 0;
|
|
6
|
+
exports.LAST_COMMAND_DETAILS_DIR = exports.CommandRunner = void 0;
|
|
7
7
|
exports.parseCommandName = parseCommandName;
|
|
8
8
|
function _legacy() {
|
|
9
9
|
const data = require("@teambit/legacy.logger");
|
|
@@ -54,10 +54,25 @@ function _pMapSeries() {
|
|
|
54
54
|
};
|
|
55
55
|
return data;
|
|
56
56
|
}
|
|
57
|
+
function _fsExtra() {
|
|
58
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
59
|
+
_fsExtra = function () {
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
function _path() {
|
|
65
|
+
const data = _interopRequireDefault(require("path"));
|
|
66
|
+
_path = function () {
|
|
67
|
+
return data;
|
|
68
|
+
};
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
57
71
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
58
72
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
59
73
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
60
74
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
75
|
+
const LAST_COMMAND_DETAILS_DIR = exports.LAST_COMMAND_DETAILS_DIR = _path().default.join(_legacy3().CACHE_ROOT, 'last-command-details');
|
|
61
76
|
class CommandRunner {
|
|
62
77
|
constructor(command, args, flags, onCommandStartSlot) {
|
|
63
78
|
this.command = command;
|
|
@@ -141,8 +156,20 @@ class CommandRunner {
|
|
|
141
156
|
data,
|
|
142
157
|
exitCode
|
|
143
158
|
};
|
|
159
|
+
const details = typeof result === 'string' ? undefined : result.details;
|
|
160
|
+
if (details) {
|
|
161
|
+
await this.persistDetails(details).catch(err => _legacy().logger.error('failed to persist command details', err));
|
|
162
|
+
}
|
|
144
163
|
await this.writeAndExit(`${data}\n`, exitCode);
|
|
145
164
|
}
|
|
165
|
+
async persistDetails(details) {
|
|
166
|
+
await _fsExtra().default.ensureDir(LAST_COMMAND_DETAILS_DIR);
|
|
167
|
+
const meta = JSON.stringify({
|
|
168
|
+
command: this.commandName,
|
|
169
|
+
timestamp: new Date().toISOString()
|
|
170
|
+
});
|
|
171
|
+
await Promise.all([_fsExtra().default.writeFile(_path().default.join(LAST_COMMAND_DETAILS_DIR, 'content'), details), _fsExtra().default.writeFile(_path().default.join(LAST_COMMAND_DETAILS_DIR, 'meta.json'), meta)]);
|
|
172
|
+
}
|
|
146
173
|
async runWaitHandler() {
|
|
147
174
|
if (!this.command.wait) throw new Error('runReportHandler expects command.wait to be implemented');
|
|
148
175
|
await this.command.wait(this.args, this.flags);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_legacy","data","require","_legacy2","_handleErrors","_legacy3","_globalFlags","_interopRequireDefault","_legacy4","_pMapSeries","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CommandRunner","constructor","command","args","flags","onCommandStartSlot","commandName","parseCommandName","name","runCommand","shouldReturnResult","bootstrapCommand","invokeOnCommandStart","determineConsoleWritingDuringCommand","json","runJsonHandler","report","runReportHandler","wait","runWaitHandler","err","handleErrorAndExit","Error","Analytics","init","logger","error","info","token","TOKEN_FLAG_NAME","globalFlags","toString","funcs","values","pMapSeries","onCommandStart","undefined","result","code","exitCode","isJsonStream","Boolean","stream","end","jsonStr","JSON","stringify","writeAndExit","loader","off","shouldDisableLoader","on","start","shouldWriteToConsole","process","stdout","write","exitAfterFlush","exports","split"],"sources":["command-runner.ts"],"sourcesContent":["import { logger, shouldDisableLoader } from '@teambit/legacy.logger';\nimport type { CLIArgs, Command, Flags } from './command';\nimport { loader } from '@teambit/legacy.loader';\nimport { handleErrorAndExit } from './handle-errors';\nimport { TOKEN_FLAG_NAME } from '@teambit/legacy.constants';\nimport globalFlags from './global-flags';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport pMapSeries from 'p-map-series';\n\ntype CommandResult = { data: any; exitCode: number };\n\nexport class CommandRunner {\n private commandName: string;\n constructor(\n private command: Command,\n private args: CLIArgs,\n private flags: Flags,\n private onCommandStartSlot: OnCommandStartSlot\n ) {\n this.commandName = parseCommandName(this.command.name);\n }\n\n /**\n * run command using one of the handler, \"json\"/\"report\"/\"render\". once done, exit the process.\n */\n async runCommand(shouldReturnResult = false): Promise<void | CommandResult> {\n try {\n this.bootstrapCommand();\n await this.invokeOnCommandStart();\n this.determineConsoleWritingDuringCommand();\n if (this.flags.json) {\n return await this.runJsonHandler(shouldReturnResult);\n }\n if (this.command.report) {\n return await this.runReportHandler(shouldReturnResult);\n }\n if (this.command.wait) {\n return await this.runWaitHandler();\n }\n } catch (err: any) {\n if (shouldReturnResult) throw err;\n return handleErrorAndExit(err, this.commandName);\n }\n\n throw new Error(`command \"${this.commandName}\" doesn't implement \"render\" nor \"report\" nor \"wait\" methods`);\n }\n\n private bootstrapCommand() {\n try {\n Analytics.init(this.commandName, this.flags, this.args);\n } catch (err: any) {\n // ignoring the error, we don't want to fail the app if analytics failed.\n logger.error('failed to initialize analytics', err);\n }\n logger.info(`[*] started a new command: \"${this.commandName}\" with the following data:`, {\n args: this.args,\n flags: this.flags,\n });\n const token = this.flags[TOKEN_FLAG_NAME];\n if (token) {\n globalFlags.token = token.toString();\n }\n }\n\n private async invokeOnCommandStart() {\n const funcs = this.onCommandStartSlot.values();\n await pMapSeries(funcs, (onCommandStart) => onCommandStart(this.commandName, this.args, this.flags));\n }\n\n /**\n * this works for both, Harmony commands and Legacy commands (the legacy-command-adapter\n * implements json() method)\n */\n private async runJsonHandler(shouldReturnResult = false): Promise<CommandResult | undefined> {\n if (!this.flags.json) return undefined;\n if (!this.command.json) throw new Error(`command \"${this.commandName}\" doesn't implement \"json\" method`);\n const result = await this.command.json(this.args, this.flags);\n const code = result.code || 0;\n const data = result.data || result;\n if (shouldReturnResult) return { data, exitCode: code };\n const isJsonStream = Boolean(this.flags.stream);\n if (isJsonStream) data.end = true;\n const jsonStr = isJsonStream ? `${JSON.stringify(data)}\\n` : JSON.stringify(data, null, 2);\n await this.writeAndExit(jsonStr, code);\n }\n\n private async runReportHandler(shouldReturnResult = false): Promise<CommandResult | undefined> {\n if (!this.command.report) throw new Error('runReportHandler expects command.report to be implemented');\n const result = await this.command.report(this.args, this.flags);\n loader.off();\n const data = typeof result === 'string' ? result : result.data;\n const exitCode = typeof result === 'string' ? 0 : result.code;\n if (shouldReturnResult) return { data, exitCode };\n await this.writeAndExit(`${data}\\n`, exitCode);\n }\n\n private async runWaitHandler() {\n if (!this.command.wait) throw new Error('runReportHandler expects command.wait to be implemented');\n await this.command.wait(this.args, this.flags);\n }\n\n /**\n * the loader and logger.console write output to the console during the command execution.\n * for internals commands, such as, _put, _fetch, the command.loader = false.\n */\n private determineConsoleWritingDuringCommand() {\n if (this.command.loader && !this.flags.json && !this.flags['get-yargs-completions'] && !shouldDisableLoader) {\n loader.on();\n loader.start(`running command \"${this.commandName}\"...`);\n logger.shouldWriteToConsole = true;\n } else {\n loader.off();\n logger.shouldWriteToConsole = false;\n }\n }\n\n private async writeAndExit(data: string, exitCode: number) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return process.stdout.write(data, async () => logger.exitAfterFlush(exitCode, this.commandName, data));\n }\n}\n\nexport function parseCommandName(commandName: string): string {\n if (!commandName) return '';\n return commandName.split(' ')[0];\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAO,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAM,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAA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AAEqE,QAAgB,EAAE;IACzD;IACA,OAAOe,OAAO,CAACC,MAAM,CAACC,KAAK,CAACtF,IAAI,EAAE,YAAYuD,gBAAM,CAACgC,cAAc,CAAClB,QAAQ,EAAE,IAAI,CAACjC,WAAW,EAAEpC,IAAI,CAAC,CAAC;EACxG;AACF;AAACwF,OAAA,CAAA1D,aAAA,GAAAA,aAAA;AAEM,SAASO,gBAAgBA,CAACD,WAAmB,EAAU;EAC5D,IAAI,CAACA,WAAW,EAAE,OAAO,EAAE;EAC3B,OAAOA,WAAW,CAACqD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_legacy","data","require","_legacy2","_handleErrors","_legacy3","_globalFlags","_interopRequireDefault","_legacy4","_pMapSeries","_fsExtra","_path","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","LAST_COMMAND_DETAILS_DIR","exports","path","join","CACHE_ROOT","CommandRunner","constructor","command","args","flags","onCommandStartSlot","commandName","parseCommandName","name","runCommand","shouldReturnResult","bootstrapCommand","invokeOnCommandStart","determineConsoleWritingDuringCommand","json","runJsonHandler","report","runReportHandler","wait","runWaitHandler","err","handleErrorAndExit","Error","Analytics","init","logger","error","info","token","TOKEN_FLAG_NAME","globalFlags","toString","funcs","values","pMapSeries","onCommandStart","undefined","result","code","exitCode","isJsonStream","Boolean","stream","end","jsonStr","JSON","stringify","writeAndExit","loader","off","details","persistDetails","catch","fs","ensureDir","meta","timestamp","Date","toISOString","Promise","all","writeFile","shouldDisableLoader","on","start","shouldWriteToConsole","process","stdout","write","exitAfterFlush","split"],"sources":["command-runner.ts"],"sourcesContent":["import { logger, shouldDisableLoader } from '@teambit/legacy.logger';\nimport type { CLIArgs, Command, Flags } from './command';\nimport { loader } from '@teambit/legacy.loader';\nimport { handleErrorAndExit } from './handle-errors';\nimport { TOKEN_FLAG_NAME, CACHE_ROOT } from '@teambit/legacy.constants';\nimport globalFlags from './global-flags';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport pMapSeries from 'p-map-series';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport const LAST_COMMAND_DETAILS_DIR = path.join(CACHE_ROOT, 'last-command-details');\n\ntype CommandResult = { data: any; exitCode: number };\n\nexport class CommandRunner {\n private commandName: string;\n constructor(\n private command: Command,\n private args: CLIArgs,\n private flags: Flags,\n private onCommandStartSlot: OnCommandStartSlot\n ) {\n this.commandName = parseCommandName(this.command.name);\n }\n\n /**\n * run command using one of the handler, \"json\"/\"report\"/\"render\". once done, exit the process.\n */\n async runCommand(shouldReturnResult = false): Promise<void | CommandResult> {\n try {\n this.bootstrapCommand();\n await this.invokeOnCommandStart();\n this.determineConsoleWritingDuringCommand();\n if (this.flags.json) {\n return await this.runJsonHandler(shouldReturnResult);\n }\n if (this.command.report) {\n return await this.runReportHandler(shouldReturnResult);\n }\n if (this.command.wait) {\n return await this.runWaitHandler();\n }\n } catch (err: any) {\n if (shouldReturnResult) throw err;\n return handleErrorAndExit(err, this.commandName);\n }\n\n throw new Error(`command \"${this.commandName}\" doesn't implement \"render\" nor \"report\" nor \"wait\" methods`);\n }\n\n private bootstrapCommand() {\n try {\n Analytics.init(this.commandName, this.flags, this.args);\n } catch (err: any) {\n // ignoring the error, we don't want to fail the app if analytics failed.\n logger.error('failed to initialize analytics', err);\n }\n logger.info(`[*] started a new command: \"${this.commandName}\" with the following data:`, {\n args: this.args,\n flags: this.flags,\n });\n const token = this.flags[TOKEN_FLAG_NAME];\n if (token) {\n globalFlags.token = token.toString();\n }\n }\n\n private async invokeOnCommandStart() {\n const funcs = this.onCommandStartSlot.values();\n await pMapSeries(funcs, (onCommandStart) => onCommandStart(this.commandName, this.args, this.flags));\n }\n\n /**\n * this works for both, Harmony commands and Legacy commands (the legacy-command-adapter\n * implements json() method)\n */\n private async runJsonHandler(shouldReturnResult = false): Promise<CommandResult | undefined> {\n if (!this.flags.json) return undefined;\n if (!this.command.json) throw new Error(`command \"${this.commandName}\" doesn't implement \"json\" method`);\n const result = await this.command.json(this.args, this.flags);\n const code = result.code || 0;\n const data = result.data || result;\n if (shouldReturnResult) return { data, exitCode: code };\n const isJsonStream = Boolean(this.flags.stream);\n if (isJsonStream) data.end = true;\n const jsonStr = isJsonStream ? `${JSON.stringify(data)}\\n` : JSON.stringify(data, null, 2);\n await this.writeAndExit(jsonStr, code);\n }\n\n private async runReportHandler(shouldReturnResult = false): Promise<CommandResult | undefined> {\n if (!this.command.report) throw new Error('runReportHandler expects command.report to be implemented');\n const result = await this.command.report(this.args, this.flags);\n loader.off();\n const data = typeof result === 'string' ? result : result.data;\n const exitCode = typeof result === 'string' ? 0 : result.code;\n if (shouldReturnResult) return { data, exitCode };\n const details = typeof result === 'string' ? undefined : result.details;\n if (details) {\n await this.persistDetails(details).catch((err) => logger.error('failed to persist command details', err));\n }\n await this.writeAndExit(`${data}\\n`, exitCode);\n }\n\n private async persistDetails(details: string) {\n await fs.ensureDir(LAST_COMMAND_DETAILS_DIR);\n const meta = JSON.stringify({ command: this.commandName, timestamp: new Date().toISOString() });\n await Promise.all([\n fs.writeFile(path.join(LAST_COMMAND_DETAILS_DIR, 'content'), details),\n fs.writeFile(path.join(LAST_COMMAND_DETAILS_DIR, 'meta.json'), meta),\n ]);\n }\n\n private async runWaitHandler() {\n if (!this.command.wait) throw new Error('runReportHandler expects command.wait to be implemented');\n await this.command.wait(this.args, this.flags);\n }\n\n /**\n * the loader and logger.console write output to the console during the command execution.\n * for internals commands, such as, _put, _fetch, the command.loader = false.\n */\n private determineConsoleWritingDuringCommand() {\n if (this.command.loader && !this.flags.json && !this.flags['get-yargs-completions'] && !shouldDisableLoader) {\n loader.on();\n loader.start(`running command \"${this.commandName}\"...`);\n logger.shouldWriteToConsole = true;\n } else {\n loader.off();\n logger.shouldWriteToConsole = false;\n }\n }\n\n private async writeAndExit(data: string, exitCode: number) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return process.stdout.write(data, async () => logger.exitAfterFlush(exitCode, this.commandName, data));\n }\n}\n\nexport function parseCommandName(commandName: string): string {\n if (!commandName) return '';\n return commandName.split(' ')[0];\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAO,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EAAA,MAAAT,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAQ,QAAA,YAAAA,CAAA;IAAA,OAA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C,oBAAoB,GAAG,KAAK;IACrC;EACF;EAEA,MAAclB,YAAYA,CAACpF,IAAY,EAAE4E,QAAgB,EAAE;IACzD;IACA,OAAO2B,OAAO,CAACC,MAAM,CAACC,KAAK,CAACzG,IAAI,EAAE,YAAY8D,gBAAM,CAAC4C,cAAc,CAAC9B,QAAQ,EAAE,IAAI,CAACjC,WAAW,EAAE3C,IAAI,CAAC,CAAC;EACxG;AACF;AAACiC,OAAA,CAAAI,aAAA,GAAAA,aAAA;AAEM,SAASO,gBAAgBA,CAACD,WAAmB,EAAU;EAC5D,IAAI,CAACA,WAAW,EAAE,OAAO,EAAE;EAC3B,OAAOA,WAAW,CAACgE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClC","ignoreList":[]}
|
package/dist/command.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export interface Command {
|
|
|
91
91
|
* @param args - arguments object as defined in name.
|
|
92
92
|
* @param flags - command flags as described in options.
|
|
93
93
|
* @return - Report object. The Report.data is printed to the stdout as is.
|
|
94
|
+
* Optionally include Report.details for expanded output accessible via `bit details` after the command completes.
|
|
94
95
|
*/
|
|
95
96
|
report?(args: CLIArgs, flags: Flags): Promise<string | Report>;
|
|
96
97
|
/**
|
|
@@ -118,6 +119,12 @@ export type GenericObject = {
|
|
|
118
119
|
export type Report = {
|
|
119
120
|
data: string;
|
|
120
121
|
code: number;
|
|
122
|
+
/**
|
|
123
|
+
* Optional expanded output persisted to disk and viewable via `bit details`.
|
|
124
|
+
* Use this for verbose information (e.g. auto-tagged dependents) that would clutter
|
|
125
|
+
* the default output but is useful after a one-shot command has already completed.
|
|
126
|
+
*/
|
|
127
|
+
details?: string;
|
|
121
128
|
};
|
|
122
129
|
export type CommandArg = {
|
|
123
130
|
name: string;
|
package/dist/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["command.ts"],"sourcesContent":["import type { Group } from './command-groups';\n\ntype CommandOption = [string, string, string];\nexport type CommandOptions = Array<CommandOption>;\n\nexport interface Command {\n /**\n * Name of command with arguments:\n * <> for mandatory arguments.\n * [] for optional arguments.\n * e.g. 'add <path>'\n */\n name: string;\n\n /**\n * command alias (for example: 't' for 'tag')\n */\n alias?: string;\n\n /**\n * The description of the command. Being used in the commands summery (`bit --help`) and the help (e.g. `bit create --help`).\n * should be short and precise. not more than one line. (use extendedDescription for more info).\n */\n description: string;\n\n /**\n * The extended description of the command. Will be seen in only in the command help, just after the description.\n */\n extendedDescription?: string;\n\n /**\n * url to a doc page explaining the command. shown in the command help just after the extendedDescription.\n * if a relative url is entered, the base url will be retrieved from `teambit.community/community` aspect.\n */\n helpUrl?: string;\n\n /**\n * allow grouping of commands to hint summery renderer\n * Places in default automatic help\n */\n group?: Group | string;\n\n /**\n * should a command be exposed to the user (by bit help).\n * e.g. experimental or plumbing commands should be hidden.\n */\n private?: boolean;\n\n /**\n * should turn on Loader.\n * the default is false for internal-commands and true for others.\n * @see cliMain.setDefaults()\n */\n loader?: boolean;\n\n /**\n * Array of command options where each element is a tuple.\n * ['flag alias', 'flag name', 'flag description']\n * for example:\n * ['j', 'json', 'output json format']\n */\n options: CommandOptions;\n\n /**\n * arguments are defined in the \"name\" property, and that's where the source of truth is.\n * this prop is optional and provides a way to describe the args. later, it'll support more fields, such as defaultValue.\n * if this is set, it'll be shown in the command help under \"Arguments\" section.\n */\n arguments?: CommandArg[];\n\n /**\n * sub commands for example:\n * bit capsule list to list active capsules.\n */\n commands?: Command[];\n\n /**\n * interact with a remote, e.g. \"export\" push to a remote\n * for now, the only difference is that they get a \"token\" flag to authenticate anonymously.\n */\n remoteOp?: boolean;\n\n /**\n * if true, it indicates that it doesn't need the workspace to work and can be executed outside a\n * workspace\n */\n skipWorkspace?: boolean;\n\n /**\n * optionally, give some examples how to use the command.\n */\n examples?: Example[];\n\n /**\n * whether to load aspects set in workspace.jsonc before running the command.\n * default is true.\n */\n loadAspects?: boolean;\n\n /**\n * do not set this. it is being set once the command run.\n * the values are those followed `--` in the command line. (e.g. `bit import -- --no-optional`)\n */\n _packageManagerArgs?: string[];\n\n /**\n * Command handler which prints the return value to the console and exits.\n * If the command has both, `render` and `report`, this one will be called when process.isTTY is false.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return - Report object. The Report.data is printed to the stdout as is.\n */\n report?(args: CLIArgs, flags: Flags): Promise<string | Report>;\n\n /**\n * Command handler which never exits the process\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n */\n wait?(args: CLIArgs, flags: Flags): Promise<void>;\n\n /**\n * Optional handler to provide a raw result of the command.\n * Will be go called if '-j'/'--json' option is provided by user.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return a GenericObject to be rendered to string (by json.stringify) in the console.\n */\n json?(args: CLIArgs, flags: Flags): Promise<GenericObject>;\n}\nexport type Flags = { [flagName: string]: string | boolean | undefined | any };\nexport type CLIArgs = Array<string[] | string>;\nexport type GenericObject = { [k: string]: any };\nexport type Report = {
|
|
1
|
+
{"version":3,"names":[],"sources":["command.ts"],"sourcesContent":["import type { Group } from './command-groups';\n\ntype CommandOption = [string, string, string];\nexport type CommandOptions = Array<CommandOption>;\n\nexport interface Command {\n /**\n * Name of command with arguments:\n * <> for mandatory arguments.\n * [] for optional arguments.\n * e.g. 'add <path>'\n */\n name: string;\n\n /**\n * command alias (for example: 't' for 'tag')\n */\n alias?: string;\n\n /**\n * The description of the command. Being used in the commands summery (`bit --help`) and the help (e.g. `bit create --help`).\n * should be short and precise. not more than one line. (use extendedDescription for more info).\n */\n description: string;\n\n /**\n * The extended description of the command. Will be seen in only in the command help, just after the description.\n */\n extendedDescription?: string;\n\n /**\n * url to a doc page explaining the command. shown in the command help just after the extendedDescription.\n * if a relative url is entered, the base url will be retrieved from `teambit.community/community` aspect.\n */\n helpUrl?: string;\n\n /**\n * allow grouping of commands to hint summery renderer\n * Places in default automatic help\n */\n group?: Group | string;\n\n /**\n * should a command be exposed to the user (by bit help).\n * e.g. experimental or plumbing commands should be hidden.\n */\n private?: boolean;\n\n /**\n * should turn on Loader.\n * the default is false for internal-commands and true for others.\n * @see cliMain.setDefaults()\n */\n loader?: boolean;\n\n /**\n * Array of command options where each element is a tuple.\n * ['flag alias', 'flag name', 'flag description']\n * for example:\n * ['j', 'json', 'output json format']\n */\n options: CommandOptions;\n\n /**\n * arguments are defined in the \"name\" property, and that's where the source of truth is.\n * this prop is optional and provides a way to describe the args. later, it'll support more fields, such as defaultValue.\n * if this is set, it'll be shown in the command help under \"Arguments\" section.\n */\n arguments?: CommandArg[];\n\n /**\n * sub commands for example:\n * bit capsule list to list active capsules.\n */\n commands?: Command[];\n\n /**\n * interact with a remote, e.g. \"export\" push to a remote\n * for now, the only difference is that they get a \"token\" flag to authenticate anonymously.\n */\n remoteOp?: boolean;\n\n /**\n * if true, it indicates that it doesn't need the workspace to work and can be executed outside a\n * workspace\n */\n skipWorkspace?: boolean;\n\n /**\n * optionally, give some examples how to use the command.\n */\n examples?: Example[];\n\n /**\n * whether to load aspects set in workspace.jsonc before running the command.\n * default is true.\n */\n loadAspects?: boolean;\n\n /**\n * do not set this. it is being set once the command run.\n * the values are those followed `--` in the command line. (e.g. `bit import -- --no-optional`)\n */\n _packageManagerArgs?: string[];\n\n /**\n * Command handler which prints the return value to the console and exits.\n * If the command has both, `render` and `report`, this one will be called when process.isTTY is false.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return - Report object. The Report.data is printed to the stdout as is.\n * Optionally include Report.details for expanded output accessible via `bit details` after the command completes.\n */\n report?(args: CLIArgs, flags: Flags): Promise<string | Report>;\n\n /**\n * Command handler which never exits the process\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n */\n wait?(args: CLIArgs, flags: Flags): Promise<void>;\n\n /**\n * Optional handler to provide a raw result of the command.\n * Will be go called if '-j'/'--json' option is provided by user.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return a GenericObject to be rendered to string (by json.stringify) in the console.\n */\n json?(args: CLIArgs, flags: Flags): Promise<GenericObject>;\n}\nexport type Flags = { [flagName: string]: string | boolean | undefined | any };\nexport type CLIArgs = Array<string[] | string>;\nexport type GenericObject = { [k: string]: any };\nexport type Report = {\n data: string;\n code: number;\n /**\n * Optional expanded output persisted to disk and viewable via `bit details`.\n * Use this for verbose information (e.g. auto-tagged dependents) that would clutter\n * the default output but is useful after a one-shot command has already completed.\n */\n details?: string;\n};\nexport type CommandArg = { name: string; description?: string };\nexport type Example = { cmd: string; description: string };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command, CommandOptions } from './command';
|
|
2
|
+
export declare class DetailsCmd implements Command {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
alias: string;
|
|
6
|
+
group: string;
|
|
7
|
+
options: CommandOptions;
|
|
8
|
+
loader: boolean;
|
|
9
|
+
loadAspects: boolean;
|
|
10
|
+
skipWorkspace: boolean;
|
|
11
|
+
report(): Promise<string>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DetailsCmd = void 0;
|
|
7
|
+
function _chalk() {
|
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
+
_chalk = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _fsExtra() {
|
|
15
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
16
|
+
_fsExtra = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _path() {
|
|
22
|
+
const data = _interopRequireDefault(require("path"));
|
|
23
|
+
_path = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _outputFormatter() {
|
|
29
|
+
const data = require("./output-formatter");
|
|
30
|
+
_outputFormatter = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _commandRunner() {
|
|
36
|
+
const data = require("./command-runner");
|
|
37
|
+
_commandRunner = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
44
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
45
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
46
|
+
class DetailsCmd {
|
|
47
|
+
constructor() {
|
|
48
|
+
_defineProperty(this, "name", 'details');
|
|
49
|
+
_defineProperty(this, "description", 'show expanded details from the last command that provided them (e.g. tag, snap)');
|
|
50
|
+
_defineProperty(this, "alias", '');
|
|
51
|
+
_defineProperty(this, "group", 'general');
|
|
52
|
+
_defineProperty(this, "options", []);
|
|
53
|
+
_defineProperty(this, "loader", false);
|
|
54
|
+
_defineProperty(this, "loadAspects", false);
|
|
55
|
+
_defineProperty(this, "skipWorkspace", true);
|
|
56
|
+
}
|
|
57
|
+
async report() {
|
|
58
|
+
const contentPath = _path().default.join(_commandRunner().LAST_COMMAND_DETAILS_DIR, 'content');
|
|
59
|
+
const metaPath = _path().default.join(_commandRunner().LAST_COMMAND_DETAILS_DIR, 'meta.json');
|
|
60
|
+
const exists = await _fsExtra().default.pathExists(contentPath);
|
|
61
|
+
if (!exists) {
|
|
62
|
+
return _chalk().default.yellow('no details available. run a command like "bit tag" or "bit snap" first.');
|
|
63
|
+
}
|
|
64
|
+
const [content, metaRaw] = await Promise.all([_fsExtra().default.readFile(contentPath, 'utf-8'), _fsExtra().default.readFile(metaPath, 'utf-8').catch(() => '{}')]);
|
|
65
|
+
let meta = {};
|
|
66
|
+
try {
|
|
67
|
+
meta = JSON.parse(metaRaw);
|
|
68
|
+
} catch {
|
|
69
|
+
// corrupted meta file, proceed with empty meta
|
|
70
|
+
}
|
|
71
|
+
const timestamp = meta.timestamp && !Number.isNaN(Date.parse(meta.timestamp)) ? meta.timestamp : '';
|
|
72
|
+
const header = meta.command ? (0, _outputFormatter().formatTitle)(`details from "bit ${meta.command}"`) + (timestamp ? _chalk().default.dim(` ${timestamp}`) : '') : (0, _outputFormatter().formatTitle)('details from last command');
|
|
73
|
+
return `${header}\n\n${content}\n\n${(0, _outputFormatter().formatHint)('(these are details from the last command that provided them)')}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.DetailsCmd = DetailsCmd;
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=details.cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_fsExtra","_path","_outputFormatter","_commandRunner","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DetailsCmd","constructor","report","contentPath","path","join","LAST_COMMAND_DETAILS_DIR","metaPath","exists","fs","pathExists","chalk","yellow","content","metaRaw","Promise","all","readFile","catch","meta","JSON","parse","timestamp","isNaN","Date","header","command","formatTitle","dim","formatHint","exports"],"sources":["details.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport type { Command, CommandOptions } from './command';\nimport { formatTitle, formatHint } from './output-formatter';\nimport { LAST_COMMAND_DETAILS_DIR } from './command-runner';\n\nexport class DetailsCmd implements Command {\n name = 'details';\n description = 'show expanded details from the last command that provided them (e.g. tag, snap)';\n alias = '';\n group = 'general';\n options = [] as CommandOptions;\n loader = false;\n loadAspects = false;\n skipWorkspace = true;\n\n async report() {\n const contentPath = path.join(LAST_COMMAND_DETAILS_DIR, 'content');\n const metaPath = path.join(LAST_COMMAND_DETAILS_DIR, 'meta.json');\n\n const exists = await fs.pathExists(contentPath);\n if (!exists) {\n return chalk.yellow('no details available. run a command like \"bit tag\" or \"bit snap\" first.');\n }\n\n const [content, metaRaw] = await Promise.all([\n fs.readFile(contentPath, 'utf-8'),\n fs.readFile(metaPath, 'utf-8').catch(() => '{}'),\n ]);\n\n let meta: Record<string, string> = {};\n try {\n meta = JSON.parse(metaRaw);\n } catch {\n // corrupted meta file, proceed with empty meta\n }\n const timestamp = meta.timestamp && !Number.isNaN(Date.parse(meta.timestamp)) ? meta.timestamp : '';\n const header = meta.command\n ? formatTitle(`details from \"bit ${meta.command}\"`) + (timestamp ? chalk.dim(` ${timestamp}`) : '')\n : formatTitle('details from last command');\n\n return `${header}\\n\\n${content}\\n\\n${formatHint('(these are details from the last command that provided them)')}`;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,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BAA2B,CAAC;IAE5C,OAAO,GAAGF,MAAM,OAAOZ,OAAO,OAAO,IAAAgB,6BAAU,EAAC,8DAA8D,CAAC,EAAE;EACnH;AACF;AAACC,OAAA,CAAA9B,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';
|
|
|
6
6
|
export { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';
|
|
7
7
|
export { globalFlags };
|
|
8
8
|
export { defaultErrorHandler };
|
|
9
|
-
export type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from './command';
|
|
9
|
+
export type { Command, CLIArgs, Flags, GenericObject, CommandOptions, Report } from './command';
|
|
10
10
|
export { getArgsData, getCommandName, getFlagsData } from './command-helper';
|
|
11
11
|
export * from './exceptions';
|
|
12
|
-
export { successSymbol, warnSymbol, errorSymbol, bulletSymbol, formatItem, formatSection, formatTitle, formatHint, formatSuccessSummary, formatWarningSummary, joinSections, renderSections, } from './output-formatter';
|
|
12
|
+
export { successSymbol, warnSymbol, errorSymbol, bulletSymbol, formatItem, formatSection, formatTitle, formatHint, formatDetailsHint, formatSuccessSummary, formatWarningSummary, joinSections, renderSections, } from './output-formatter';
|
|
13
13
|
export type { OutputSection } from './output-formatter';
|
|
14
14
|
export { CLIAspect as default, MainRuntime, CLIAspect };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var _exportNames = {
|
|
|
23
23
|
formatSection: true,
|
|
24
24
|
formatTitle: true,
|
|
25
25
|
formatHint: true,
|
|
26
|
+
formatDetailsHint: true,
|
|
26
27
|
formatSuccessSummary: true,
|
|
27
28
|
formatWarningSummary: true,
|
|
28
29
|
joinSections: true,
|
|
@@ -70,6 +71,12 @@ Object.defineProperty(exports, "errorSymbol", {
|
|
|
70
71
|
return _outputFormatter().errorSymbol;
|
|
71
72
|
}
|
|
72
73
|
});
|
|
74
|
+
Object.defineProperty(exports, "formatDetailsHint", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return _outputFormatter().formatDetailsHint;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
73
80
|
Object.defineProperty(exports, "formatHint", {
|
|
74
81
|
enumerable: true,
|
|
75
82
|
get: function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n bulletSymbol,\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n renderSections,\n} from './output-formatter';\nexport type { OutputSection } from './output-formatter';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions, Report } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n bulletSymbol,\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatDetailsHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n renderSections,\n} from './output-formatter';\nexport type { OutputSection } from './output-formatter';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,qBAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,oBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,IAAAQ,WAAA,GAAAP,OAAA;AAAAQ,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,SAAAS,iBAAA;EAAA,MAAArB,IAAA,GAAAC,OAAA;EAAAoB,gBAAA,YAAAA,CAAA;IAAA,OAAArB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAc4B,SAAAG,uBAAAmB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -16,6 +16,8 @@ export declare function formatSection(title: string, description: string, items:
|
|
|
16
16
|
export declare function formatTitle(text: string): string;
|
|
17
17
|
/** Format hint text in dim color */
|
|
18
18
|
export declare function formatHint(text: string): string;
|
|
19
|
+
/** Format a hint pointing the user to `bit details` for expanded output */
|
|
20
|
+
export declare function formatDetailsHint(subject?: string): string;
|
|
19
21
|
/** Format a success summary: green checkmark + green message */
|
|
20
22
|
export declare function formatSuccessSummary(msg: string): string;
|
|
21
23
|
/** Format a warning summary: warning symbol + yellow message */
|
package/dist/output-formatter.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.errorSymbol = exports.bulletSymbol = void 0;
|
|
7
|
+
exports.formatDetailsHint = formatDetailsHint;
|
|
7
8
|
exports.formatHint = formatHint;
|
|
8
9
|
exports.formatItem = formatItem;
|
|
9
10
|
exports.formatSection = formatSection;
|
|
@@ -75,6 +76,12 @@ function formatHint(text) {
|
|
|
75
76
|
return _chalk().default.dim(text);
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
/** Format a hint pointing the user to `bit details` for expanded output */
|
|
80
|
+
function formatDetailsHint(subject) {
|
|
81
|
+
const what = subject ? ` ${subject}` : '';
|
|
82
|
+
return formatHint(`(run "bit details" to see${what})`);
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
/** Format a success summary: green checkmark + green message */
|
|
79
86
|
function formatSuccessSummary(msg) {
|
|
80
87
|
return `${successSymbol()} ${_chalk().default.green(msg)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","bulletSymbol","dim","formatItem","text","symbol","s","formatSection","title","description","items","length","lines","formatTitle","indented","split","map","l","join","push","bold","white","formatHint","formatSuccessSummary","msg","formatWarningSummary","joinSections","sections","filter","Boolean","renderSections","expand","parts","section","collapsible","summary","content"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { platform } from 'os';\n\n/** Cross-platform green checkmark (mirrors Logger.successSymbol without importing Logger to avoid coupling) */\nconst _successSymbol = platform() === 'win32' ? chalk.green('\\u2713') : chalk.green('\\u2714');\nexport function successSymbol(): string {\n return _successSymbol;\n}\n\n/** Yellow warning symbol */\nexport const warnSymbol = chalk.yellow('\\u26A0');\n\n/** Red error symbol */\nexport const errorSymbol = chalk.red('\\u2716');\n\n/** Neutral bullet for informational items (no success/failure connotation) */\nexport const bulletSymbol = chalk.dim('\\u203A');\n\n/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */\nexport function formatItem(text: string, symbol?: string): string {\n const s = symbol ?? bulletSymbol;\n return ` ${s} ${text}`;\n}\n\n/**\n * Format a section with bold white title (including item count), dim description, and items.\n * Returns empty string if items array is empty.\n */\nexport function formatSection(title: string, description: string, items: string[]): string {\n if (!items.length) return '';\n const lines: string[] = [formatTitle(`${title} (${items.length})`)];\n if (description) {\n const indented = description\n .split('\\n')\n .map((l) => ` ${l}`)\n .join('\\n');\n lines.push(chalk.dim(indented));\n }\n lines.push(...items);\n return lines.join('\\n');\n}\n\n/** Format a bold white section title */\nexport function formatTitle(text: string): string {\n return chalk.bold.white(text);\n}\n\n/** Format hint text in dim color */\nexport function formatHint(text: string): string {\n return chalk.dim(text);\n}\n\n/** Format a success summary: green checkmark + green message */\nexport function formatSuccessSummary(msg: string): string {\n return `${successSymbol()} ${chalk.green(msg)}`;\n}\n\n/** Format a warning summary: warning symbol + yellow message */\nexport function formatWarningSummary(msg: string): string {\n return `${warnSymbol} ${chalk.yellow(msg)}`;\n}\n\n/** Filter out empty strings and join remaining sections with double newlines */\nexport function joinSections(sections: string[]): string {\n return sections.filter(Boolean).join('\\n\\n');\n}\n\nexport interface OutputSection {\n /** The fully rendered section text */\n content: string;\n /** If set, this section starts collapsed. Use --expand to show full content. */\n collapsible?: {\n /** Summary line shown when collapsed */\n summary: string;\n };\n}\n\n/**\n * Render sections to a string, collapsing sections that are marked collapsible.\n * When expand is true, all sections are shown expanded.\n */\nexport function renderSections(sections: OutputSection[], expand = false): string {\n const parts: string[] = [];\n for (const section of sections) {\n if (section.collapsible && !expand) {\n parts.push(section.collapsible.summary);\n } else if (section.content) {\n parts.push(section.content);\n }\n }\n return parts.filter(Boolean).join('\\n\\n');\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","bulletSymbol","dim","formatItem","text","symbol","s","formatSection","title","description","items","length","lines","formatTitle","indented","split","map","l","join","push","bold","white","formatHint","formatDetailsHint","subject","what","formatSuccessSummary","msg","formatWarningSummary","joinSections","sections","filter","Boolean","renderSections","expand","parts","section","collapsible","summary","content"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { platform } from 'os';\n\n/** Cross-platform green checkmark (mirrors Logger.successSymbol without importing Logger to avoid coupling) */\nconst _successSymbol = platform() === 'win32' ? chalk.green('\\u2713') : chalk.green('\\u2714');\nexport function successSymbol(): string {\n return _successSymbol;\n}\n\n/** Yellow warning symbol */\nexport const warnSymbol = chalk.yellow('\\u26A0');\n\n/** Red error symbol */\nexport const errorSymbol = chalk.red('\\u2716');\n\n/** Neutral bullet for informational items (no success/failure connotation) */\nexport const bulletSymbol = chalk.dim('\\u203A');\n\n/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */\nexport function formatItem(text: string, symbol?: string): string {\n const s = symbol ?? bulletSymbol;\n return ` ${s} ${text}`;\n}\n\n/**\n * Format a section with bold white title (including item count), dim description, and items.\n * Returns empty string if items array is empty.\n */\nexport function formatSection(title: string, description: string, items: string[]): string {\n if (!items.length) return '';\n const lines: string[] = [formatTitle(`${title} (${items.length})`)];\n if (description) {\n const indented = description\n .split('\\n')\n .map((l) => ` ${l}`)\n .join('\\n');\n lines.push(chalk.dim(indented));\n }\n lines.push(...items);\n return lines.join('\\n');\n}\n\n/** Format a bold white section title */\nexport function formatTitle(text: string): string {\n return chalk.bold.white(text);\n}\n\n/** Format hint text in dim color */\nexport function formatHint(text: string): string {\n return chalk.dim(text);\n}\n\n/** Format a hint pointing the user to `bit details` for expanded output */\nexport function formatDetailsHint(subject?: string): string {\n const what = subject ? ` ${subject}` : '';\n return formatHint(`(run \"bit details\" to see${what})`);\n}\n\n/** Format a success summary: green checkmark + green message */\nexport function formatSuccessSummary(msg: string): string {\n return `${successSymbol()} ${chalk.green(msg)}`;\n}\n\n/** Format a warning summary: warning symbol + yellow message */\nexport function formatWarningSummary(msg: string): string {\n return `${warnSymbol} ${chalk.yellow(msg)}`;\n}\n\n/** Filter out empty strings and join remaining sections with double newlines */\nexport function joinSections(sections: string[]): string {\n return sections.filter(Boolean).join('\\n\\n');\n}\n\nexport interface OutputSection {\n /** The fully rendered section text */\n content: string;\n /** If set, this section starts collapsed. Use --expand to show full content. */\n collapsible?: {\n /** Summary line shown when collapsed */\n summary: string;\n };\n}\n\n/**\n * Render sections to a string, collapsing sections that are marked collapsible.\n * When expand is true, all sections are shown expanded.\n */\nexport function renderSections(sections: OutputSection[], expand = false): string {\n const parts: string[] = [];\n for (const section of sections) {\n if (section.collapsible && !expand) {\n parts.push(section.collapsible.summary);\n } else if (section.content) {\n parts.push(section.content);\n }\n }\n return parts.filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA,MAAMG,cAAc,GAAG,IAAAC,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGC,gBAAK,CAACC,KAA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,MAAM,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1311/dist/cli.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1311/dist/cli.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1311",
|
|
4
4
|
"homepage": "https://bit.cloud/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.1311"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"lodash": "4.17.21",
|
|
15
15
|
"yargs": "17.0.1",
|
|
16
16
|
"p-map-series": "2.1.0",
|
|
17
|
+
"fs-extra": "10.0.0",
|
|
17
18
|
"pad-right": "0.2.2",
|
|
18
|
-
"@teambit/legacy.consumer": "0.0.
|
|
19
|
+
"@teambit/legacy.consumer": "0.0.104",
|
|
19
20
|
"@teambit/legacy.loader": "0.0.18",
|
|
20
21
|
"@teambit/legacy.logger": "0.0.36",
|
|
21
22
|
"@teambit/harmony": "0.4.7",
|
|
@@ -24,12 +25,13 @@
|
|
|
24
25
|
"@teambit/legacy.constants": "0.0.24",
|
|
25
26
|
"@teambit/bit-error": "0.0.404",
|
|
26
27
|
"@teambit/legacy.cli.error": "0.0.36",
|
|
27
|
-
"@teambit/logger": "0.0.
|
|
28
|
+
"@teambit/logger": "0.0.1404"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/didyoumean": "1.2.0",
|
|
31
32
|
"@types/lodash": "4.14.165",
|
|
32
33
|
"@types/yargs": "17.0.0",
|
|
34
|
+
"@types/fs-extra": "9.0.7",
|
|
33
35
|
"@types/mocha": "9.1.0",
|
|
34
36
|
"@teambit/harmony.envs.core-aspect-env": "0.1.4"
|
|
35
37
|
},
|