Skip to content

Add missing `hasInstallScript` field on abbreviated package metadata

What does this MR do and why?

Add hasInstallScript field to abbreviated package metadata. More about abbreviated package metadata here. More about hasInstallScript here.

The field will be set to true for packages that contain scripts with install, preinstall or postinstall values.

Credits to @ksills-dev for authoring the main work: !160191 (closed).

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

No.

How to set up and validate locally

  1. Publish npm package to GitLab package registry docs, that contain scripts with either install, preinstall or postinstall values in package.json.

    Example:

    {
      "name": "@gitlab-org/banana",
      "version": "2.0.1",
      ...
      "scripts": {
        "install": "echo \"Error: no test specified\" && exit 1"
      }
    }
  2. Verify that the package's metadata contains hasInstallScript attribute set to true

    curl "http://gdk.test:3000/api/v4/projects/1/packages/npm/<package's name>" | grep hasInstallScript

Related to #344107

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading