dejarun
v0.1.2
Published
A file system operation cache for Node.js, using a hash of the file or folder contents as the cache key.
Downloads
965
Readme
Déjà-run
Skip running expensive commands or functions when input or output files or directories, or other dependencies haven’t changed.
CLI
npx dejarun \
--input src \
--output lang.json \
-- 'formatjs extract "src/**/*.{ts,tsx,vue}" --out-file lang.json'API
import dejarun from "dejarun";
await dejarun(
"extract-messages", // Unique name for this operation
async () => {
// Your expensive operation
await extractAndWrite(["src"], {
outFile: "lang.json",
});
},
// Options
{
inputs: ["src"], // Files or directories
outputs: ["lang.json"], // Files or directories
// dependencies: [], // Other dependencies
},
);Example output
[déjàrun] Cache hit, skip: extract-messagesOptions
| CLI flag | API Option | Type | Description |
| --------------------------- | -------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| --input (multiple) | inputs | string[] | Input files or directories to hash |
| --output (multiple) | outputs | string[] | Output files or directories to hash |
| --dependency (multiple) | dependencies | any[] | Extra data to hash (e.g. CLI args, config values) |
| --clean | clean | boolean | Force rerun even if nothing changed |
| --debug | debug | boolean | Print internal debug info |
| --logo, --no-logo | logo | string \| false | Customize the logo in the logs. You may use chalk, e.g. '${chalk.green("→")}'. Set false to hide. |
All options are optional.
