{"id":21948766,"url":"https://github.com/nemtsov/connect-chokidar","last_synced_at":"2026-03-06T12:03:12.010Z","repository":{"id":48373636,"uuid":"125683114","full_name":"nemtsov/connect-chokidar","owner":"nemtsov","description":"Middleware to watch files and remove require.cache on change, making nodemon unnecessary.","archived":false,"fork":false,"pushed_at":"2021-07-29T10:14:56.000Z","size":18,"stargazers_count":9,"open_issues_count":6,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-27T10:08:48.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/nemtsov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-18T01:29:19.000Z","updated_at":"2021-09-13T20:57:05.000Z","dependencies_parsed_at":"2022-09-26T16:41:16.212Z","dependency_job_id":null,"html_url":"https://github.com/nemtsov/connect-chokidar","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nemtsov/connect-chokidar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fconnect-chokidar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fconnect-chokidar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fconnect-chokidar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fconnect-chokidar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemtsov","download_url":"https://codeload.github.com/nemtsov/connect-chokidar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fconnect-chokidar/sbom","scorecard":{"id":679368,"data":{"date":"2025-08-11","repo":{"name":"github.com/nemtsov/connect-chokidar","commit":"65d5773992eb45dabf656622f6a8326a6aa4a06a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T22:35:51.394Z","repository_id":48373636,"created_at":"2025-08-21T22:35:51.394Z","updated_at":"2025-08-21T22:35:51.394Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30175908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T11:48:51.886Z","status":"ssl_error","status_checked_at":"2026-03-06T11:48:51.460Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-29T05:17:45.262Z","updated_at":"2026-03-06T12:03:11.990Z","avatar_url":"https://github.com/nemtsov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# connect-chokidar [![Build Status](https://img.shields.io/travis/nemtsov/connect-chokidar.svg)](http://travis-ci.org/nemtsov/connect-chokidar) [![NPM version](https://img.shields.io/npm/v/connect-chokidar.svg)](https://www.npmjs.com/package/connect-chokidar)\n\nMiddleware to watch files and remove `require.cache` on change, making nodemon unnecessary.\n\n## Motivation\n\nSometimes restarting the entire process when a file changes (as with nodemon) takes\ntoo long or is undesirable. This is often the case with \"universal\" web applications,\nwhere the code which runs both on the client and server is already hot-reloaded with webpack.\nIn such apps we sometimes have server-only code (such as a GraphQL server or a RESTful API).\nRestarting the entire server with nodemon would mean forcing webpack to have to take time\nto rebuild, loosing the benefits of hot reloading.\n\nThis module saves that time by specifically only removing files from the `require.cache`\n(a cache that `require()` uses on every call) when a change to one of the files on the\nfile system is detected.\n\n## Usage\n\n```javascript\nconst createWatcher = require('connect-chokidar');\n\nconst watchMiddleware = createWatcher(`${__dirname}`, {\n  // `process.env.NODE_ENV === 'development'` will be used as the default\n  // when this is `false`, no file watching will be done and your middleware\n  // will be executed with minimal interference\n  isDevEnv: process.env.NODE_ENV === 'development',\n\n  // Only the filenames that are in the regexp below will be deleted\n  // from `require.cache` when files change\n  requireCacheToRemoveRe: /\\/src\\//,\n\n  // `usePolling: true` is usually necessary with NFS (and, for me, in docker for mac)\n  // other `chokidar` opts can also be provided here\n  chokidar: {\n    usePolling: true,\n  },\n});\n\n//...\n\nconst app = connect(); // or express()\n\n// Now is the trickier bit, you'll have to `require()` all of the files that your\n// local middleware or router depend on. This is because if we required it on top,\n// the router / middleware would always refer to that instance and there would be\n// no way of clearing it.\n\napp.use('/auth', watchMiddleware(() =\u003e require('../auth/router')));\n\napp.use(\n  '/api',\n  watchMiddleware(() =\u003e {\n    const midA = require('./middlewareA');\n    const apiRouter = require('./api/router');\n    return [midA, apiRouter];\n  }),\n);\n\napp.use(\n  '/hello',\n  watchMiddleware(() =\u003e {\n    const midA = require('./middlewareA');\n    return [\n      midA,\n      (req, res) =\u003e {\n        res.end('world');\n      },\n    ];\n  }),\n);\n```\n\n## Debug-logging\n\nRun your process with the `NODE_DEBUG=connect-chokidar` environment variable set.\n\n## Inspiration\n\nhttps://codeburst.io/dont-use-nodemon-there-are-better-ways-fc016b50b45e\n\n## License\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtsov%2Fconnect-chokidar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemtsov%2Fconnect-chokidar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtsov%2Fconnect-chokidar/lists"}