App Deployment

The tag and snap pipelines of an app component include an additional build task that deploys the app's artifacts.

To snap and deploy your app, run the following:

$bit
Copiedcopy
See command synopsis

To snap with a release version, and deploy your app, run the following:

$bit
Copiedcopy
See command synopsis

Use a deployer

The Angular app plugin does not provide a default deployer. Search bit.cloud for a deployer, and set it in your app's plugin file.

For example:

Netlify

Run the following to install the Netlify deployer:

$bit
Copiedcopy

Set the Netlify deployer in your app plugin file (.ng-app.ts):

import {
  NetlifyOptions,
  Netlify,
} from '@teambit/cloud-providers.deployers.netlify';
import { AngularAppOptions } from '@bitdev/angular.app-types.angular-app-type';

const netlify: NetlifyOptions = {
  /*
   * your Netlify authentication token. it's recommended to store the token it an env variable.
   * https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui
   */
  accessToken: process.env.NETLIFY_AUTH_TOKEN as string,
  productionSiteName: 'my-awesome-site',
  stagingSiteName: 'my-awesome-staging-site',
  /**
   * your Netlify team slug
   */
  team: 'a-team',
};

export const MyAngularAppOptions: AngularAppOptions = {
  name: 'my-angular-app',
  // ...
  deploy: Netlify.deploy(netlify),
};

export default MyAngularAppOptions;
CopiedCopy
Create a custom deployer

To create your own deployer, fork an existing deployer component or start from scratch.

Deploy using your CI

You can choose to not use the deployment function and instead to deploy your app's artifacts using your existing CI. For this, make sure to first disable you deployment function. After that you can build your app component and look for the artifacts in the workspace capsule, or snap your app component and extract the artifacts with this command:

$bit
Copiedcopy
See command synopsis

The artifacts are now available in the new build directory at the root of your project. Use this directory to deploy with your existing tools and workflows. For example:

$netlify deploy --dir=build
Copiedcopy