diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-24 00:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-24 00:09:46 +0300 |
commit | f6b349ed51e973c4a01d2f1a85459816f478186c (patch) | |
tree | 46d49a2a1c1347ce8f3abe2ef1c9f9c4ba05cacd /doc/user/packages/npm_registry/index.md | |
parent | bc62085601fa730985ea84f88a96c39d870c6ea6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user/packages/npm_registry/index.md')
-rw-r--r-- | doc/user/packages/npm_registry/index.md | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/doc/user/packages/npm_registry/index.md b/doc/user/packages/npm_registry/index.md index b6312002184..8e3718f3255 100644 --- a/doc/user/packages/npm_registry/index.md +++ b/doc/user/packages/npm_registry/index.md @@ -43,7 +43,7 @@ The npm version is shown in the output: ### Install Yarn As an alternative to npm, you can install Yarn in your local environment by following the -instructions at [yarnpkg.com](https://classic.yarnpkg.com/en/docs/install). +instructions at [classic.yarnpkg.com](https://classic.yarnpkg.com/en/docs/install). When installation is complete, verify you can use Yarn in your terminal by running: @@ -305,6 +305,46 @@ See the [Publish npm packages to the GitLab Package Registry using semantic-release](../../../ci/examples/semantic-release.md) step-by-step guide and demo project for a complete example. +## Configure the GitLab npm registry with Yarn 2 + +You can get started with Yarn 2 by following the documentation at +[https://yarnpkg.com/getting-started/install](https://yarnpkg.com/getting-started/install). + +To publish and install with the project-level npm endpoint, set the following configuration in +`.yarnrc.yml`: + +```yaml +npmScopes: + foo: + npmRegistryServer: "https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/" + npmPublishRegistry: "https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/" + +npmRegistries: + //gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/: + npmAlwaysAuth: true + npmAuthToken: "<your_token>" +``` + +For the instance-level npm endpoint, use this Yarn 2 configuration in `.yarnrc.yml`: + +```yaml +npmScopes: + foo: + npmRegistryServer: "https://gitlab.example.com/api/v4/packages/npm/" + +npmRegistries: + //gitlab.example.com/api/v4/packages/npm/: + npmAlwaysAuth: true + npmAuthToken: "<your_token>" +``` + +In this configuration: + +- Replace `<your_token>` with your personal access token or deploy token. +- Replace `<your_project_id>` with your project's ID, which you can find on the project's home page. +- Replace `gitlab.example.com` with your domain name. +- Your scope is `foo`, without `@`. + ## Publishing packages with the same name or version You cannot publish a package if a package of the same name and version already exists. |