{"id":13431358,"url":"https://github.com/egoist/nswatch","last_synced_at":"2025-08-20T18:34:09.243Z","repository":{"id":45275085,"uuid":"66800015","full_name":"egoist/nswatch","owner":"egoist","description":"Like gulp.watch but for npm scripts.","archived":false,"fork":false,"pushed_at":"2023-08-03T06:37:42.000Z","size":263,"stargazers_count":101,"open_issues_count":9,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-09T22:34:54.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/egoist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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},"funding":{"github":"egoist"}},"created_at":"2016-08-29T01:10:07.000Z","updated_at":"2024-08-10T23:58:34.000Z","dependencies_parsed_at":"2024-02-17T19:48:52.702Z","dependency_job_id":null,"html_url":"https://github.com/egoist/nswatch","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":"0.40909090909090906","last_synced_commit":"8f5d8e285ba7be1e2dbfd9d134648a7a820b1b9e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fnswatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fnswatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fnswatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fnswatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/nswatch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230445927,"owners_count":18227060,"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":[],"created_at":"2024-07-31T02:01:02.473Z","updated_at":"2024-12-19T14:08:18.227Z","avatar_url":"https://github.com/egoist.png","language":"TypeScript","funding_links":["https://github.com/sponsors/egoist"],"categories":["JavaScript","TypeScript"],"sub_categories":[],"readme":"# nswatch\n\n[![NPM version](https://img.shields.io/npm/v/nswatch.svg?style=flat-square)](https://npmjs.com/package/nswatch) [![NPM downloads](https://img.shields.io/npm/dm/nswatch.svg?style=flat-square)](https://npmjs.com/package/nswatch) [![Build Status](https://img.shields.io/circleci/project/egoist/nswatch/master.svg?style=flat-square)](https://circleci.com/gh/egoist/nswatch)\n\n\u003e Like gulp.watch but for npm scripts.\n\n## Install\n\n```bash\n$ npm install -D nswatch\n```\n\n## Usage\n\nAssuming you have an npm script `build` to compile something, then drop a `watch.js` in your project:\n\n```js\nimport { watch } from \"nswatch\";\n\nwatch(\"src/*.js\", [\"build\"]);\n```\n\nWhen you run `node watch`, the `npm run build` will be invoked right away, and will also be invoked when file changes are detected.\n\n\u003cimg src=\"./media/preview.png\" width=\"500\" /\u003e\n\n### Parallel and Sequence\n\n`Array` will be treated as parallel, `String` will be treated as sequence:\n\n```js\n// run in parallel\nwatch(\"src/a.js\", [\"task-a\", \"task-b\"]);\n// run in sequence\n// use ! as seperator\nwatch(\"src/b.js\", \"task-a!task-b\");\n```\n\n## CLI\n\n```bash\n$ npm install -g nswatch\n```\n\nYou can also use `nswatch` as a command-line program:\n\n### Configure `watch` in `package.json`\n\n```json\n{\n  \"watch\": {\n    \"./src/*.js\": [\"build\"],\n    \"./src/*.css\": \"compile!minify\"\n  }\n}\n```\n\nThen run:\n\n```bash\n$ nswatch\n```\n\nOr you can pass the config via CLI arguments, this way configurations in `package.json` will be ignored.\n\n```bash\n# in parallel\n$ nswatch \"src/*.js\" --script foo --script bar\n\n# in sequence\n$ nswatch \"src/*.js\" --script \"foo!bar\"\n```\n\n## Author\n\n**nswatch** © [EGOIST](https://github.com/egoist), Released under the [MIT](https://egoist.mit-license.org/) License.\u003cbr\u003e\nAuthored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/nswatch/contributors)).\n\n\u003e [egoistian.com](https://egoistian.com) · GitHub [@egoist](https://github.com/egoist) · Twitter [@rem_rin_rin](https://twitter.com/rem_rin_rin)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fnswatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Fnswatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fnswatch/lists"}