{"id":17446012,"url":"https://github.com/jamen/serve-dev","last_synced_at":"2025-04-02T11:22:29.251Z","repository":{"id":96785421,"uuid":"183806877","full_name":"jamen/serve-dev","owner":"jamen","description":"ZEIT's serve with auto-reloading and GNU Make rebuilding.","archived":false,"fork":false,"pushed_at":"2019-04-27T18:14:39.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T02:24:04.836Z","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/jamen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-27T18:14:30.000Z","updated_at":"2021-12-19T15:26:50.000Z","dependencies_parsed_at":"2023-07-14T08:30:42.601Z","dependency_job_id":null,"html_url":"https://github.com/jamen/serve-dev","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fserve-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fserve-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fserve-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fserve-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/serve-dev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246803059,"owners_count":20836482,"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-10-17T18:20:25.995Z","updated_at":"2025-04-02T11:22:29.218Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serve-dev\n\nZEIT's [serve](https://github.com/zeit/serve) made with auto-reloading and GNU Make rebuilding.\n\n![serve-dev demo](./demo.png)\n\n## Install\n\n```\nnpm i @jamen/serve-dev\n```\n\n## Usage\n\n### `serve-dev [public] [options]`\n\nStarts a static file serve with optional rebuilding and auto-reloading.\n\nThe available options are:\n\n- `--listen \u003clisten_uri\u003e` Specifies where the server listens from. Its the same as `serve`.\n- `--config \u003cpath\u003e` Loads a JSON file of `serve-handler` options.\n- `--watch \u003cpattern\u003e` A file, directory, or glob pattern where the server watches files.\n- `--make \u003ctarget\u003e` A make target that corrosponds to a watcher.\n- `--https` Enables HTTPS. Uses `--key` and `--cert`.\n- `--program \u003cname\u003e` Use something other than `make` for building.\n- `--reload \u003cpath\u003e` The server endpoint where reload events are pushed.\n\n### Auto-reloading\n\nIn order for auto-reloading to work, your application needs to support it. This is demonstrated in the code below.\n\n```js\nlet src\n\n(function connect (reconnect) {\n    src = new EventSource('/__reload')\n    src.onopen = () =\u003e reconnect \u0026\u0026 window.location.reload()\n    src.onmessage = () =\u003e window.location.reload()\n    src.onerror = () =\u003e setTimeout(() =\u003e connect(true), 3000)\n})()\n\nwindow.addEventListener('beforeunload', () =\u003e {\n    if (src \u0026\u0026 src.readyState \u003c 2) {\n        src.close()\n    }\n})\n```\n\n[A bug](https://bugzilla.mozilla.org/show_bug.cgi?id=833462) with Firefox makes the `beforeunload` event listener necessary.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fserve-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fserve-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fserve-dev/lists"}