Publish to a package registry

We support publication to any package registry compatible with NPM package registry API.

Publishing is always done under a scope, and your package.json is the source of truth for the the name and scope of your packages.

Default @backlight-dev scope

By default, a new design system is setup to be published under @backlight-dev. To ensure unicity, the package name will be prefixed by the name of your workspace.

For example, if your workspace name is great-co, the expected package name has to be prefixed by @backlight-dev/great-co.. Therefore @backlight-dev/great-co.abc would work, but @backlight-dev/abc would not.

Custom scopes

A custom scope can be specified in your package.json file and will be used by Backlight.dev if it has been setup.

If it has not been setup or if the name does not comply to the default scope expected format, another name will be suggested and used upon publish.

This suggestion is disabled if your package.json declares your package to be restricted or associated to a specific registry to prevent any unexpected behavior.

Example of package being declared restricted in their package.json:

  "publishConfig": {
    "access": "restricted"
  },

Example of package targeting a specific NPM registry:

  "publishConfig": {
    "registry": "https://private-registry.com"
  },

Note that the latter configuration is only used to prevent the release happening on a different registry. Setting up the scope and registry is still necessary.

Scopes configuration

Scopes can be configured under workspace preferences.

Quite similarly to package.json publishConfig, a scope name is associated to:

  • an NPM registry, if different from registry.npmjs.org
  • a default access for published packages, which defaults to public
  • an access token which may be required by your custom registry or by registry.npmjs.org if publishing a restricted package

Include source files

For being able to include source files into your published package we offer several options

  • Support for files options in package.json

For instance, considering this package.json

{
  "name": "@acme/package",
  "version": "1.0.0",
  "files": ["scripts/*", "**/src/*"]
}

In this case only sources files located in the root directory scripts and all files located in a subdirectory src/ will be included in the destination package.

Please refer to the official documentation for this package.json files

  • Include automically all sources into your package by selecting the include sources into the publish dialog.

We populate the files property of the published package.json accordingly

Include compiled files

By default all compiled and transformed files will be included into the package to be published.

All files within a src/ directory will be published into a new dist/ directory at the same directory level hierarchy.

We populate the files property of the published package.json accordingly.

Private publication

🚧 Documentation under construction