JSPM

npminstall

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18512
  • Score
    100M100P100Q139794F
  • License MIT

Let npm install fast and easy

Package Exports

  • npminstall
  • npminstall/bin/install
  • npminstall/bin/install.js
  • npminstall/lib/utils
  • npminstall/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npminstall) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npminstall

NPM version build status appveyor build status Test coverage David deps npm download

Let npm install fast and easy.

Installation

$ npm install npminstall --save

Quick start

const co = require('co');
const npminstall = require('npminstall');

co(function*() {
  yield npminstall({
    // install root dir
    root: process.cwd(),
    // optional packages need to install, default is package.json's dependencies and devDependencies
    // pkgs: [
    //   { name: 'foo', version: '~1.0.0' },
    // ],
    // registry, default is https://registry.npmjs.org
    // registry: 'https://registry.npmjs.org',
    // debug: false,
    // storeDir: root + '.npminstall',
  });
}).catch(function(err) {
  console.error(err.stack);
});

node_modules directory

Two rules:

  • The latest version of modules will link at options.storeDir's node_modules.
  • Module's dependencies will link at module's node_modules.

e.g.:

  • app: { "dependencies": { "a": "1.0.0" } } (root)
  • a@1.0.0: { "dependencies": { "c": "2.0.0", "b": "1.0.0" } }
  • b@1.0.0: { "dependencies": { "c": "1.0.0" } }
  • c@1.0.0 & c@2.0.0: { "dependencies": { } }
app/
└── node_modules/
    ├── .npminstall/
    │   ├── debug/
    │   │   └── 2.2.0/
    │   │       └── debug/
    │   │           └──  node_modules/
    │   │               └── ms -> ../../../../ms/0.7.1/ms
    │   ├── ms/
    │   │   ├── 0.5.1/
    │   │   │   └── ms/
    │   │   └── 0.7.1/
    │   │       └── ms/
    │   └── node_modules/
    │       └── ms -> ../ms/0.7.1/ms
    ├── debug -> .npminstall/debug/2.2.0/debug
    └── ms -> .npminstall/ms/0.5.1/ms

debug@1.0.0 is root package, won't create link at app/node_modules/.npminstall/node_modules/debug@.

Benchmarks

cli real user sys
npminstall 0m13.808s 0m9.679s 0m4.854s
npminstall with cache 0m11.712s 0m8.769s 0m4.377s
npminstall --no-cache 0m11.778s 0m9.179s 0m4.358s
pnpm 0m17.991s 0m13.847s 0m5.205s
npm 0m34.436s 0m30.282s 0m9.759s
npm with cache 0m36.533s 0m24.625s 0m7.562s

License

MIT