{"id":20645129,"url":"https://github.com/jesusgraterol/sw-builder","last_synced_at":"2026-02-07T04:01:58.409Z","repository":{"id":239343917,"uuid":"799232397","full_name":"jesusgraterol/sw-builder","owner":"jesusgraterol","description":"The sw-builder package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.","archived":false,"fork":false,"pushed_at":"2025-07-28T14:44:29.000Z","size":330,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T16:54:09.582Z","etag":null,"topics":["api","app","cache","gui","interface","progressive","progressive-web-application","pwa","service-worker","sw","user-interface","web","web-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sw-builder","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/jesusgraterol.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":"2024-05-11T14:24:41.000Z","updated_at":"2025-07-28T14:44:17.000Z","dependencies_parsed_at":"2024-05-28T22:47:38.999Z","dependency_job_id":"b2cc18a7-4935-45e1-a00e-fb2d90bb5481","html_url":"https://github.com/jesusgraterol/sw-builder","commit_stats":null,"previous_names":["jesusgraterol/sw-builder"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jesusgraterol/sw-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fsw-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fsw-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fsw-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fsw-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusgraterol","download_url":"https://codeload.github.com/jesusgraterol/sw-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fsw-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29186046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T03:35:06.566Z","status":"ssl_error","status_checked_at":"2026-02-07T03:34:57.604Z","response_time":63,"last_error":"SSL_read: 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":["api","app","cache","gui","interface","progressive","progressive-web-application","pwa","service-worker","sw","user-interface","web","web-api"],"created_at":"2024-11-16T16:18:47.694Z","updated_at":"2026-02-07T04:01:58.404Z","avatar_url":"https://github.com/jesusgraterol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Service Worker Builder\n\nThe `sw-builder` package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.\n\n\u003c/br\u003e\n\n## Getting Started\n\nInstall the package:\n```bash\nnpm i -D sw-builder\n```\n\nCreate the `sw-builder.config.json` file in your project's root:\n```json\n{\n  \"outDir\": \"dist\",\n  \"template\": \"base\",\n  \"includeToPrecache\": [\n    \"/assets\",\n    \"/some-other-dir\",\n    \"/index.html\",\n    \"/logo.png\",\n    \"/splash.png\"\n  ],\n  \"excludeFilesFromPrecache\": [\n    \"some-ignorable-file.woff2\"\n  ],\n  \"excludeMIMETypesFromCache\": [\n    \"application/json\",\n    \"text/plain\"\n  ]\n}\n```\n\nInclude the `sw-builder` binary in your `package.json` file:\n```json\n...\n\"scripts\": {\n  \"build\": \"tsc -b \u0026\u0026 vite build \u0026\u0026 sw-builder\",\n  \n  // specify a custom path for the configuration file\n  \"build\": \"tsc -b \u0026\u0026 vite build \u0026\u0026 sw-builder --config='sw-custom.config.json'\",\n}\n...\n```\n\n\n\u003cbr/\u003e\n\nIf you are using [Vite](https://vitejs.dev/) include an empty `sw.js` file in your `public` directory so you can test the Service Worker's Registration while developing.\n\n\n\n\n\u003cbr/\u003e\n\n## Types\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIBaseConfig\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  \n  The configuration required to build the 'base' template. This type should be turned into a discriminated union once more templates are introduced.\n  ```typescript\n  type IBaseConfig = {\n    // the dir path in which the build's output is placed\n    outDir: string;\n\n    // the name of the template that will be generated\n    template: ITemplateName;\n\n    // the list of asset paths that will be traversed and included in the cache\n    includeToPrecache: string[];\n\n    // the list of file names that will be ignored\n    excludeFilesFromPrecache: string[];\n\n    // the list of MIME Types that won't be cached when the app sends HTTP GET requests\n    excludeMIMETypesFromCache: string[];\n  };\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\u003cbr/\u003e\n\n## Templates\n\n- [`base`](https://github.com/jesusgraterol/sw-builder/blob/main/src/template/templates/base-template.sw.js)\n\n\n\n\n\n\u003cbr/\u003e\n\n## Built With\n\n- TypeScript\n\n\n\n\n\n\u003cbr/\u003e\n\n## Tests\n```bash\n# unit tests\nnpm run test:unit\n\n# integration tests\nnpm run test:integration\n```\n\n\n\n\u003cbr/\u003e\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusgraterol%2Fsw-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusgraterol%2Fsw-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusgraterol%2Fsw-builder/lists"}