Skip to content

Add option to run local lifecycle scripts, but not dependencies #8781

Open

Description

@remcohaszing

I like using lifecycle scripts for local development, but I don’t want third party packages to run their install scripts on my machine.

Typically my scripts look something like this:

{
  // …
  "scripts": {
    "prepack": "tsc --build",
    "pretest": "tsc --build",
    "test": "node --test"
  }
}

The pretest script could be merged into the test script using the && operator. However, I think the output is nicer when npm logs each step.

The prepack script is more important. It makes sure the TypeScript project gets compiler before packing / publishing.

A good first step would be to have an option to only run local scripts, no lifecycle hooks of any dependencies. Another idea is to explicitly allowlist which dependencies are allowed to run their lifecycle hooks. In a next major this could even disallow all dependencies by default.

This is related to #8698, but takes it a step further.

Activity

  1. ozz-oss commented on Nov 28, 2025

    @ozz-oss
  2. ozz-oss commented on Nov 28, 2025

    @ozz-oss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions