Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
02dd448c
Commit
02dd448c
authored
Nov 30, 2021
by
Vitor Meireles De Sousa
Committed by
Nick Gaskill
Nov 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add security warning and env variable to npm package docs
parent
2b556843
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
doc/user/packages/npm_registry/index.md
doc/user/packages/npm_registry/index.md
+10
-4
No files found.
doc/user/packages/npm_registry/index.md
View file @
02dd448c
...
...
@@ -17,6 +17,10 @@ Only [scoped](https://docs.npmjs.com/misc/scope/) packages are supported.
For documentation of the specific API endpoints that the npm package manager
client uses, see the
[
npm API documentation
](
../../../api/packages/npm.md
)
.
WARNING:
Never hardcode GitLab tokens (or any tokens) directly in
`.npmrc`
files or any other files that can
be committed to a repository.
## Build an npm package
This section covers how to install npm or Yarn and build a package for your
...
...
@@ -430,14 +434,16 @@ You can route package requests to organizations and users outside of GitLab.
To do this, add lines to your
`.npmrc`
file. Replace
`my-org`
with the namespace or group that owns your project's repository,
and use your organization's URL. The name is case-sensitive and must match the name of your group or namespace exactly.
Use environment variables to set up your tokens:
`export MY_TOKEN="<your token>"`
.
```
shell
@foo:registry
=
https://gitlab.example.com/api/v4/packages/npm/
//gitlab.example.com/api/v4/packages/npm/:_authToken
=
"<your_token>"
//gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken
=
"<your_token>"
//gitlab.example.com/api/v4/packages/npm/:_authToken
=
${
MY_TOKEN
}
//gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken
=
${
MY_TOKEN
}
@my-other-org:registry
=
https://gitlab.example.com/api/v4/packages/npm/
//gitlab.example.com/api/v4/packages/npm/:_authToken
=
"<your_token>"
//gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken
=
"<your_token>"
//gitlab.example.com/api/v4/packages/npm/:_authToken
=
${
MY_TOKEN
}
//gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken
=
${
MY_TOKEN
}
```
### npm metadata
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment