Pushing npm Packages to Gitea
This step-by-step guide outlines how to push your npm packages to a Gitea registry.
Requirements
- A package is prepared for publication.
- npm (Node Package Manager) is installed on the user's machine.
- For npm packages, pushing to the registry is only possible with a token.
Prepare your npm Package
- Ensure your npm package has a package.json file with all the required fields filled out, including "name", "version", and any dependencies.
- The package name should follow the format @your-scope/package-name if you are using a scope.
Generating a Token for NPM Packages
To push packages to Gitea, you must have an access token with read and write permissions. Creating Access Tokens for Pushing Packages to Gitea documentation guides you on how to create such a token.
Guide
Configuration
In your terminal, configure npm to use your Gitea npm registry. Replace the placeholders {pkey} and {token} with actual values. Replace CUSTOMER with your customer ID.
npm config set -- '//gitea-CUSTOMER.devops.t-systems.net/api/packages/{pkey}/npm/:_authToken' "{token}"
Parameter | Description |
---|---|
pkey | Project Key in DevOps Portal refers to Organisation in Gitea |
token | Your access token. |
Publish a package
First, navigate to the directory where your NPM package is located on your local computer. For instance : C:\myuser\myfiles\mypackages\packagetopush.
After navigating to the path, proceed by running the following command to push your package:
Once published, the package will be accessible within the "Packages" section of the organization in Gitea.
The following picture displays how a package appears in Gitea after being pushed to the package registry.