Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Npm package.json inheritance

Tags:

Is there a mechanism in npm like parent pom in Maven. The goal is to have a common base configuration for scripts, dependencies, devDependencies. Not based on templates like yeoman or so, but based on a parent version. So that, any project that changes his parent version gets the changes in this parent automatically.

Can you point me to hints to achieve this?

Thanks!

like image 492
PeeWee2201 Avatar asked Feb 24 '17 14:02

PeeWee2201


People also ask

Can I inherit package JSON?

The solution The central build script package can provide a set of shared partial package. json files. The monorepo packages can then declare that they inherit from those package.

Does NPM have workspaces?

Description. Workspaces is a generic term that refers to the set of features in the npm cli that provides support to managing multiple packages from your local file system from within a singular top-level, root package.

What is package JSON in angular?

package. json file locates in project root and contains information about your web application. The main purpose of the file comes from its name package, so it'll contain the information about npm packages installed for the project.


2 Answers

Currently there is no built-in npm mechanism to achieve this, and there's not likely to be one in the future.

See the discussion here and this comment particularly.

like image 68
RobC Avatar answered Sep 17 '22 06:09

RobC


We built https://github.com/Cosium/dry-dry.
Its only purpose is to add package.json inheritance capability.
It delegates all commands to npm.

The documentation is still in early stage, but it works.

like image 40
Réda Housni Alaoui Avatar answered Sep 18 '22 06:09

Réda Housni Alaoui