The Problem
All basic scripts starts in one massive JavaScript file that quickly turns into an unorganized mess. No type safety, no modularity, no structure. It works, but it doesn't scale, and it's painful to maintain which is why I assume a lot of scripts have been abandoned.
My Solution
I got tired of it, so I figured out how to write TamperMonkey scripts in TypeScript with my code neatly split across multiple files, and everything bundled into a single .user.js ready to install. But setting up that toolchain from scratch every time was its own headache. So I built a CLI tool that does it for you in seconds.
create-tampermonkey-typescript
A scaffolding tool that generates a fully configured TamperMonkey project with TypeScript, Vite, and all the boilerplate already wired up with no unnecessary additions to keep it as minimal as possible. Just run one command and start writing your script.
What you get:
- Write in TypeScript with as many files as you want — everything is bundled into a single script
- CSS injection — import
.cssfiles and they're automatically injected at runtime - Userscript header generated from
package.json— one source of truth for name, version, description, etc. - Optional React support out of the box
- Optional GitHub Actions workflows for automated tagging and releases
- Works with npm, yarn, or pnpm
Get started:
npx create-tampermonkey-typescript
Full documentation and source on GitHub: https://github.com/neth392/create-tampermonkey-typescript
npm package: https://www.npmjs.com/package/create-tampermonkey-typescript
If you write TamperMonkey scripts for Torn and want a better & quicker dev experience, give it a shot