Do not save contributors and exports fields in npm metadata
Context
There is a constraint that limits the package_json
column of packages_npm_metadata
table to 20k
bytes.
What does this MR do and why?
Several customers faced the limitation with a large contributors
and exports
fields,
thus let's exclude them from being saved in package_json
in packages_npm_metadata
table.
Screenshots or screen recordings
No.
How to set up and validate locally
contributors
field
Publish a package with a large -
Create a new npm package
@gitlab-org/test
$ npm init
-
Set the correct authentication settings in
.npmrc
$ echo @gitlab-org:registry=http://gdk.test:3000/api/v4/projects/1/packages/npm/\\n//gdk.test:3000/api/v4/projects/1/packages/npm/:_authToken="<PAT token>" > .npmrc
Note:
1
is a project's id that I chose -
Download and execute ruby script
ruby put_large_contributors.rb
attached to the MR in the package's directory. It'll add a large contributors field to thepackage.json
. -
Verify that the package can be published.
$ npm publish
-
Check the saved
package_json
field ofPackages::Npm::Metadatum
usingrails console
. It doesn't containcontributors
information anymore.Packages::Package.where(name: "@gitlab-org/test").last.npm_metadatum.package_json
exports
field
Publish a package with a large -
Bump the version of package to
2.0.0
inpackage.json
to avoid any conflicts with existing published packages."version": "2.0.0"
-
Download and execute ruby script
ruby put_large_exports.rb
attached to the MR in the package's directory. It'll add a largeexports
field to thepackage.json
. -
Verify that the package can be published.
$ npm publish
-
Check the saved
package_json
field ofPackages::Npm::Metadatum
usingrails console
. It doesn't containexports
information anymore.Packages::Package.where(name: "@gitlab-org/test").last.npm_metadatum.package_json
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406617 (closed)