-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
43 lines (34 loc) · 1.11 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# https://taskfile.dev
version: '3'
env:
OUTPUT_FILE: userscript.user.js
TEMP_FOLDER: .temp
DIST_FOLDER: dist
tasks:
build:
deps: [delete-temp]
cmds:
# Transpile TypeScript files into JavaScript
- echo 💬 Transpiling TypeScript files...
- tsc
# Bundle all file in one JavaScript file
- echo 📦 Bundling files...
- npx rollup $TEMP_FOLDER/main.js --file $TEMP_FOLDER/main.js --format iife
# Add meta to the userscript file
- echo 🗃️ Adding metadata to the userscript file...
- mkdir $DIST_FOLDER
- touch $DIST_FOLDER/$OUTPUT_FILE
- cat userscript.meta.js $TEMP_FOLDER/main.js > $DIST_FOLDER/$OUTPUT_FILE
# Delete temporary files
- echo 🧹 Cleaning temporary files...
- rm -fr $TEMP_FOLDER
# Format the final code
- echo ✨ Formatting the final code...
- npm run --silent format
- echo 🎉 The userscript has been built! 🎉
- echo
- echo 👉 Your userscript is ready at $DIST_FOLDER/$OUTPUT_FILE
silent: true
delete-temp:
cmds:
- rm -fr $TEMP_FOLDER $DIST_FOLDER