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:
To snap with a release version, and deploy your app, run the following:
Bit's official React application type does not provide its own deployer. Search bit.cloud for a deployer, and set it in your app's plugin file.
For example:
Run the following to install the Netlify deployer:
Set the Netlify deployer in your app plugin file (.react-app.ts
):
/* @filename: my-app.react-18-app.cjs */ const { Netlify } = require('@teambit/cloud-providers.deployers.netlify'); /** @type {import("@teambit/cloud-providers.deployers.netlify").NetlifyOptions} */ const netlify = { /* * 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', /** * redirect all routes through index.html (for single-page apps) * */ useDefaultRedirectsForSPA: true, /** * your Netlify team slug */ team: 'a-team', }; /** @type {import("@teambit/react.apps.react-app-types").ReactAppOptions} */ module.exports.default = { name: 'my-app', entry: [require.resolve('./my-app.app-root')], deploy: Netlify.deploy(netlify), };
Create a custom deployer
To create your own deployer, fork an existing deployer component or start from scratch. Learn more in Customizing the app deployment
You can choose not to use the deployment function, and instead deploy the app's artifacts using your existing CI. For this, make sure to disable you deployment function, and to snap your app component (artifacts can only be extracted from a snap).
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: