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

exec-if-updated

v1.1.1

Published

Command line utility to execute a command only if a set of source files have been updated since a set of target files."

Downloads

4

Readme

exec-if-updated

Node command line utility for executing a command only if a set of source files has been updated.

Motivation

The exec-if-updated application was primarily designed to be used in NPM scripts to prevent recompiling or regenerating files if their source has not changed. The determination is made by comparing the latest timestamps of a set of source and target files. If any source files are newer than the target files, the command is executed.

Installation

Prerequisites

The exec-if-updated program is designed to work with Node.js versions >= 8.x. You must have Node and NPM installed to install and run the application.

Locally

If you will be installing exec-if-updated for use in NPM scripts for your own package, the following commands can be used to install the program locally:

NPM

npm install --save-dev exec-if-updated

Yarn

yarn add --dev exec-if-updated

Globally

To install exec-if-updated for use across your entire system, use the following commands (depending on your environment and package manager):

NPM (Windows)

npm install -g exec-if-updated

NPM (Mac and Linux)

sudo npm install -g exec-if-updated

Yarn (Windows)

yarn global add exec-if-updated

Yarn (Mac and Linux)

sudo yarn global add exec-if-updated

Usage

exec-if-updated --source <src glob> --target <target glob> command

Options

--source, -s (REQUIRED)

The source option is used to control which source files will be compared to the target to check for updated files. The source option can be supplied multiple times to add additional source files for comparison to the targets.

exec-if-updated --source src/** -s assets/** --target <target glob> command

--target, -t (REQUIRED)

The target option specifies which files would be regenerated by the executable command. The target option can be specified multiple times to add additional target file for comparison.

exec-if-updated --source <source glob> --target dist/** -t build/** command

--help

The help option can be used to print help running the exec-if-updated application.

exec-if-updated --help

--version

The version option can be used to print the current version of the exec-if-updated application.

exec-if-updated --version

Examples

exec-if-updated --source src/*.es6 --target dist/*.js babel src/app.es6 -o dist/app.js
echo "Even works with pipes" | exec-if-updated --source src/** --target dist/** cat

Built With

  • Yargs - For command line parsing.
  • execa - For executing the command line application.
  • globby - For matching the file globs for comparison.

Versioning

exec-if-updated uses SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

Special thanks to Sindre Sorhus for the awesome utilities that greatly simplified this application.