-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add Amplify CLI command reference #4950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f15c79d
feat: add Amplify CLI command reference
josefaidt a95cc6d
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt b5f2b80
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt 6124dc1
chore: migrate next.config, directory to ESM. enables reading cli com…
josefaidt 6cd2c21
chore: add amplify-cli-core as a dependency
josefaidt f65dda3
fix: inline code block sidenav link
josefaidt 82bf2bc
migrate away from 'tasks' cmd, mjs tasks
josefaidt 6301d3d
jest to transform mjs
josefaidt ef98745
directory import to use mjs extension, correct expected error message
josefaidt c76303f
revert error message correction due to different node versions
josefaidt 7233f2e
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt 48e67e4
update lockfile
josefaidt fabb695
fix subcommand descriptions, remove usage subsections
josefaidt 42bbc15
pin amplify-cli-core version
josefaidt 581cfe7
add types, fix usage of table captions
josefaidt cf263eb
patch duplicate subcommands from dataset
josefaidt 67c698a
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt 0c21728
update lockfile from main
josefaidt 54deabd
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt d960509
use scoped package, update to 4+
josefaidt d23cc3b
Merge remote-tracking branch 'upstream/main' into feat/cli-command-re…
josefaidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will a test fail / build break if this object gets messed up? Or will the docs just silently get messed up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's a good question. If this is changed in the CLI the docs site will not build. Ideally if we automate this on updates to
amplify-cli-core
the PR associated with the version bump and lockfile updates will fail