documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[BUG] package.json vars documentation seems outdated

Open a5hk opened this issue 3 years ago • 1 comments

What / Why

Apparently many package.json vars have been removed since v6 (reference). But docs are still pointing to them here:

You can access these variables in your code with process.env.npm_package_name and process.env.npm_package_version, and so on for other fields.

and here:

Objects are flattened following this format, so if you had {"scripts":{"install":"foo.js"}} in your package.json, then you'd see this in the script: process.env.npm_package_scripts_install === "foo.js"

References

  • https://github.com/npm/cli/issues/2609
  • https://docs.npmjs.com/cli/v8/using-npm/scripts#packagejson-vars
  • https://docs.npmjs.com/cli/v8/using-npm/scripts#current-lifecycle-event

a5hk avatar Jan 14 '22 07:01 a5hk

{ "scripts": { "precompress": "{{ executes BEFORE the compress script }}", "compress": "{{ run command to compress files }}", "postcompress": "{{ executes AFTER compress script }}" } }

nona2512 avatar Apr 07 '22 14:04 nona2512