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
fadd54bb
Commit
fadd54bb
authored
Dec 25, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic user docs for npm registry
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5e90764f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
0 deletions
+87
-0
doc/user/project/index.md
doc/user/project/index.md
+1
-0
doc/user/project/packages/npm_registry.md
doc/user/project/packages/npm_registry.md
+86
-0
No files found.
doc/user/project/index.md
View file @
fadd54bb
...
...
@@ -89,6 +89,7 @@ website with GitLab Pages
your code blocks, overriding GitLab's default choice of language
-
[
Badges
](
badges.md
)
: Badges for the project overview
-
[
Maven packages
](
packages/maven_repository.md
)
: Your private Maven repository in GitLab
**[PREMIUM]**
-
[
NPM packages
](
packages/npm_registry.md
)
: Your private NPM package registry in GitLab
**[PREMIUM]**
-
[
Code owners
](
code_owners.md
)
: Specify code owners for certain files
**[STARTER]**
-
[
License Management
](
merge_requests/license_management.md
)
: Approve and blacklist licenses for projects
**[ULTIMATE]**
...
...
doc/user/project/packages/npm_registry.md
0 → 100644
View file @
fadd54bb
# GitLab NPM Registry **[PREMIUM]**
> Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 11.7.
With the GitLab NPM Registry, every
project can have its own space to store its NPM packages.
![
GitLab NPM Registry
](
img/npm_package_view.png
)
NOTE:
**Note:**
Only scoped packages are supported.
## Enabling NPM Registry
NOTE:
**Note:**
This option is available only if your GitLab administrator has
[
enabled Packages feature
](
../../../administration/maven_repository.md
)
.
In order to use the GitLab NPM Registry, you must enable the Packages feature.
To enable (or disable) it:
1.
Navigate to your project's
**Settings > General > Permissions**
.
1.
Find the "Packages" feature and enable it.
1.
Click on
**Save changes**
for the changes to take effect.
You should then be able to see the
**Packages**
section on the left sidebar.
Next, you must configure your project to authorize with the GitLab NPM
registry.
## Package naming convention
Note that
**only packages that have the same path as the project**
are supported.
| Project | Package | Supported |
| ------- | ------- | --------------------------------- |
|
`foo/bar`
|
`@foo/bar`
| Yes |
|
`gitlab-org/gitlab-ce`
|
`@foo/bar`
| No |
|
`gitlab-org/gitlab-ce`
|
`@gitlab-org/gitlab-ce`
| Yes |
## Authenticating to the GitLab NPM Registry
If a project is private or you want to upload NPM package to GitLab,
credentials will need to be provided for authorization. Support is available for
[
oauth tokens
](
#authenticating-with-an-oauth-token
)
only.
### Authenticating with an oauth token
To authenticate with a
[
oauth token
](
../../../api/oauth2.md
)
,
add a corresponding section to your
`.npmrc`
file:
```
; Set URL for your scoped packages.
; For example package with name `@foo/bar` will use this URL for download
@foo:registry=https://gitlab.com/api/v4/packages/npm/
; Add OAuth token for scoped packages URL. This will allow you to download
; `@foo/` packages from private projects.
//localhost:3001/api/v4/packages/npm/:_authToken=1da4f6691c92a543f7416b8fe013357fda23b0730466841311b89809a51349ce
; Add OAuth token for uploading to the registry. Replace `YOUR_PROJECT_ID`
; with a project you want your package uploaded to.
//gitlab.com/api/v4/projects/YOUR_PROJECT_ID/packages/npm/:_authToken=YOUR_OAUTH_TOKEN
```
You should now be able to download and upload NPM packages to your project.
## Uploading packages
Before you will be able to upload a package, you need to specify registry for NPM.
To do this, you need to add next section to the bottom of
`package.json`
:
```
json
"publishConfig"
:
{
"registry"
:
"https://gitlab.com/api/v4/projects/YOUR_PROJECT_ID/packages/npm/"
}
```
Once you added it and have set up the
[
authorization
](
#authorizing-with-the-gitlab-npm-registry
)
,
test to upload an NPM package from a project of yours:
```
sh
npm publish
```
You can then navigate to your project's
**Packages**
page and see the uploaded
packages or even delete them.
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