All Projects โ†’ cnpm โ†’ Npminstall

cnpm / Npminstall

Licence: other
Make `npm install` fast and easy.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Npminstall

Awesome Npm
Awesome npm resources and tips
Stars: โœญ 3,894 (+941.18%)
Mutual labels:  npm, package-manager, yarn
Ni
๐Ÿ’ก Use the right package manager
Stars: โœญ 179 (-52.14%)
Mutual labels:  npm, package-manager, yarn
Website
Yarn package manager website
Stars: โœญ 374 (+0%)
Mutual labels:  npm, package-manager, yarn
Benchmarks Of Javascript Package Managers
Benchmarks of JavaScript Package Managers
Stars: โœญ 388 (+3.74%)
Mutual labels:  npm, package-manager, yarn
Yarn
The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
Stars: โœญ 40,325 (+10682.09%)
Mutual labels:  npm, package-manager, yarn
Tbify
ไฝฟ็”จๆท˜ๅฎ้•œๅƒ่ฟ่กŒๅ‘ฝไปค: tbify [nvm|npm|npx|yarn|pnpm|...]
Stars: โœญ 153 (-59.09%)
Mutual labels:  npm, package-manager, yarn
Tiny Package Manager
Learn how npm or Yarn v1 works.
Stars: โœญ 125 (-66.58%)
Mutual labels:  npm, package-manager, yarn
Bolt
โšก๏ธ Super-powered JavaScript project management
Stars: โœญ 2,134 (+470.59%)
Mutual labels:  npm, package-manager, yarn
Tink
a dependency unwinder for javascript
Stars: โœญ 2,176 (+481.82%)
Mutual labels:  npm, package-manager
Corepack
Zero-runtime-dependency package acting as bridge between Node projects and their package managers
Stars: โœญ 196 (-47.59%)
Mutual labels:  npm, yarn
Asset Packagist
Asset Packagist
Stars: โœญ 235 (-37.17%)
Mutual labels:  npm, package-manager
Cheat Sheets
Cheat Sheets ๐Ÿญ๐Ÿค–๐Ÿ‘€
Stars: โœญ 185 (-50.53%)
Mutual labels:  npm, yarn
Atom Autocomplete Module Import
โš›๏ธ Search & install npm packages from import/require statements.
Stars: โœญ 182 (-51.34%)
Mutual labels:  npm, yarn
Yalc
Work with yarn/npm packages locally like a boss.
Stars: โœญ 3,155 (+743.58%)
Mutual labels:  npm, yarn
Greenkeeper Lockfile
๐Ÿ”’ Your lockfile, up to date, all the time
Stars: โœญ 181 (-51.6%)
Mutual labels:  npm, yarn
meta-package-manager
๐ŸŽ a wrapper around all package managers
Stars: โœญ 277 (-25.94%)
Mutual labels:  package-manager, yarn
Npx
execute npm package binaries (moved)
Stars: โœญ 2,634 (+604.28%)
Mutual labels:  npm, package-manager
Syncpack
Manage multiple package.json files, such as in Lerna Monorepos and Yarn/Pnpm Workspaces
Stars: โœญ 356 (-4.81%)
Mutual labels:  npm, yarn
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: โœญ 256 (-31.55%)
Mutual labels:  npm, yarn
npm-yarn-benchmark
Bash script for comparing NPM and Yarn performance
Stars: โœญ 42 (-88.77%)
Mutual labels:  package-manager, yarn

npminstall

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

Let npm install fast and easy.

Use as Cli

Install

$ npm install npminstall -g

Usage

In cnpm

It is integrated in cnpm.

$ npm install cnpm -g
$ cnpm install  // will use npminstall

npminstall

Usage:

  npminstall
  npminstall <pkg>
  npminstall <pkg>@<tag>
  npminstall <pkg>@<version>
  npminstall <pkg>@<version range>
  npminstall <folder>
  npminstall <tarball file>
  npminstall <tarball url>
  npminstall <git:// url>
  npminstall <github username>/<github project>

Can specify one or more: npm install ./foo.tgz [email protected] /some/folder
If no argument is supplied, installs dependencies from ./package.json.

Options:

  --production: won't install devDependencies
  --save, --save-dev, --save-optional: save installed dependencies into package.json
  -g, --global: install devDependencies to global directory which specified in `$ npm config get prefix`
  -r, --registry: specify custom registry
  -c, --china: specify in china, will automatically using chinese npm registry and other binary's mirrors
  -d, --detail: show detail log of installation
  --trace: show memory and cpu usages traces of installation
  --ignore-scripts: ignore all preinstall / install and postinstall scripts during the installation
  --no-optional: ignore optionalDependencies during the installation
  --forbidden-licenses: forbit install packages which used these licenses
  --engine-strict: refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.
  --flatten: flatten dependencies by matching ancestors dependencies
  --registry-only: make sure all packages install from registry. Any package is installed from remote(e.g.: git, remote url) cause install fail.
  --cache-strict: use disk cache even on production env

npmuninstall

Usage:

  npmuninstall <pkg>
  npmuninstall <pkg>@<version>
  npmuninstall <pkg>@<version> [<pkg>@<version>]

npmlink

Usage:

  npmlink <folder>

Use as Lib

Install

$ npm install npminstall --save

Usage

const npminstall = require('npminstall');

(async () => {
  await 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' },
    // ],
    // install to specific directory, default to root
    // targetDir: '/home/admin/.global/lib',
    // link bin to specific directory (for global install)
    // binDir: '/home/admin/.global/bin',
    // registry, default is https://registry.npmjs.org
    // registry: 'https://registry.npmjs.org',
    // debug: false,
    // storeDir: root + 'node_modules',
    // ignoreScripts: true, // ignore pre/post install scripts, default is `false`
    // forbiddenLicenses: forbit install packages which used these licenses
  });
})().catch(err => {
  console.error(err);
});

Support Features

  • [x] all types of npm package
    • [x] a) a folder containing a program described by a package.json file (npm install file:eslint-rule)
    • [x] b) a gzipped tarball containing (a) (npm install ./rule.tgz)
    • [x] c) a url that resolves to (b) (npm install https://github.com/indexzero/forever/tarball/v0.5.6)
    • [x] d) a @ that is published on the registry with (c)
    • [x] e) a @ (see npm-dist-tag) that points to (d)
    • [x] f) a that has a "latest" tag satisfying (e)
    • [x] g) a that resolves to (a) (npm install git://github.com/timaschew/cogent#fix-redirects)
  • [x] All platform support
  • [x] global install (-g, --global)
  • [x] preinstall, install, postinstall scripts
  • [x] node-gyp
    • [x] node-pre-gyp
  • [x] bin ([email protected], [email protected])
  • [x] scoped package
  • [x] bundleDependencies / bundledDependencies ([email protected], [email protected])
  • [x] optionalDependencies ([email protected])
  • [x] peerDependencies ([email protected], [email protected], [email protected])
  • [x] deprecate message
  • [x] --production mode
  • [x] save, save-dev, save-optional
  • [x] support ignore-scripts
  • [x] uninstall
  • [x] resolutions

Different with NPM

This project is inspired by pnpm, and has a similar store structure like pnpm. You can read pnpm vs npm to see the different with npm.

Limitations

  • You can't install from shrinkwrap(and don't want to support for now).
  • Peer dependencies are a little trickier to deal with(see rule 1 below).
  • You can't publish npm modules with bundleDependencies managed by npminstall(because of rule 2 below).
  • npminstall will collect all postinstall scripts, and execute them until all dependencies installed.
  • If last install failed, better to cleanup node_modules directory before retry.

node_modules directory

Two rules:

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

e.g.:

  • app: { "dependencies": { "debug": "2.2.0" } } (root)
  • [email protected]: { "dependencies": { "ms": "0.7.1" } }
app/
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ node_modules
    โ”œโ”€โ”€ [email protected]@debug
    โ”‚   โ”œโ”€โ”€ node_modules
    โ”‚   โ”‚   โ””โ”€โ”€ ms -> ../../[email protected]@ms
    โ”œโ”€โ”€ [email protected]
    โ”œโ”€โ”€ debug -> [email protected]@debug
    โ””โ”€โ”€ ms -> [email protected]@ms # for peerDependencies

flattened vs nested

npminstall will always try to install the maximal matched version of semver:

root/
  [email protected]
  mod/
    [email protected]~1.1.0
# will install two different version of koa when use npminstall.

you can enable flatten mode by --flatten flag, in this mod, npminstall will try to use ancestors' dependencies to minimize the dependence-tree.

root/
  [email protected]
  mod/
    [email protected]~1.1.0

root/
  [email protected]
  mod/
    [email protected]^1.1.0
# both the same version: 1.1.0

root/
  [email protected]~1.1.0
  mod/
    [email protected]^1.1.0
# both the same version: 1.1.2

root/
  mod/
    [email protected]^1.1.0
  moe/
    [email protected]~1.1.0
# two different versions

npminstall will always treat n.x and n.m.x as flattened

root/
  [email protected]
  mod/
    [email protected]
both the same version: 1.1.0

root/
  [email protected]~1.1.0
  mod/
    [email protected]
both the same version: 1.1.2

Resolutions

support selective version resolutions like yarn. which lets you define custom package versions inside your dependencies through the resolutions field in your package.json file.

Benchmarks

https://github.com/cnpm/npminstall-benchmark

cnpmjs.org install

cli real user sys
npminstall 0m10.908s 0m8.733s 0m4.282s
npminstall with cache 0m8.815s 0m7.492s 0m3.644s
npminstall --no-cache 0m10.279s 0m8.255s 0m3.932s
pnpm 0m13.509s 0m11.650s 0m4.443s
npm 0m28.171s 0m26.085s 0m8.219s
npm with cache 0m20.939s 0m19.415s 0m6.302s

pnpm benchmark

see https://github.com/pnpm/pnpm#benchmark

npminstall babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	0m8.929s       user	0m5.606s       sys	0m2.913s
pnpm i babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	0m12.998s      user	0m8.653s       sys	0m3.362s
npm i babel-preset-es2015 browserify chalk debug minimist mkdirp
    real	1m4.729s       user	0m55.589s      sys	0m23.135s

License

MIT

Contributors


fengmk2


dead-horse


ibigbug


afc163


yesmeck


popomore


welladamm


weihong1028


LeoYuan


cnlon


magicae


marcbachmann


snyk-bot


atian25


tommytroylin


wssgcg1213


yibn2008


hyj1991


vuchan

This project follows the git-contributor spec, auto updated at Wed May 08 2019 18:02:56 GMT+0800.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].