Publish an integration

Publish your package to npm under the right release tag, and check it before and after.

Check before you publish

Publish only a package that passes every check, then preview the upload with npm publish --dry-run. The dry run lists the files and the tag without uploading.

bash
npx astryx doctor integration validate && npx astryx doctor integration components && npx astryx doctor integration templates && npx astryx doctor integration docs && npx astryx integration verify
npm publish --dry-run --access public
text
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access (dry-run)
+ @acme/astryx-widgets@1.0.0

Set a new version for each release; astryx docs cli/integrations/ship/versioning covers what counts as breaking. What each check proves is in astryx docs cli/integrations/ship/checks.

Keep private files out

With no files list, npm packs every file your ignore files do not exclude, including an old .tgz file or an .env file. List what ships instead.

bash
npm pkg set 'files[]=components' 'files[]=templates' 'files[]=themes' 'files[]=docs' 'files[]=codemods' 'files[]=astryx.integration.mjs'
npm pack --dry-run
  • List only the roots you ship, and always astryx.integration.mjs. npm adds package.json, and a README and LICENSE when you have them.
  • Each later integration add appends its root to the list.
  • integration verify fails when a root is missing from the list: Declared templates root "templates" has 0 of 2 expected files in the pack list. Add "templates" to "files" in package.json.

Publish to npm

A scoped package is private by default, so publish it with --access public. Without --tag, npm tags the release latest, which is what npm install @acme/astryx-widgets installs.

bash
# Publish a release
npm publish --access public
​
# Or set the access once in package.json
npm pkg set publishConfig.access=public

To let apps try a release first, publish it under next, then point latest at it when it is ready.

bash
# Only apps that ask for next get it: npm install @acme/astryx-widgets@next
npm publish --tag next
​
# Make that version the default
npm dist-tag add @acme/astryx-widgets@1.1.0 latest
npm dist-tag ls @acme/astryx-widgets

Check the published package

Install the version you published in a clean app, and run the same commands you ran against the .tgz file.

bash
mkdir check-release && cd check-release
npm init -y
npm install @astryxdesign/core @astryxdesign/cli @acme/astryx-widgets@1.0.0
npx astryx component AcmeCarousel
npx astryx doctor integration validate @acme/astryx-widgets

The full list of commands to run in an app is in astryx docs cli/integrations/ship/test-in-an-app. To help apps move to the new version, see astryx docs cli/integrations/ship/upgrading.