Is it possible to use gitlab's package repository to feed our npm packages as well as public packages online. On proget it is possible to register common npm packages and my private npm packages under the same URL using a proxy. Is it possible to do the same with Gitlab so that pointing to gitlab's repository in the .npmrc would be enough to install all the dependencies ?
Asked
Active
Viewed 159 times
1
-
What do you mean by "common npm package"? Hosted on npmjs.org? They will always get resolved if the package is not found in the linked Gitlab registry. – StephanB Dec 20 '21 at 09:17
-
we host the packages on proget, ag-grid-react, etc.. we have the artifacts in a dedicated feed, and then the company packages, which aren't public in another feed. Proget allows us to combine those 2 feeds under the same URL which we simply set in the project .npmrc Proget caches the packages so we will always be able to install them no matter what. – Solidseb Dec 20 '21 at 09:42
1 Answers
0
Yes, you can have a different registry for your personal packages and e.g. company packages. You can reference them by @my-gitlab-username/foo-package
or @company/bar-package
.
NPM packages hosted on npmjs.com which get installed by npm install <package>
will always be resolved if the lookup on your provided Gitlab package registry fails. Usually you do not have to provide a separate proxy.
Multiple private/non-public registries can be targeted by using npm install @company/<package>
. So there should be no issue in targeting multiple Proget and/or Gitlab npm registries at the same time.
Authentification is described here: https://stackoverflow.com/a/42648251/4236831

StephanB
- 315
- 2
- 17
-
1By personal I meant company packages. non public. We are trying to host the company packages as well as public packages into 1 repository on GitLab. On proget we have 2 different feeds for the company packages and for the packages we pulled from npmjs.org, etc.. – Solidseb Dec 20 '21 at 09:45
-
You can specify multiple private/non-public npm registries in your package.json with @foo/a, @bar/b, @baz/c and so on. Authentification can be easily done by multiple lines in .npmrc file. So I don't see any issues with this setup. See this: https://stackoverflow.com/a/42648251/4236831 – StephanB Dec 20 '21 at 09:57