@teambit/cli 0.0.471 → 0.0.474
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/generate-doc-md.d.ts +1 -0
- package/dist/generate-doc-md.js +18 -10
- package/dist/generate-doc-md.js.map +1 -1
- package/package-tar/teambit-cli-0.0.474.tgz +0 -0
- package/package.json +5 -5
- package/{preview-1649820303295.js → preview-1650511604919.js} +2 -2
- package/package-tar/teambit-cli-0.0.471.tgz +0 -0
package/dist/generate-doc-md.js
CHANGED
|
@@ -58,6 +58,8 @@ class GenerateCommandsDoc {
|
|
|
58
58
|
${metadataStr}
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
+
# CLI Reference
|
|
62
|
+
|
|
61
63
|
Commands that are marked as workspace only must be executed inside a workspace. Commands that are marked as not workspace only, can be executed from anywhere and will run on a remote server.
|
|
62
64
|
`;
|
|
63
65
|
output += commands.map(cmd => this.generateCommand(cmd)).join('\n');
|
|
@@ -78,11 +80,11 @@ Commands that are marked as workspace only must be executed inside a workspace.
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
result += `**Workspace only**: ${cmd.skipWorkspace ? 'no' : 'yes'} \n`;
|
|
81
|
-
result += `**Description**: ${this.formatDescription(cmd
|
|
83
|
+
result += `**Description**: ${this.formatDescription(cmd)}`;
|
|
82
84
|
result += `\`bit ${cmd.name}\` \n\n`;
|
|
83
85
|
|
|
84
86
|
if (cmd.commands && cmd.commands.length > 0) {
|
|
85
|
-
result += this.generateSubCommands(cmd.commands);
|
|
87
|
+
result += this.generateSubCommands(cmd.commands, cmd);
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
result += this.generateOptions(cmd.options);
|
|
@@ -90,15 +92,15 @@ Commands that are marked as workspace only must be executed inside a workspace.
|
|
|
90
92
|
return result;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
generateSubCommands(subCommands) {
|
|
95
|
+
generateSubCommands(subCommands, command) {
|
|
94
96
|
let ret = '';
|
|
95
97
|
subCommands.forEach(subCommand => {
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
const usage = subCommand.name
|
|
99
|
-
ret += `### ${
|
|
98
|
+
const commandName = (0, _getCommandId().getCommandId)(command.name);
|
|
99
|
+
const subcommandName = (0, _getCommandId().getCommandId)(subCommand.name);
|
|
100
|
+
const usage = `${commandName} ${subCommand.name}`;
|
|
101
|
+
ret += `### ${commandName} ${subcommandName} \n`;
|
|
100
102
|
ret += `**Usage**: \`${usage}\` \n\n`;
|
|
101
|
-
ret += `**Description**: ${this.formatDescription(subCommand
|
|
103
|
+
ret += `**Description**: ${this.formatDescription(subCommand)}`;
|
|
102
104
|
ret += '\n';
|
|
103
105
|
ret += this.generateOptions(subCommand.options);
|
|
104
106
|
});
|
|
@@ -119,8 +121,14 @@ Commands that are marked as workspace only must be executed inside a workspace.
|
|
|
119
121
|
return output;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
+
formatStringToMD(str) {
|
|
125
|
+
return str.split('\n').join(' \n');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
formatDescription(command) {
|
|
129
|
+
const extendedDescription = command.extendedDescription ? ` \n${this.formatStringToMD(command.extendedDescription)}` : '';
|
|
130
|
+
const description = this.formatStringToMD(command.description);
|
|
131
|
+
return `${description}${extendedDescription} \n\n`;
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["generate-doc-md.ts"],"names":["GenerateCommandsDoc","constructor","commands","options","generate","getAllPublicCommandsSorted","metadata","id","title","metadataStr","Object","keys","map","key","join","output","cmd","generateCommand","publicCommands","filter","private","sort","a","b","name","localeCompare","commandName","result","alias","length","skipWorkspace","formatDescription","
|
|
1
|
+
{"version":3,"sources":["generate-doc-md.ts"],"names":["GenerateCommandsDoc","constructor","commands","options","generate","getAllPublicCommandsSorted","metadata","id","title","metadataStr","Object","keys","map","key","join","output","cmd","generateCommand","publicCommands","filter","private","sort","a","b","name","localeCompare","commandName","result","alias","length","skipWorkspace","formatDescription","generateSubCommands","generateOptions","subCommands","command","ret","forEach","subCommand","subcommandName","usage","opt","flag","description","aliasFormatted","flagFormatted","formatStringToMD","str","split","extendedDescription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAKO,MAAMA,mBAAN,CAA0B;AAC/BC,EAAAA,WAAW,CAASC,QAAT,EAAsCC,OAAtC,EAA6D;AAAA,SAApDD,QAAoD,GAApDA,QAAoD;AAAA,SAAvBC,OAAuB,GAAvBA,OAAuB;AAAE;;AAE1EC,EAAAA,QAAQ,GAAW;AACjB,UAAMF,QAAQ,GAAG,KAAKG,0BAAL,EAAjB;;AACA,UAAMC,QAAQ;AACZC,MAAAA,EAAE,EAAE,SADQ;AAEZC,MAAAA,KAAK,EAAE;AAFK,OAGT,KAAKL,OAAL,CAAaG,QAHJ,CAAd;;AAKA,UAAMG,WAAW,GAAGC,MAAM,CAACC,IAAP,CAAYL,QAAZ,EACjBM,GADiB,CACZC,GAAD,IAAU,GAAEA,GAAI,KAAIP,QAAQ,CAACO,GAAD,CAAM,EADrB,EAEjBC,IAFiB,CAEZ,IAFY,CAApB;AAGA,QAAIC,MAAM,GAAI;AAClB,EAAEN,WAAY;AACd;AACA;AACA;AACA;AACA;AACA,CAPI;AAQAM,IAAAA,MAAM,IAAIb,QAAQ,CAACU,GAAT,CAAcI,GAAD,IAAS,KAAKC,eAAL,CAAqBD,GAArB,CAAtB,EAAiDF,IAAjD,CAAsD,IAAtD,CAAV;AAEA,WAAOC,MAAP;AACD;;AAEOV,EAAAA,0BAA0B,GAAG;AACnC,UAAMa,cAAc,GAAG,KAAKhB,QAAL,CAAciB,MAAd,CAAsBH,GAAD,IAAS,CAACA,GAAG,CAACI,OAAnC,CAAvB;AACA,WAAOF,cAAc,CAACG,IAAf,CA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O,CAACc,mBAA9B,CAAmD,EADlC,GAExB,EAFJ;AAGA,UAAMN,WAAW,GAAG,KAAKG,gBAAL,CAAsBX,OAAO,CAACQ,WAA9B,CAApB;AACA,WAAQ,GAAEA,WAAY,GAAEM,mBAAoB,QAA5C;AACD;;AA1F8B","sourcesContent":["import { Command } from '@teambit/legacy/dist/cli/command';\nimport { CommandOptions } from '@teambit/legacy/dist/cli/legacy-command';\nimport { getCommandId } from './get-command-id';\n\nexport type GenerateOpts = {\n metadata?: Record<string, string>;\n};\nexport class GenerateCommandsDoc {\n constructor(private commands: Command[], private options: GenerateOpts) {}\n\n generate(): string {\n const commands = this.getAllPublicCommandsSorted();\n const metadata = {\n id: 'cli-all',\n title: 'CLI Commands',\n ...this.options.metadata,\n };\n const metadataStr = Object.keys(metadata)\n .map((key) => `${key}: ${metadata[key]}`)\n .join('\\n');\n let output = `---\n${metadataStr}\n---\n\n# CLI Reference\n\nCommands that are marked as workspace only must be executed inside a workspace. Commands that are marked as not workspace only, can be executed from anywhere and will run on a remote server.\n`;\n output += commands.map((cmd) => this.generateCommand(cmd)).join('\\n');\n\n return output;\n }\n\n private getAllPublicCommandsSorted() {\n const publicCommands = this.commands.filter((cmd) => !cmd.private);\n return publicCommands.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n private generateCommand(cmd: Command) {\n const commandName = getCommandId(cmd.name);\n let result = `## ${commandName} \\n\\n`;\n if (cmd.alias && cmd.alias.length > 0) {\n result += `**Alias**: \\`${cmd.alias}\\` \\n`;\n }\n result += `**Workspace only**: ${cmd.skipWorkspace ? 'no' : 'yes'} \\n`;\n result += `**Description**: ${this.formatDescription(cmd)}`;\n result += `\\`bit ${cmd.name}\\` \\n\\n`;\n\n if (cmd.commands && cmd.commands.length > 0) {\n result += this.generateSubCommands(cmd.commands, cmd);\n }\n result += this.generateOptions(cmd.options);\n result += `--- \\n`;\n\n return result;\n }\n\n private generateSubCommands(subCommands: Command[], command: Command) {\n let ret = '';\n subCommands.forEach((subCommand) => {\n const commandName = getCommandId(command.name);\n const subcommandName = getCommandId(subCommand.name);\n const usage = `${commandName} ${subCommand.name}`;\n ret += `### ${commandName} ${subcommandName} \\n`;\n ret += `**Usage**: \\`${usage}\\` \\n\\n`;\n ret += `**Description**: ${this.formatDescription(subCommand)}`;\n\n ret += '\\n';\n ret += this.generateOptions(subCommand.options);\n });\n return ret;\n }\n\n private generateOptions(options: CommandOptions): string {\n if (!options || options.length <= 0) return '';\n let output = `| **Option** | **Option alias** | **Description**| \\n`;\n output += `|---|:-----:|---|\\n`;\n options.forEach((opt) => {\n const [alias, flag, description] = opt;\n const aliasFormatted = alias ? `\\`-${alias}\\`` : ' ';\n const flagFormatted = `--${flag}`;\n output += `|\\`${flagFormatted}\\`|${aliasFormatted}|${description}|\\n`;\n });\n output += `\\n`;\n return output;\n }\n\n private formatStringToMD(str: string): string {\n return str.split('\\n').join(' \\n');\n }\n\n private formatDescription(command: Command): string {\n const extendedDescription = command.extendedDescription\n ? ` \\n${this.formatStringToMD(command.extendedDescription)}`\n : '';\n const description = this.formatStringToMD(command.description as string);\n return `${description}${extendedDescription} \\n\\n`;\n }\n}\n"]}
|
|
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.474",
|
|
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.474"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@babel/runtime": "7.12.18",
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@teambit/harmony": "0.3.3",
|
|
21
|
-
"@teambit/community": "0.0.
|
|
21
|
+
"@teambit/community": "0.0.22",
|
|
22
22
|
"@teambit/bit-error": "0.0.394"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/node": "12.20.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@teambit/legacy": "1.0.
|
|
36
|
+
"@teambit/legacy": "1.0.254",
|
|
37
37
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
38
38
|
"react": "^16.8.0 || ^17.0.0"
|
|
39
39
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react": "-"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@teambit/legacy": "1.0.
|
|
64
|
+
"@teambit/legacy": "1.0.254",
|
|
65
65
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
66
66
|
"react": "^16.8.0 || ^17.0.0"
|
|
67
67
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.474/dist/cli.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.474/dist/cli.docs.mdx')]
|
|
Binary file
|