Skip to content

Extract package metadata for npm packages

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Release notes

You are using the GitLab Package Registry to publish and share your node dependencies right alongside your source code and pipelines. Convenient huh? Well what hasn't been convenient is that not all of the metadata from the package.json is available in the Package Registry user interface. That makes it hard to verify the package quickly, which is really what we want the UI to help with.

While we are still working on making that data available in the API and searchable (read more about it in the epic: &5151 (closed)), we thought a solid first iteration was to simply display the contents of the file in the UI.

Now when you navigate to the package details page, you can view the contents of the package.json file right in the UI.

Problem to solve

When an npm package is uploaded to the GitLab Package Registry it includes a package.json which is packaged in a tar.gz file. The package.json contains important metadata for a given package. This data is used to validate that you are using the correct package or to verify that it was built correctly. However, only a limited subset of this data is currently displayed in the Package Registry UI. This makes it hard for node developers to verify their dependencies.

Proposal

When an npm package is uploaded, the backend should pass a metadata_file to the front end, so the file can be displayed in the user interface.

Data to extract

(reference: https://docs.npmjs.com/cli/v6/configuring-npm/package-json

Metadata
name
version
description
keywords
homepage
bugs
license
people
people.author
people.author.name
people.author.email
people.author.url
people.contributor
people.contributor.name
people.contributor.email
people.contributor.url
funding
files
main
browser
bin
man
directories
directories.lib
directories.bin
directories.man
directories.doc
directories.example
directories.test
repository
scripts
config
dependencies
engines
engineStrict
os
cpu
preferGlobal
private
publishConfig
ng-update (needed by angular)
Edited by 🤖 GitLab Bot 🤖