{"id":17827024,"url":"https://github.com/whaaaley/reload-server","last_synced_at":"2025-09-07T10:33:51.510Z","repository":{"id":91624428,"uuid":"324498486","full_name":"whaaaley/reload-server","owner":"whaaaley","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-26T07:10:12.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T03:15:42.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whaaaley.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":"2020-12-26T06:45:51.000Z","updated_at":"2020-12-26T07:10:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"2975baea-8922-4819-8231-c30f387da2d8","html_url":"https://github.com/whaaaley/reload-server","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/whaaaley%2Freload-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Freload-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Freload-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Freload-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whaaaley","download_url":"https://codeload.github.com/whaaaley/reload-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246811309,"owners_count":20837752,"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-27T18:57:36.735Z","updated_at":"2025-04-02T12:15:49.105Z","avatar_url":"https://github.com/whaaaley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# reload-server\n\u003e Runs commands when files change then sends an event to the client over SSE.\n\n## TODO\n+ Inject reload script into the client server side instead of importing it\n+ ESBuild outputs empty app.js files when there's a build error so the client won't auto reconnect (non-issue?)\n+ Refine the file extension flag syntax. ex: `--ext:js \u003ccommand\u003e --ext:css \u003ccommand\u003e`\n+ Use http2?\n\n## Usage\n\nExample using a makefile.\nThe `--bang` flag runs the following command immediately after the server starts.\nFlags like `--js` and `-scss` are flags that correlate to file extensions.\nThese extension flags can be anything.\n\n```makefile\nreload-server \\\n  --bang \"$(MAKE) css js html\" \\\n  --scss \"$(MAKE) css\" \\\n  --js \"$(MAKE) js\" \\\n  --watch \"src\"\n```\n\nInclude this in your JavaScript.\n\n```\nif (DEV === true) {\n  const source = new EventSource('/reload')\n\n  source.onmessage = body =\u003e {\n    if (body.data === 'connect') {\n      console.log('Connected to automatic reload')\n      return // stop execution\n    }\n\n    if (body.data === 'reload') {\n      window.location.reload()\n      return // stop execution\n    }\n\n    if (body.data === undefined) {\n      console.log('Heartbeat from automatic reload')\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhaaaley%2Freload-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhaaaley%2Freload-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhaaaley%2Freload-server/lists"}