JSPM

npminstall

0.6.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18512
  • Score
    100M100P100Q139991F
  • 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

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" } }
app/package.json
app/node_modules/.npminstall/a/1.0.0
app/node_modules/.npminstall/a/1.0.0/node_modules/c@ -> ../../../c/2.0.0
app/node_modules/.npminstall/a/1.0.0/node_modules/b@ -> ../../../b/1.0.0
app/node_modules/.npminstall/b/1.0.0
app/node_modules/.npminstall/b/1.0.0/node_modules/c@ -> ../../../c/1.0.0
app/node_modules/.npminstall/c/1.0.0
app/node_modules/.npminstall/c/2.0.0
app/node_modules/a@ -> .npminstall/a/1.0.0
app/node_modules/.npminstall/node_modules/b@ -> ../b/1.0.0 (latest version)
app/node_modules/.npminstall/node_modules/c@ -> ../c/2.0.0 (latest version)

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

Benchmarks

cli real user sys
npminstall 0m13.805s 0m10.060s 0m4.956s
npminstall with cache 0m12.285s 0m9.077s 0m4.443s
npminstall --no-cache 0m13.583s 0m9.579s 0m4.423s
pnpm 0m16.323s 0m13.132s 0m5.014s
npm 0m45.721s 0m31.606s 0m9.842s
npm with cache 0m30.427s 0m26.670s 0m7.821s

License

MIT