aws-amplify / aws-amplify/amplify-cli
support installing CLI locally to node project
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
## Problem
You can not run `amplify` commands that use local `npm_modules` which prohibit the ability to use `npm scripts`.
## Why
This important for several reasons:
- Ensure all users of the project are using the same version
- Enable for easier caching on CIs
- Add ability to chain various commands together
- Enhance developer experience for easier to remember commands
## Currently
When a developer does something like `yarn codegen` which is a script in `package.json` like:
```json
{
"scripts": {
"codegen": "amplify codegen types"
},
"devDepedencies": {
"aws-amplify": "3.0.22"
}
}
```
It returns something like this
```
➜ ui git:(master) ✗ yarn codegen
yarn run v1.22.4
$ amplify codegen types
Scanning for plugins...
The following official plugins are missing or inactive:
awscloudformation: provider | amplify-provider-awscloudformation@4.24.0
analytics: category | amplify-category-analytics@2.17.7
api: category | amplify-category-api@2.22.0
auth: category | amplify-category-auth@2.18.0
function: category | amplify-category-function@2.23.0
hosting: category | amplify-category-hosting@undefined
hosting: category | amplify-console-hosting@undefined
interactions: category | amplify-category-interactions@2.4.7
notifications: category | amplify-category-notifications@2.15.16
predictions: category | amplify-category-predictions@2.4.7
storage: category | amplify-category-storage@2.7.0
xr: category | amplify-category-xr@2.4.7
codegen: util | amplify-codegen@2.15.15
android: frontend | amplify-frontend-android@2.13.4
ios: frontend | amplify-frontend-ios@2.13.8
javascript: frontend | amplify-frontend-javascript@2.15.4
mock: util | amplify-util-mock@3.24.0
Plugin scan successful
The Amplify CLI can NOT find command: codegen types
Scanning for plugins...
The following official plugins are missing or inactive:
awscloudformation: provider | amplify-provider-awscloudformation@4.24.0
analytics: category | amplify-category-analytics@2.17.7
api: category | amplify-category-api@2.22.0
auth: category | amplify-category-auth@2.18.0
function: category | amplify-category-function@2.23.0
hosting: category | amplify-category-hosting@undefined
hosting: category | amplify-console-hosting@undefined
interactions: category | amplify-category-interactions@2.4.7
notifications: category | amplify-category-notifications@2.15.16
predictions: category | amplify-category-predictions@2.4.7
storage: category | amplify-category-storage@2.7.0
xr: category | amplify-category-xr@2.4.7
codegen: util | amplify-codegen@2.15.15
android: frontend | amplify-frontend-android@2.13.4
ios: frontend | amplify-frontend-ios@2.13.8
javascript: frontend | amplify-frontend-javascript@2.15.4
mock: util | amplify-util-mock@3.24.0
Plugin scan successful
| Category |
| -------- |
█████╗ ███╗ ███╗██████╗ ██╗ ██╗███████╗██╗ ██╗ ███████╗██████╗ █████╗ ███╗ ███╗███████╗██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗
██╔══██╗████╗ ████║██╔══██╗██║ ██║██╔════╝╚██╗ ██╔╝ ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝
███████║██╔████╔██║██████╔╝██║ ██║█████╗ ╚████╔╝ █████╗ ██████╔╝███████║██╔████╔██║█████╗ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝
██╔══██║██║╚██╔╝██║██╔═══╝ ██║ ██║██╔══╝ ╚██╔╝ ██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ██║███╗██║██║ ██║██╔══██╗██╔═██╗
██║ ██║██║ ╚═╝ ██║██║ ███████╗██║██║ ██║ ██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
amplify
init Initializes a new project, sets up deployment resources in the cloud, and makes your project ready for Amplify.
configure Configures the attributes of your project for amplify-cli, such as switching front-end framework and adding/removing cloud-provider plugins.
push Provisions cloud resources with the latest local developments.
pull Fetch upstream backend environment definition changes from the cloud and updates the local environment to match that definition.
publish Executes amplify push, and then builds and publishes client-side application for hosting.
serve Executes amplify push, and then executes the project's start command to test run the client-side application locally.
status Shows the state of local resources not yet pushed to the cloud (Create/Update/Delete).
delete Deletes all of the resources tied to the project from the cloud.
add Adds a resource for an Amplify category in your local backend
update Update resource for an Amplify category in your local backend.
push Provisions all cloud resources in a category with the latest local developments.
remove Removes a resource for an Amplify category in your local backend.
Displays subcommands of the specified Amplify category.
mock Run mock server for testing categories locally.
codegen Generates GraphQL statements(queries, mutations and eventHandlers) and type annotations.
env Displays and manages environment related information for your Amplify project.
console Opens the web console for the selected cloud resource.
✨ Done in 2.17s.
```
Contributor guide
Research direction
The report centers on invoking the amplify command from a package.json script such as yarn codegen, with dependencies installed locally. Reproduce that command using the shown setup, then trace the CLI entry point and how it scans for local plugins. Done means a local installation resolves the requested codegen types command and supports the listed npm-script workflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100