{"id":17484687,"url":"https://github.com/ryanmcdermott/rules_devserver","last_synced_at":"2025-07-25T05:38:12.926Z","repository":{"id":65977374,"uuid":"583532679","full_name":"ryanmcdermott/rules_devserver","owner":"ryanmcdermott","description":"Bazel rule for running a web development server","archived":false,"fork":false,"pushed_at":"2023-01-01T18:05:00.000Z","size":270,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-21T21:07:53.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/ryanmcdermott.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":"2022-12-30T04:02:04.000Z","updated_at":"2022-12-30T04:02:33.000Z","dependencies_parsed_at":"2023-02-19T19:31:25.910Z","dependency_job_id":null,"html_url":"https://github.com/ryanmcdermott/rules_devserver","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Frules_devserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Frules_devserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Frules_devserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmcdermott%2Frules_devserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanmcdermott","download_url":"https://codeload.github.com/ryanmcdermott/rules_devserver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246045171,"owners_count":20714723,"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-19T01:05:17.636Z","updated_at":"2025-03-28T14:28:08.002Z","avatar_url":"https://github.com/ryanmcdermott.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rules_devserver: Web Development Server Bazel Rule\n\nThis repository contains a Bazel rule for running a development server. It is\nintended to be used for local development, and is not intended for production\nuse.\n\n## Features\n\n*   Live-reload via `ibazel` and a custom live-reload script.\n*   Hot swappable JavaScript modules.\n*   Custom routes for any dependency in the BUILD rule's `data` attribute.\n\n## Pre-requisites\n\n* Bazel 6.0.0 or higher\n* ibazel for live-reload\n* Linux. This rule has not been tested on other operating systems.\n\n## Setup\n\n### Workspace\n\n```\nworkspace(name = \"test_rules_devserver\")\n\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nhttp_archive(\n    name = \"rules_devserver\",\n    strip_prefix = \"rules_devserver-0.2.0\",\n    urls = [\"https://github.com/ryanmcdermott/rules_devserver/archive/refs/tags/0.2.0.tar.gz\"],\n)\n```\n\n### Example BUILD file\n\n```\nload(\"@rules_devserver//devserver:defs.bzl\", \"devserver\")\n\nfilegroup(\n    name = \"index\",\n    srcs = [\"index.html\"],\n    visibility = [\"//visibility:public\"]\n)\n\nfilegroup(\n    name = \"bundle\"\n    srcs = [\"bundle.js\"],\n    visibility = [\"//visibility:public\"]\n)\n\ndevserver(\n    name = \"serve\",\n    port = 8081,\n    workspace_name = \"test_rules_devserver\",\n    static_files = {\n        \"/\": [\":index\", \"index.html\"],\n        \"/scripts/bundle.js\": [\":bundle\", \"bundle.js\"]\n    },\n    data = [\":index\", \":bundle\"]\n)\n```\n\nThe `static_files` attribute is a dictionary of routes to files. The key is the route and the value is a tuple\nof the [filegroup target, file name]. All targets in the `static_files` attribute must also be in the `data` attribute.\n\n## Usage of Example BUILD file\n\n```\nibazel run //:serve\n```\n\nWhenever a file in the `data` attribute is changed, the server will be live-reloaded.\n\n## Hot Swap JavaScript Modules\n\nTo hot swap a JavaScript module, add the a data attribute on the `\u003cscript\u003e` tag in the HTML file. For example:\n\n```\n\u003cscript type=\"module\" data-hot-swap=\"true\" src=\"/scripts/bundle.js\"\u003e\u003c/script\u003e\n```\n\nWhen the server is live-reloaded, the browser will hot swap the JavaScript module, and the host page itself will not reload.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmcdermott%2Frules_devserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanmcdermott%2Frules_devserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmcdermott%2Frules_devserver/lists"}