Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Plugins

Plugins are explicitly managed in the Amplify CLI pluggable platform. Plugins enable you to add additional commands and functionality to existing Amplify CLI. This section goes through the steps to create, publish, consume a plugin package, explains the folder structure, and key files in the plugin package.

Official plugins

  • amplify-category-analytics
  • amplify-category-api
  • amplify-category-auth
  • amplify-category-function
  • amplify-category-hosting
  • amplify-category-interactions
  • amplify-category-notifications
  • amplify-category-predictions
  • amplify-category-storage
  • amplify-codegen
  • amplify-frontend-javascript
  • amplify-frontend-android
  • amplify-frontend-ios
  • amplify-provider-awscloudformation

Third-party plugins

Plugin installation

You can add a 3rd party plugin to the Amplify CLI with the following steps:

  1. Run npm install -g <plugin> and install the plugin to the global node_modules directory.
  2. Run amplify plugin scan so the Amplify CLI plugin platform will pick up the newly added plugin.
  • If the plugin author did NOT name the plugin package according to the naming convention outlined above.
  1. Run npm install -g <plugin> and install the plugin to the global node_modules directory.
  2. Run amplify plugin add and provide the path to the plugin to explicitly add the plugin package into the Amplify CLI plugin platform.

Plugin Commands

The following is the suite of the commands under the amplify plugin:

  • amplify plugin configure
  • amplify plugin scan
  • amplify plugin add
  • amplify plugin remove
  • amplify plugin list
  • amplify plugin init
  • amplify plugin verify
  • amplify plugin help

configure

amplify plugin configure is used to configure the following settings in the plugins.json file:

  • plugin-directories : contains the directories that plugin packages are searched for during a plugin scan.
  • plugin-prefixes: contains the plugin package name prefixes. A package named with such prefix is considered a plugin candidate and checked during a plugin scan. If plugin-prefixes is empty, all packages inside the scanned directories will be checked.
  • max-scan-interval-in-seconds : the Amplify CLI Core will scan again if the last scan time has passed for longer than max-scan-interval-in-seconds. Setting this value to 0 will result in fresh scan at the beginning of each Amplify CLI command execution. The default value is 1 day.

scan

amplify plugin scan will start a fresh scan for plugins in the local environment. A configurable set of directories specified in plugin-directories, such as the global node_modules, are scanned for plugins.
Execution of this command will completely update the contents of the plugins field in the plugins.json. The last-scan-time field in the plugins.json is the time stamp of the last plugin scan. Note that, other than manually started by this command, a plugin scan can also be triggered by a regular amplify command execution, for example if the Amplify CLI Core noticed something is incorrect, or the last scan time has passed for longer than max-scan-interval-in-seconds(set to be one day by default).

add

amplify plugin add will prompt you to select a previously removed plugin (see below), or enter the full path of a local package to be added as a plugin into the Amplify CLI. The Amplify CLI Core verifies the existence and validity of the plugin package during execution of the this command. You can use this command to add a plugin that will not be found by the plugin scan process, e.g. if it is not in one of the plugin-directories, or its package name does not have the proper prefix as specified in the plugin-prefixes.

remove

amplify plugin remove will prompt you with the list of all the currently active plugins, and allow you to select the ones that you do not want to be included in the Amplify CLI. The Amplify CLI Core will remove the manifest of those plugins from the plugins field, so they will NOT be counted as active plugins anymore and will NOT be loaded during command executions.
If a removed plugin is in one of the directories specified in the plugin-directories, and its package name has the prefix as specified in the plugin-prefixes, it is then inserted in the excluded field of the plugins.json file. This will not be inserted back to the plugins field in the next plugin scan. The actual plugin packages themselves are not removed from your computer, and they can be added back as active plugins by amplify plugin add.

list

amplify plugin list lists all the active plugins, along with other information of the local Amplify CLI plugin platform.

init

The Amplify CLI provides the command amplify plugin init (with alias amplify plugin new) for the development of plugins.
This command first collects the requirements from you and then creates the skeleton of the plugin package for you to start the development. The newly created plugin package is added to your local Amplify CLI platform, so you can conveniently test its functionalities while it is being developed. It can be easily removed from the platform with the amplify plugin remove command and added back with the amplify plugin add command.

verify

The Amplify CLI provides the utility command amplify plugin verify to verify that:

  • The package implements the required interface methods for plugins.
  • The commands field contains all the required commands for the type of the plugin. amplify plugin verify command treats the folder where it is executed as the root directory of the plugin package. The command can be executed manually. Its functionality is also invoked by the amplify plugin scan and amplify plugin add commands.

help

Prints out help information for the commands under amplify plugin.