Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add support for metapackages (hoist dependencies of single package) #7394

@theres

Description

@theres

Contribution

Describe the user story

I'd like to have build-in support for metapackages (known from linux package managers or from nuget).

Background:
I've multiple repositories that share the same basic set of packages that should be in sync version with my boilerplate project. Right now I've to manually keep the version in sync in each and every project. I'd like to create single meta package that will manage my dependencies in all of child projects. After install this one, the direct dependencies will be hoisted to the root of my project.

Describe the solution you'd like

I see a couple of ways to do it:

  1. allow to set some additional flag in readPackage hook that will force hoisting of dependencies
  2. add additional option to .npmrc next to public-hoist-pattern - something like public-hoist-dependencies-of-pattern

Describe the drawbacks of your solution

This is purly optional, selective hoisting is supported anyways. The second option seems to be less intrusive, but some changes to @pnpm/hoist would be required that will introduce some addtional complexity to maitain.

Describe alternatives you've considered

  1. post install script that will manage symlinks for me
  2. post install script that will call pnpm add for each dependency of my meta package so it will be explicitly added to package.json
  3. pre-install script that will check all deps of my package, put it into .npmrc public-hoist-pattern

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions