pnpm / supi

Fast, disk space efficient installation engine. Used by pnpm
MIT License
24 stars 5 forks source link

This package has been moved to the pnpm multi-package repository.

supi - pnpm's installation engine

supi

Fast, disk space efficient installation engine. Used by pnpm

Status Windows build status

Install

Install it via npm.

npm install supi

It also depends on @pnpm/logger version 1, so install it as well via:

npm install @pnpm/logger@1

API

supi.installPkgs(pkgsToInstall, [options])

Install packages.

Arguments:

Returns: a Promise

Example:

const pnpm = require('pnpm')

pnpm.installPkgs({
  'is-positive': '1.0.0',
  'hello-world': '^2.3.1'
}, { saveDev: true })

supi.install([options])

Install all modules listed as dependencies in package.json.

Arguments: (same as in named install and additionally)

supi.uninstall(pkgsToUninstall, [options])

Uninstalls a package, completely removing everything pnpm installed on its behalf.

Arguments:

supi.link(linkFromPkgs, linkToNodeModules, [options])

Create symbolic links from the linked packages to the target package's node_modules (and its node_modules/.bin).

Arguments:

supi.linkToGlobal(linkFrom, options)

Create a symbolic link from the specified package to the global node_modules.

Arguments:

supi.linkFromGlobal(pkgNames, linkTo, options)

Create symbolic links from the global pkgNames to the linkTo/node_modules folder.

Arguments:

supi.unlink([options])

Unlinks all packages that were linked during development in a project. If the linked package is in package.json of the project, it is installed after unlinking.

Arguments:

supi.unlinkPkgs(pkgsToUnlink, [options])

Unlinks the listed packages that were linked during development in a project. If the linked package is in package.json of the project, it is installed after unlinking.

Arguments:

supi.prune([options])

Remove extraneous packages. Extraneous packages are packages that are not listed on the parent package's dependencies list.

Arguments:

supi.storeStatus([options])

Return the list of modified dependencies.

Arguments:

Returns: Promise<string[]> - the paths to the modified packages of the current project. The paths contain the location of packages in the store, not in the projects node_modules folder.

supi.storePrune([options])

Remove unreferenced packages from the store.

Hooks

Hooks are functions that can step into the installation process.

readPackage(pkg)

This hook is called with every dependency's manifest information. The modified manifest returned by this hook is then used by supi during installation.

Example:

const supi = require('supi')

supi.installPkgs({
  hooks: {readPackage}
})

function readPackage (pkg) {
  if (pkg.name === 'foo') {
    pkg.dependencies = {
      bar: '^2.0.0',
    }
  }
  return pkg
}

afterAllResolved(shr: Shrinkwrap): Shrinkwrap

This hook is called after all dependencies are resolved. It recieves and returns the resolved shrinkwrap object.

Acknowledgements

Thanks to Valentina Kozlova for the supi logo

License

MIT