Skip to content

WIP: Resolve "Add .npmrc button to project presenter file options"

What does this MR do?

Adds a new Add .npmrc button to the project presenter statistics buttons section. This button will only appear if there is a package.json file at the root level of the project structure (and the user has suitable permissions).

Screenshots

Add Button New File Page Once Added (or already existing)
Screenshot_2019-11-22_at_13.41.33 Screenshot_2019-11-22_at_13.42.02 Screenshot_2019-11-22_at_13.41.50

Gif:

add-npmrc

Generated file content:

# Add this line for each package scope you want to use GitLab as a registry for, changing <package-scope> to suit your package
@<package-scope>:registry=http://0.0.0.0:3000/api/v4/packages/npm/

# Uncomment the below line if you wish to upload NPM packages to the package registry
# Replace <your_project_id> with the project id of your registry and <your_auth_token> with your auth token
# http://0.0.0.0:3000/api/v4/projects/<your_project_id>/packages/npm/:_authToken=<your_auth_token>

# Replace <your-auth-token> with a user or ci auth token
http://0.0.0.0:3000/api/v4/packages/npm/:_authToken=<your-auth-token>

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #36657

Edited by Tim Rizzi

Merge request reports