开发者社区> 镜像站> NPM> deli
deli
Dedupes a package and links one of its dependent packages to an implementation outside of the package's directory tree.
Last updated 7 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install deli 
SYNC missed versions from official npm registry.

deli build status

Dedupes a package and links one of its dependent packages to an implementation outside of the package's directory tree.

Why?

npm dedupe does not affect packages linked via npm link or ln -s. This breaks in scenarios where it is crucial that certain packages are deduped, i.e. if only one instance of them is allowed in an application.

deli, short for de dupe - li nk, solves this by performing the link and dedupe step concurrently to make both features work together. In order to make the node module lookup work as if the linked package was still in the node_modules directory, it creates a pseudo package and creates symbolic links as neede.

Example

Link bar module to the implementation that is foo's sibling and dedupe packages.

Initial structure:

.
├── bar
│   ├── index.js
│   ├── node_modules
│   │   ├── foobar-common
│   │   │   ├── index.js
│   │   │   └── package.json
│   │   └── foobar-not-common
│   │       ├── index.js
│   │       └── package.json
│   └── package.json
├── foo
│   ├── index.js
│   ├── node_modules
│   │   ├── bar
│   │   │   ├── index.js
│   │   │   ├── node_modules
│   │   │   │   ├── foobar-common
│   │   │   │   │   ├── index.js
│   │   │   │   │   └── package.json
│   │   │   │   └── foobar-not-common
│   │   │   │       ├── index.js
│   │   │   │       └── package.json
│   │   │   └── package.json
│   │   └── foobar-common
│   │       ├── index.js
│   │       └── package.json
│   └── package.json
└── index.js

Result of running deli including npm dedupe

.
├── bar               -- implementation outside of node_modules
│   ├── index.js
│   ├── node_modules -> ../foo/node_modules/bar--__--/node_modules     -- link into main node_modules
│   └── package.json
├── foo
│   ├── index.js
│   ├── node_modules
│   │   ├── bar -> ../../bar                                -- link to implementation
│   │   ├── bar--__--                                       -- link to pseudo package
│   │   │   ├── node_modules
│   │   │   │   ├── foobar-common -> ../../foobar-common    -- link to deduped package
│   │   │   │   └── foobar-not-common
│   │   │   │       ├── index.js
│   │   │   │       └── package.json
│   │   │   └── package.json
│   │   └── foobar-common
│   │       ├── index.js
│   │       └── package.json
│   └── package.json
└── index.js

Status

link is working at this point, so you could give that a try.

Installation

npm install deli

API

License

MIT

Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None