Skip to content

[DOCS] How to get information about a child package during a lifecycle install script? #2954

@jamesla

Description

@jamesla

I have read through the following document but it is missing a specific condition: https://docs.npmjs.com/cli/v7/using-npm/scripts#environment

I am creating an NPM package and when somebody installs my package I want the install lifecycle script to run - which it does.

However the my package needs to know a few things about the downstream package that is installing it IE it's name and what directory it's in.

The documents explain how to get information about my own package via it's package.json file but not how to get information about the package that is installing it.

Is this possible and how would I do this using an NPM lifecycle script?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions