This document describes the process for publishing the fints-lib and fints-lib-cli packages to npm.
Before you can publish packages to npm, you need:
- An npm account (create one at https://www.npmjs.com/signup)
- An npm access token with publish permissions
- The token stored as a GitHub secret named
NPM_TOKEN
-
Generate an npm access token:
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
- Click "Generate New Token"
- Select "Automation" type
- Copy the generated token
-
Add the token to GitHub secrets:
- Go to your repository Settings
- Navigate to "Secrets and variables" > "Actions"
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste your npm token
- Click "Add secret"
The recommended way to publish is through GitHub Releases:
-
Update the version in both package.json files:
packages/fints/package.jsonpackages/fints-cli/package.json
-
Commit and push the version changes
-
Create a new GitHub Release:
- Go to the repository's Releases page
- Click "Draft a new release"
- Create a new tag (e.g.,
v0.5.1) - Add release notes describing the changes
- Click "Publish release"
-
The GitHub Action will automatically:
- Build both packages
- Publish
fints-libto npm - Publish
fints-lib-clito npm
You can also trigger publishing manually:
- Go to the "Actions" tab in GitHub
- Select the "Publish to NPM" workflow
- Click "Run workflow"
- Choose which package to publish:
all- Publish both packagesfints-lib- Publish only the libraryfints-lib-cli- Publish only the CLI
- Click "Run workflow"
Follow semantic versioning (semver):
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality additions
- PATCH version for backwards-compatible bug fixes
Example: 0.5.0 → 0.5.1 (patch) or 0.6.0 (minor) or 1.0.0 (major)
Before publishing, ensure:
- All tests pass (
yarn testin both packages ormake testfrom root) - Linting passes (
yarn lintat root) - Both packages build successfully (
yarn buildin both packages ormake buildfrom root) - Version numbers are updated in both package.json files
- CHANGELOG is updated (if exists)
- README files are up to date
- Dependencies are up to date
Note: This project uses Yarn as the package manager for development.
After publishing:
-
Verify packages on npm:
-
Test installation:
npm install fints-lib npm install -g fints-lib-cli # or yarn add fints-lib yarn global add fints-lib-cli -
Verify the CLI works:
fints-lib --help
This means you need to log in to npm. For GitHub Actions, ensure the NPM_TOKEN secret is set correctly.
This can happen if:
- The package name is already taken (but not by you)
- You don't have permission to publish to the package
- Your npm token doesn't have publish permissions
If a version is already published, you cannot republish it. You must increment the version number.