{"id":22648214,"url":"https://github.com/dcastil/cache-cmd","last_synced_at":"2025-04-12T02:35:54.203Z","repository":{"id":40249396,"uuid":"417286721","full_name":"dcastil/cache-cmd","owner":"dcastil","description":"Run and cache a command based on various factors","archived":false,"fork":false,"pushed_at":"2025-02-12T11:46:55.000Z","size":170,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T00:36:35.042Z","etag":null,"topics":["cache","cli","command"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/cache-cmd","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcastil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dcastil"}},"created_at":"2021-10-14T21:26:12.000Z","updated_at":"2025-02-12T11:46:56.000Z","dependencies_parsed_at":"2023-02-07T06:46:21.913Z","dependency_job_id":"0ebf19ce-d222-4297-be5e-f0bb0dbc7280","html_url":"https://github.com/dcastil/cache-cmd","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.2857142857142857,"last_synced_commit":"8b0def25245fa219fe007606cf6232c6e25fda0a"},"previous_names":["dcastil/cache-cmd"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcastil%2Fcache-cmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcastil%2Fcache-cmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcastil%2Fcache-cmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcastil%2Fcache-cmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcastil","download_url":"https://codeload.github.com/dcastil/cache-cmd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248158332,"owners_count":21057157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","cli","command"],"created_at":"2024-12-09T07:54:29.813Z","updated_at":"2025-04-12T02:35:54.162Z","avatar_url":"https://github.com/dcastil.png","language":"TypeScript","funding_links":["https://github.com/sponsors/dcastil"],"categories":[],"sub_categories":[],"readme":"# cache-cmd\n\nRun and cache a command based on\n\n-   time since last run\n-   file change\n\n## Install\n\n```sh\n# Using npm\nnpm add --save-dev cache-cmd\n# Using pnpm\npnpm add --save-dev cache-cmd\n# Using yarn\nyarn add --dev cache-cmd\n```\n\n## Usage\n\n```sh\n# Shows help\nnpm exec -- cache-cmd --help\n\n# Runs command if it was not run in the last 20s\nnpm exec -- cache-cmd \"echo ran this command\" --time 20s\n\n# Runs command if package-lock.json in current directory changed since last run\nnpm exec -- cache-cmd \"npm install\" --file package-lock.json\n\n# Additionally uses custom cache directory instead of default in node_modules\nnpm exec -- cache-cmd \"npm install\" --file package-lock.json --cache-dir .config/cache\n\n# Runs command if it was not run in a month or any of the files changed\nnpm exec -- cache-cmd \"npm install\" --time 1mo --file package-lock.json --file package.json\n\n# Shows path to cache directory\nnpm exec -- cache-cmd cache dir\n\n# Clear cache\nnpm exec -- cache-cmd cache clear\n\n# You can also run it with npx to skip the install step\nnpx cache-cmd \"echo ran this command\" --time 20s\n```\n\nYou can use it to execute commands conditionally in `package.json` scripts.\n\n```json\n{\n    \"scripts\": {\n        \"start-dev\": \"cache-cmd \\\"npm install\\\" --file package-lock.json \u0026\u0026 start-dev-server\"\n    }\n}\n```\n\n## Contribute\n\nIf you find a bug or something you don't like, please [submit an issue](https://github.com/dcastil/cache-cmd/issues/new) or a pull request. I'm happy about any kind of feedback!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcastil%2Fcache-cmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcastil%2Fcache-cmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcastil%2Fcache-cmd/lists"}