forked from aws-amplify/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Amplify CLI command reference (aws-amplify#4950)
* feat: add Amplify CLI command reference * chore: migrate next.config, directory to ESM. enables reading cli command info from npm distribution * chore: add amplify-cli-core as a dependency * fix: inline code block sidenav link * migrate away from 'tasks' cmd, mjs tasks * jest to transform mjs * directory import to use mjs extension, correct expected error message * revert error message correction due to different node versions * update lockfile * fix subcommand descriptions, remove usage subsections * pin amplify-cli-core version * add types, fix usage of table captions * patch duplicate subcommands from dataset * update lockfile from main * use scoped package, update to 4+
- Loading branch information
Showing
16 changed files
with
1,360 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export type CliCommandFlag = { | ||
short: string; | ||
long: string; | ||
description: string; | ||
}; | ||
|
||
export type CliCommand = { | ||
name: string; | ||
description: string; | ||
usage: string; | ||
learnMoreLink?: string; | ||
flags: CliCommandFlag[] | []; | ||
subCommands?: CliCommand[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { commandsInfo } from 'amplify-cli-core/lib/help/commands-info.js'; | ||
|
||
/** | ||
* Get and transform command data | ||
* @returns {import('./cli-commands').CliCommand[]} Array of commands | ||
*/ | ||
export function getCliCommands() { | ||
const result = []; | ||
for (const command of commandsInfo) { | ||
const { subCommands } = command; | ||
result.push({ | ||
name: command.command, | ||
description: command.commandDescription, | ||
usage: command.commandUsage, | ||
flags: command.commandFlags.length | ||
? command.commandFlags.map((flag) => ({ | ||
short: flag.short, | ||
long: flag.long, | ||
description: flag.flagDescription | ||
})) | ||
: [], | ||
subCommands: subCommands.length | ||
? subCommands | ||
.map((subCommand) => ({ | ||
name: subCommand.subCommand, | ||
description: subCommand.subCommandDescription, | ||
usage: subCommand.subCommandUsage, | ||
flags: subCommand.subCommandFlags.length | ||
? subCommand.subCommandFlags.map((flag) => ({ | ||
short: flag.short, | ||
long: flag.long, | ||
description: flag.flagDescription | ||
})) | ||
: [] | ||
})) | ||
.reduce((acc, subCommand) => { | ||
/** @todo remove this .reduce() after duplicates are removed from the data set */ | ||
if (!acc.find((cmd) => cmd.name === subCommand.name)) { | ||
acc.push(subCommand); | ||
} | ||
return acc; | ||
}, []) | ||
: [] | ||
}); | ||
} | ||
return result; | ||
} | ||
|
||
export const commands = getCliCommands(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export type DirectoryItem = { | ||
/** | ||
* Title used for sidenav link, page title, and page heading | ||
*/ | ||
title: string; | ||
filters?: string[]; | ||
/** | ||
* Control whether the title should be displayed as inline code | ||
* @default false | ||
*/ | ||
isCodeTitle?: boolean; | ||
route: string; | ||
}; | ||
|
||
export type Directory = { | ||
productRoot: { | ||
title: string; | ||
route: string; | ||
}; | ||
items: Record< | ||
string, | ||
{ | ||
title: string; | ||
items: DirectoryItem[]; | ||
route?: string; | ||
filters?: string[]; | ||
} | ||
>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.