{"id":17299988,"url":"https://github.com/mysteryblokhed/webpack-ts-userscript-library","last_synced_at":"2026-04-13T10:31:13.119Z","repository":{"id":111256600,"uuid":"450998728","full_name":"MysteryBlokHed/webpack-ts-userscript-library","owner":"MysteryBlokHed","description":"  A template to create UserScript libraries using TypeScript and Webpack. Mirrored from https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library","archived":false,"fork":false,"pushed_at":"2024-04-05T00:20:53.000Z","size":682,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T21:48:49.038Z","etag":null,"topics":["greasemonkey","library","node","npm","template","typescript","userscript","webpack"],"latest_commit_sha":null,"homepage":"","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/MysteryBlokHed.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":"2022-01-23T03:55:25.000Z","updated_at":"2022-01-28T03:09:15.000Z","dependencies_parsed_at":"2024-04-05T01:48:47.679Z","dependency_job_id":null,"html_url":"https://github.com/MysteryBlokHed/webpack-ts-userscript-library","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":"MysteryBlokHed/webpack-ts-userscript","purl":"pkg:github/MysteryBlokHed/webpack-ts-userscript-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MysteryBlokHed%2Fwebpack-ts-userscript-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MysteryBlokHed%2Fwebpack-ts-userscript-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MysteryBlokHed%2Fwebpack-ts-userscript-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MysteryBlokHed%2Fwebpack-ts-userscript-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MysteryBlokHed","download_url":"https://codeload.github.com/MysteryBlokHed/webpack-ts-userscript-library/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MysteryBlokHed%2Fwebpack-ts-userscript-library/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31748898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["greasemonkey","library","node","npm","template","typescript","userscript","webpack"],"created_at":"2024-10-15T11:25:03.104Z","updated_at":"2026-04-13T10:31:13.102Z","avatar_url":"https://github.com/MysteryBlokHed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-ts-userscript-library\n\nA template to create UserScript libraries using TypeScript and Webpack tested with Jest.\n\n\u003c!-- Info on how to use the template --\u003e\n\n## Difference between this and the original template\n\n### Use case\n\nThis template should only be used if you're making a library for other UserScript developers.\nIts Webpacked `.user.js` file adds exported members to a global object, letting them be used like this:\n\n```typescript\n// Use the exported hello function from the library\nconst { hello } = LibraryName\nhello()\n```\n\nThe template is also configured to be easily published to npm for developers that don't want to `@require` the library.\n\n### Documentation\n\nDocumentation is generated with TypeDoc.\nOn GitLab repositories, the latest documentation is automatically built and hosted on GitLab Pages.\n\n## Customizing the template\n\n### Changing UserScript info\n\nYou can search for `webpack-ts-userscript-library` and `LibraryName` across the template's files to find what needs replacing.\n\nThe UserScript's name, description, version, and author are all retrieved from the project's `package.json`.\nAnything else such as the site to match and the grants are changed from the [Webpack Config].\n\nThere's a call to `genBanner` that can be used to change the values added to the banner.\nTo add a single value, add a string key and value. To add multiple values for\nthe same key (eg. multiple `@match`'s), use an array as the value.\n\nExample:\n\n```javascript\nconst banner = genBanner({\n  name: 'my-userscript',\n  version: '0.1.0',\n  match: ['*://example.com/*', 'https://*.foo.com/bar*'],\n})\n\n/* Above example becomes: */\n// ==UserScript==\n// @name        my-userscript\n// @version     0.1.0\n// @match       *://example.com/*\n// @match       https://*.foo.com/bar*\n// ==/UserScript==\n```\n\n### Creating a release commit\n\nTo create a commit for a release version, run `yarn release`.\nThis will build the UserScript normally alongside a minified version in production mode.\nIt will then all files with `git add .`,\nand prompt you to add a version to the commit message.\nYou can then create a new tag and release for your project.\n\nBoth minified and unminified versions are generated since some UserScript hosting sites don't allow minified scripts.\nYou can use the `.min.user.js` file when you're able to, and the normal `.user.js` file otherwise.\n\n\u003c!-- These instructions can be updated to fit your project's requirements --\u003e\n\n## Use\n\n### In a Node project\n\nTo use in a Node project, add webpack-ts-userscript-library as a dependency.\n\n```sh\n# npm\nnpm install webpack-ts-userscript-library\n\n# yarn\nyarn add webpack-ts-userscript-library\n```\n\nYou can then import and use functions:\n\n```javascript\nimport { someFunction } from 'webpack-ts-userscript-library'\n```\n\n### In a normal UserScript\n\nIn a UserScript that isn't built with some build tool, you can `@require` the library:\n\n```javascript\n// @require     https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library/-/raw/main/webpack-ts-userscript-library.user.js\n```\n\n\u003c!-- Make sure that this is true for your project --\u003e\n\nYou can replace `main` with a specific release tag like `v0.1.0` to require a specific version:\n\n```javascript\n// @require     https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library/-/raw/v0.1.0/webpack-ts-userscript-library.user.js\n```\n\nEach release tag also has a minified version of the script available,\nwhich can be used by changing the file extension to `.min.user.js`:\n\n```javascript\n// @require     https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library/-/raw/v0.1.0/webpack-ts-userscript-library.min.user.js\n```\n\nFunctions are available on the global `LibraryName` object:\n\n```javascript\nconst { someFunction } = LibraryName\n```\n\n#### Type declarations\n\nThe types included with the npm package still work when the library is `@require`'d.\nJust add the types as a dev dependency for a Node project or install them globally.\nWith the package installed, include the following reference line somewhere in your TypeScript source file:\n\n```typescript\n/// \u003creference types=\"webpack-ts-userscript-library\" /\u003e\n```\n\n## Building\n\n### Setup\n\nBuilding this project requires Node.js and pnpm.\nTo install dependencies, run:\n\n```sh\npnpm install\n```\n\n### Build\n\nTo build the project, run:\n\n```sh\npnpm run build\n```\n\nTo automatically build when a source file is modified, run:\n\n```sh\npnpm run dev\n```\n\nBuilt JS files and type declarations will be placed in the `lib/` directory,\nand the UserScript will be placed in the root. The `package.json` file is configured\nto publish files in the `lib/` directory to npm.\n\n### Test\n\nTo test the project, run:\n\n```sh\nyarn test\n```\n\nThis project uses Jest for tests.\n\n## License\n\nThis project was created from [a template](https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library)\nlicensed under the MIT license\n([LICENSE](https://gitlab.com/MysteryBlokHed/webpack-ts-userscript-library/-/blob/main/LICENSE)\nor \u003chttp://opensource.org/licenses/MIT\u003e).\n\n[webpack config]: webpack.config.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysteryblokhed%2Fwebpack-ts-userscript-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmysteryblokhed%2Fwebpack-ts-userscript-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysteryblokhed%2Fwebpack-ts-userscript-library/lists"}