userscript-typescript-webpack is a starter to write simple userscripts in typescript
For typescript lover. The type definitions help you to write better scripts and faster.
I choose Tampermonkey instead of GreaseMonkey as it is available in both Firefox and Chrome. Do not hesitate to modify the definition file.
It won't be difficile to use with GreaseMonkey
I use Yarn for this project. It is not hard to use npm as well.
yarn installWrite your userscript inside src/userscript-main.ts file. Of course, you can break your code into many modules (Webpack is here for it).
@see package.json scripts
Build the userscript and paste the content of dist/ to your tampermonkey script:
yarn run buildYou can save the copy step by using another script as it will copy the output content inside your clipboard:
yarn run build-clipBrowser debugging tools are enough for most cases.