Publishing to other registries

Component packages are automatically upon snap or tag. Components hosted on Bit Cloud will have their packages available to be installed by Bit, as well as by standard package managers like npm and Yarn.

You can install packages hosted on Bit Cloud, in other projects, by configuring your npmrc to use Bit Cloud.

Bit automaticlly creates packages for your components and serves them from the Bit registry. It is most likely you don't need to follow this guide, and favour using the Bit Cloud registry and it connect to Artifactory or Nexus as needed.

Connecting your registry to Bit Cloud

If you are using an artifact management solution, such as JFrog Artifactory or Nexus. It is usually recommended to configure them to use the Bit Cloud registry as a proxy to simplify consumption of components.

Using Artifactory or Nexus as a proxy for the Bit package registry is considered a good practice, and preserves the components atomic to your packages, with a central control.

Publish your components to other registries

Usually, it is a good practice, to keep components atomic to packages, and thus not to publish packages to another source. If it is needed, follow the following guide.

Configure your components to use a different package name by setting the name property with a new name. This will set them to be published to the npm's registry (no need to configure the publishConfig property, as well).

You can use the {name} and {scope} placeholders to inject each component name, and scope name, to the corresponding package name. The package name should be prefixed with the npm scope (see the example below).

To make your packages public, configure the private and packageManagerPublishArgs properties, accordingly (see the example below).

{
  "teambit.workspace/variants": {
    "*": {
      "teambit.pkg/pkg": {
        // "packageManagerPublishArgs": ["--access=public"],
        "packageJson": {
          //   "private": false,
          "name": "@my-npm-scope/{name}"
        }
      }
    }
  }
}
CopiedCopy
make sure you're logged in to npm
npm login
CopiedCopy

Publish to CommonJS registries

However, if you're using self-hosted scopes, packages will not be available for installation. Set the registry property to your registry's URL. Set the scope value to the specific scope in the registry.

To make your packages public, configure the private and packageManagerPublishArgs properties, accordingly (see the example below).

"teambit.workspace/variants": {
  "*": {
      "teambit.pkg/pkg": {
        // "packageManagerPublishArgs": [
        //   "--access public"
        // ],
        "packageJson": {
          "name": "@my-scope/{name}",
        //   "private": false,
          "publishConfig": {
            "scope": "@my-scope",
            "registry": "https://registry.something.org/"
          }
        }
      }
    }
}
CopiedCopy

Packages can also be published to commonJS package registries like npm. Components that are configured to be published to a commonJS package registry, will be published during their tag process.

bit tag ui/heading
CopiedCopy
...
new components
(first version for components)
     > ui/heading@0.0.1


published the following 1 component(s) successfully
@my-npm-scope/ui.heading@0.0.1
CopiedCopy

Use bit publish to manually publish components from the workspace (not recommended!):

bit publish ui/heading
CopiedCopy