Use Gitea to Host NPM Modules

If you’d like to use Gitea to host NPM modules for use with npm cli here’s how:

You need a package.json in the repo you want to include elsewhere. Use npm init to make one.

And then get your goodies like so:

devDependencies: {
  "repo-name": "git+ssh://domain.example/someuser/repo-name.git#v0.1.0-alpha.0"
}

This will install a Gitea repo contents to node_modules so you can use NPM scripts for shell scripting. In my experience you must be using SSH and must tag a release or push a tag like the one shown in the example provided as the npm cli is very particular about what it will pull in.

Are there limitations? Yes. Is this super useful with mirrors? You betcha.

1 Like

It’s useful for private NPM packages.

1 Like