Skip to content

Latest commit

 

History

History
83 lines (54 loc) · 7.47 KB

File metadata and controls

83 lines (54 loc) · 7.47 KB

Heroku Cloud Native npm Install Buildpack

CI Registry

Heroku's official Cloud Native Buildpack for executing npm install.

How it works

The buildpack will pass detection if:

  • A package-lock.json file is found at the root of the application source.

Step 1: Configure npm cache

Node modules downloaded during the install step will be cached. Subsequent builds will use this cache speed up installs.

Step 2: Install Node modules

Node modules are installed by executing npm ci --production=false.

Step 3: Execute build scripts

The following scripts will be executed with npm run <script> in the order listed:

  • heroku-prebuild
  • heroku-build or build (if both are present, only heroku-build will execute)
  • heroku-postbuild

If any of the above scripts are not defined in package.json they will be skipped.

Step 4: Configure processes

If there is a start script defined in package.json a default web process will be added that executes npm start.

Build Plan

Provides

Name Description
node_modules Allows other buildpacks to depend on the Node modules provided by this buildpack.
node_build_scripts Allows other buildpacks to depend on the build script execution behavior provided by this buildpack.

Requires

Name Description
node To execute npm a Node.js runtime is required. It can be provided by the heroku/nodejs-engine buildpack.
npm To install node modules, the npm package manager is required. It can be provided by either the heroku/nodejs-engine or heroku/nodejs-npm-engine buildpacks.
node_modules This is not a strict requirement of the buildpack. Requiring node_modules ensures that this buildpack can be used even when no other buildpack requires node_modules.
node_build_scripts This is not a strict requirement of the buildpack. Requiring node_build_scripts ensures that this buildpack will perform build script execution even when no other buildpack requires node_build_scripts.

Build Plan Metadata Schemas

node_build_scripts
Example
[[requires]]
name = "node_build_scripts"

[requires.metadata]
enabled = false # this will prevent build scripts from running

License

See LICENSE file.