0.4.0 • Published 7 months ago
cache-cmd v0.4.0
cache-cmd
Run and cache a command based on
- time since last run
- file change
Install
# Using npm
npm add --save-dev cache-cmd
# Using pnpm
pnpm add --save-dev cache-cmd
# Using yarn
yarn add --dev cache-cmd
Usage
# Shows help
npm exec -- cache-cmd --help
# Runs command if it was not run in the last 20s
npm exec -- cache-cmd "echo ran this command" --time 20s
# Runs command if package-lock.json in current directory changed since last run
npm exec -- cache-cmd "npm install" --file package-lock.json
# Additionally uses custom cache directory instead of default in node_modules
npm exec -- cache-cmd "npm install" --file package-lock.json --cache-dir .config/cache
# Runs command if it was not run in a month or any of the files changed
npm exec -- cache-cmd "npm install" --time 1mo --file package-lock.json --file package.json
# Shows path to cache directory
npm exec -- cache-cmd cache dir
# Clear cache
npm exec -- cache-cmd cache clear
# You can also run it with npx to skip the install step
npx cache-cmd "echo ran this command" --time 20s
You can use it to execute commands conditionally in package.json
scripts.
{
"scripts": {
"start-dev": "cache-cmd \"npm install\" --file package-lock.json && start-dev-server"
}
}
Contribute
If you find a bug or something you don't like, please submit an issue or a pull request. I'm happy about any kind of feedback!
0.4.0-dev.f185d0d56407d1ad04d3e1df52f643b531eaed4f
10 months ago
0.4.0
10 months ago
0.4.0-dev.607a5f25670cef398dcb50eb5bdc9f25c6b2ef65
10 months ago
0.3.0-dev.57b573000c4461fbe9a6a0d0537bba295407310b
10 months ago
0.3.0
10 months ago
0.3.0-dev.099d2b5e5b90985951a5fcc8fe1d792f38569c87
10 months ago
0.2.0-dev.5da1a86494931a84f6d3aad80f4bed9d245a297e
10 months ago
0.2.0-dev.7098ba3784d94f8515529435c60343ac3e724316
10 months ago
0.2.0-dev.4a662091d40f9510cff02e70023e5919708daa8f
10 months ago
0.2.0-dev.c487faf7d6de493f66be37b5874e9e8efea51c76
10 months ago