userscript-typescript-template
userscript-typescript-template copied to clipboard
Template repo using Webpack and TypeScript to build your userscript for Tampermonkey and more extensions.
userscript-typescript-template
Template repo using Webpack and TypeScript to build your userscript for Tampermonkey and more extensions.
Automatically generate headers from your package.json!
Usage
1. Generate repostiory (two-ways)
- Use this template to create your new repository
- Clone this repository
# Use Github CLI
$ gh repo clone pboymt/userscript-typescript-template
# Or use 'git clone' command directly
$ git clone https://github.com/pboymt/userscript-typescript-template.git
Development
- Install dependencies with
npm install
ornpm ci
. - Edit settings in
userscript
object inpackage.json
, you can refer to the comments inplugins/userscript.plugin.ts
. - Code your userscript in
src
directory (likesrc/index.ts
). - Generate userscript with
npm run build
. - Import generated userscript to Tampermonkey by local file URI.
Compile other file types
You need install other loader plugins to support other file types.
For example, you can use scss-loader
to compile .scss
files. Install it with npm install --save-dev scss-loader node-sass
and add it in webpack.config.ts
.
Debug
Allow Tampermonkey's access to local file URIs (Tampermonkey FAQs) and import built userscript's file URL.
Publish you userscript
You can publish your userscript to Greasy Fork or other websites.
You can push your userscript to Github and import it to Greasy Fork.