npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zkochan/supi

v0.7.12

Published

Fast, disk space efficient installation engine

Downloads

1

Readme

supi

Status Windows build status

Fast, disk space efficient installation engine. Used by pnpm

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:

  • pkgsToInstall - Object | String[] - either an object that maps package names to version ranges or inputs usually passed to npm install (e.g., [email protected], foo).
  • options.saveProd - Boolean - package will appear in dependencies.
  • options.saveDev - Boolean - package will appear in devDependencies.
  • options.saveOptional - Boolean - package will appear in optionalDependencies.
  • options.saveExact - Boolean - saved dependencies will be configured with an exact version rather than using npm's default semver range operator.
  • options.global - Boolean - the packages will be installed globally rather than locally.
  • options.prefix - String - the directory in which the installation will be performed. By default the process.cwd() value is used.
  • options.metaCache - Map - a cache for package meta info.
  • options.networkConcurrency - Number - 16 by default. Max amount of network requests to perform concurrently.
  • options.offline - Boolean - false by default. Install packages using only the local registry mirror, w/o doing any network requests.
  • options.reporter - Function - A function that listens for logs.
  • options.packageManager - Object - The package.json of the package manager.
  • options.hooks - Object - A property that contains installation hooks. Hooks are documented separately.
  • options.ignoreFile - Function & (filename: string) => boolean - A function that decides which files in a package are ignored. For instance, there's no need in .travis.yml files in production, so you can set {ignoreFile: fn => fn === '.travis.yml'}.

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)

  • options.production - Boolean - true by default. If true, packages listed in dependencies will be installed.
  • options.development - Boolean - true by default. If true, packages listed in devDependencies will be installed.
  • options.optional - Boolean - Has the value of options.production by default. If true, packages listed in optionalDependencies will be installed. Can be true only when options.production is true as well.

supi.uninstall(pkgsToUninstall, [options])

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

Arguments:

  • pkgsToUninstall - String[] - the package names to be uninstalled.
  • options.saveProd - Boolean - the package will be removed from dependencies.
  • options.saveDev - Boolean - the package will be removed from devDependencies.
  • options.saveOptional - Boolean - the package will be removed from optionalDependencies.
  • options.global - Boolean - the packages will be uninstalled globally.
  • options.reporter - Function - A function that listens for logs.

supi.link(linkFrom, lintTo, [options])

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

Arguments:

  • linkFrom - String - path to the package that should be linked.
  • lintTo - String - path to the dependent package.
  • options.reporter - Function - A function that listens for logs.

supi.linkToGlobal(linkFrom, options)

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

Arguments:

  • linkFrom - String - path to the package that should be linked.
  • globalPrefix - String - path to the global directory.
  • options.reporter - Function - A function that listens for logs.

supi.linkFromGlobal(pkgName, linkTo, options)

Create a symbolic link from the global pkgName to the linkTo/node_modules folder.

Arguments:

  • pkgName - String - package to link.
  • linkTo - String - package to link to.
  • globalPrefix - String - path to the global directory.
  • options.reporter - Function - A function that listens for logs.

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:

  • options.prefix - String - by default process.cwd(). Path to the project.
  • options.reporter - Function - A function that listens for logs.

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:

  • pkgsToUnlink - String[] - the list of packages that have to be unlinked. If the passed in package is not an external link, then a warning is reported.
  • options.prefix - String - by default process.cwd(). Path to the project.
  • options.reporter - Function - A function that listens for logs.

supi.prune([options])

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

Arguments:

  • options.production - Boolean - by default false. If this property is true, prune will remove the packages specified in devDependencies.
  • options.prefix - String - by default process.cwd().
  • options.reporter - Function - A function that listens for logs.

supi.storeStatus([options])

Return the list of modified dependencies.

Arguments:

  • options.reporter - Function - A function that listens for logs.

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
}

Acknowledgements

Thanks to Valentina Kozlova for the supi logo

License

MIT