GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ninesalt/install-changed: Tiny npm package that only runs npm install if package.json has been modified.

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
lib
lib
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Install-changed

This package is a quick and easy way of figuring out whether or not package.json has been modified. It executes npm install if the file has been modified, otherwise it does nothing.

Install

You can find this package on npm and can install it with npm install install-changed

Usage

You can use it as follows. In your package.json, add a new script to run:

  "scripts": {
    "pre-run": "install-changed",
    "other-scripts: "whatever.js"
  },

Then when you run npm run pre-run it will automatically figure out what needs to happen.

Programatically

const installChanged = require('install-changed')

const isModified = installChanged.watchPackage({
  hashFilename: '.packagehash',
  installCommand: 'npm ci'
})

Options

CLI

install-changed --help

Usage: install-changed [options]

Options:
  --install-command [command]  The command to run when dependencies need to be installed/updated
  --hash-filename [filename]   Filename where hash of dependencies will be written to
  --hash-only                  Only update the hash
  -h, --help                   display help for command

Example

install-changed --hash-filename .packagehash --install-command "npm ci"

This will use the file .packagehash to store a hash of the installed dependencies and run npm ci instead of npm install when packages need to be installed / updated.

There may be some cases you just only want to update the hash. For example, when you are installing a new package you don't want the script to install the package again later. You can use the ---hash-only for that.

About

Tiny npm package that only runs npm install if package.json has been modified.

www.npmjs.com/package/install-changed

Resources

Readme
Apache-2.0 license
Activity

Stars

28 stars

Watchers

2 watching

Forks

10 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.