2.3.0 • Published 2 years ago

promake-node-modules v2.3.0

Weekly downloads
97
License
MIT
Repository
github
Last release
2 years ago

promake-node-modules

CircleCI Coverage Status semantic-release Commitizen friendly npm version

Promake rule for installing node_modules only when necessary. It also prevents install processes from running simultaneously, since that's easy to do accidentally when some targets depend on a node_modules rule.

Usage

npm install --save promake-node-modules

Example in Promake script

#!/usr/bin/env node
// @flow

const Promake = require('promake')
const fs = require('fs-extra')
const nodeModulesRule = require('promake-node-modules')

const promake = new Promake()

const rule = nodeModulesRule({
  promake,
  projectDir: 'path/to/project', // defaults to process.cwd(),
  command: 'yarn', // defaults to npm
})

promake.task('deps', [rule])

promake.cli()

nodeModulesRule(options)

Creates a promake HashRule for installing node_modules. The hash is stored in node_modules/.cache/promake-node-modules.md5.

Arguments

options.promake (Promake, required)

The instance of Promake to add the rule to.

options.projectDir (string, optional, default: process.cwd())

The path to the project directory to install node_modules in.

options.command (string, optional, default: 'npm')

The command to run to install node_modules.

options.args (string[], optional, default: ['install'])

The arguments for the install command.

options.install ((options: {rule: Rule, projectDir: string}) => Promise<any>)

Custom function to perform installation (overrides command and args)

options.additionalFiles (string[], optional)

Additional files to include in the hash. You can put lockfiles in here, but be aware that if you run a command that updates the lockfile, it will cause this rule to run again (since the previous hash won't match).

2.3.0

2 years ago

2.2.1

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

7 years ago

1.0.0

7 years ago