Dependency management

The NPM plugin adds a npmPackage extension that can be used inside the dependencies block to add NPM dependencies. For convenience, it can be used along with the npm configuration that is also added by the same plugin, however nothing prevents you from adding NPM dependencies to other configurations as well.

dependencies {
    pnpm npm.pkg(name: 'stringz', tag: '0.2.2')
}

Anything added with npmPackage can also update package.json depending on the type property.

Current properties that can be used are:

  • scope - NPM scope

  • name - NPM package name

  • tag - NPM tag

  • type - One of prod, dev, optional, peer. If not supplied, will default to prod.

  • install-args - Additional arguments that NPM has to use during installation.

  • path - Modify the system path when installing this package. By default, packages are installed with a very restricted environment. For instance, if the package installation requires access to /usr/bin, then this can be set here.

The transitive logic handling is still pretty crude.