Skip to content

Commit 2d8fdbd

Browse files
committed
first version of template.
1 parent 7df6607 commit 2d8fdbd

9 files changed

+3301
-0
lines changed

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
# userscript-typescript-template
2+
23
Template repo using Webpack and TypeScript to build your userscript for Tampermonkey and more extensions.
4+
5+
Automatically generate headers from your package.json!
6+
7+
## Useage (two-ways)
8+
9+
### 1. Generate repostiory from template or clone it
10+
11+
#### - Use this template to create your new repository
12+
13+
![](./images/github-use-template.png)
14+
15+
#### - Clone this repository
16+
17+
```bash
18+
# Use Github CLI
19+
$ gh repo clone pboymt/userscript-typescript-template
20+
# Or use 'git clone' command directly
21+
$ git clone https://github.com/pboymt/userscript-typescript-template.git
22+
```
23+
24+
### Development
25+
26+
1. Allow Tampermonkey's access to local file URIs. ([Tampermonkey FAQs](https://tampermonkey.net/faq.php?ext=dhdg#Q204))
27+
2. Install dependencies with `npm install` or `npm ci`.
28+
3. Write `userscript` settings in package.json, you can refer to the comments in [plugins/userscript.plugin.ts](./plugins/userscript.plugin.ts).
29+
4. Code your userscript in `src` directory (like [src/index.ts](./src/index.ts)).
30+
5. Generate userscript with `npm run build`.
31+
6. Import generated userscript to Tampermonkey by local file URI.
32+
33+
### Use other file types
34+
35+
You need install other loader plugins to support other file types.
36+
37+
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](./webpack.config.ts).
38+
39+
### After
40+
41+
You can publish your userscript to [Greasy Fork](https://greasyfork.org/) or other websites.
42+
43+
You can push your userscript to [Github](https://github.com) and import it to [Greasy Fork](https://greasyfork.org/import).

images/github-use-template.png

6.7 KB
Loading

0 commit comments

Comments
 (0)