Skip to content

AWS Amplify

You can use private Capawesome npm packages within your AWS Amplify deployments by configuring the Capawesome npm registry. This guide shows you how to set up authentication to access the private packages from the Capawesome Insiders program.

Preparation

Create an AWS Amplify Environment Variable

Get your license key and add it to your AWS Amplify app as an environment variable with the name CAPAWESOME_NPM_REGISTRY_TOKEN as described in Environment variables.

Keep your license key secure

Never commit your license key directly to your repository and always use environment variables to store sensitive information like authentication tokens.

Configuration

Configure the amplify.yml file

Create or update the amplify.yml file in the root of your project and add the following commands to the preBuild phase:

- echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
- echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc

This will automatically configure npm to use the Capawesome registry for @capawesome-team packages during AWS Amplify builds.

Example

Here's a complete example of an amplify.yml file for a project using private Capawesome packages:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
        - echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'