summaryrefslogtreecommitdiff
path: root/doc/user/packages/npm_registry
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-30 15:09:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-30 15:09:15 +0000
commit536aa3a1f4b96abc4ca34489bf2cbe503afcded7 (patch)
tree88d08f7dfa29a32d6526773c4fe0fefd9f2bc7d1 /doc/user/packages/npm_registry
parent50ae4065530c4eafbeb7c5ff2c462c48c02947ca (diff)
downloadgitlab-ce-536aa3a1f4b96abc4ca34489bf2cbe503afcded7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user/packages/npm_registry')
-rw-r--r--doc/user/packages/npm_registry/index.md28
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/user/packages/npm_registry/index.md b/doc/user/packages/npm_registry/index.md
index a0c82fd3e3c..58b4bf6a710 100644
--- a/doc/user/packages/npm_registry/index.md
+++ b/doc/user/packages/npm_registry/index.md
@@ -43,7 +43,7 @@ NPM to your local development environment.
Once installation is complete, verify you can use NPM in your terminal by
running:
-```sh
+```shell
npm --version
```
@@ -61,7 +61,7 @@ your development environment.
Once installed, you can verify that Yarn is available with the following command:
-```sh
+```shell
yarn --version
```
@@ -77,13 +77,13 @@ Understanding how to create a full JavaScript project is outside the scope of
this guide but you can initialize a new empty package by creating and navigating
to an empty directory and using the following command:
-```sh
+```shell
npm init
```
Or if you're using Yarn:
-```sh
+```shell
yarn init
```
@@ -110,7 +110,7 @@ If you have 2FA enabled, you need to use a [personal access token](../../profile
To authenticate with a [personal access token](../../profile/personal_access_tokens.md),
set your NPM configuration:
-```bash
+```shell
# Set URL for your scoped packages.
# For example package with name `@foo/bar` will use this URL for download
npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/
@@ -140,7 +140,7 @@ If you encounter an error message with [Yarn](https://yarnpkg.com/en/), see the
To avoid hard-coding the `authToken` value, you may use a variables in its place:
-```bash
+```shell
npm config set '//gitlab.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken' "${NPM_TOKEN}"
npm config set '//gitlab.com/api/v4/packages/npm/:_authToken' "${NPM_TOKEN}"
```
@@ -149,7 +149,7 @@ Then, you could run `npm publish` either locally or via GitLab CI/CD:
- **Locally:** Export `NPM_TOKEN` before publishing:
- ```sh
+ ```shell
NPM_TOKEN=<your_token> npm publish
```
@@ -191,7 +191,7 @@ domain name.
Once you have enabled it and set up [authentication](#authenticating-to-the-gitlab-npm-registry),
you can upload an NPM package to your project:
-```sh
+```shell
npm publish
```
@@ -248,7 +248,7 @@ NPM packages are commonly installed using the the `npm` or `yarn` commands
inside a JavaScript project. If you haven't already, you will need to set the
URL for scoped packages. You can do this with the following command:
-```sh
+```shell
npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/
```
@@ -259,13 +259,13 @@ is setup so you can successfully install the package. Once this has been
completed, you can run the following command inside your project to install a
package:
-```sh
+```shell
npm install @my-project-scope/my-package
```
Or if you're using Yarn:
-```sh
+```shell
yarn add @my-project-scope/my-package
```
@@ -302,7 +302,7 @@ deploy:
If you are using [yarn](https://yarnpkg.com/en/) with the NPM registry, you may get
an error message like:
-```sh
+```shell
yarn install v1.15.2
warning package.json: No license field
info No lockfile found.
@@ -351,7 +351,7 @@ And the `.npmrc` file should look like:
You do not need a token to run `npm install` unless your project is private (the token is only required to publish). If the `.npmrc` file was checked in with a reference to `$NPM_TOKEN`, you can remove it. If you prefer to leave the reference in, you'll need to set a value prior to running `npm install` or set the value using [GitLab environment variables](./../../../ci/variables/README.md):
-```bash
+```shell
NPM_TOKEN=<your_token> npm install
```
@@ -384,7 +384,7 @@ a package without specifying the tag or version.
Examples of the supported `dist-tag` commands and using tags in general:
-```sh
+```shell
npm publish @scope/package --tag # Publish new package with new tag
npm dist-tag add @scope/package@version my-tag # Add a tag to an existing package
npm dist-tag ls @scope/package # List all tags under the package