-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
80 lines (69 loc) · 2.88 KB
/
Taskfile.yml
File metadata and controls
80 lines (69 loc) · 2.88 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
version: 3
vars:
TYPST_PACKAGES: '{{.XDG_DATA_HOME | default (print .HOME "/.local/share") }}/typst/packages'
tasks:
push:
desc: "Prepare repository for push"
silent: true
cmds:
- task: build
- task: thumbnail
- git add -A
- git diff HEAD
open:
desc: "Open current template result"
silent: true
cmds:
- open build/template.pdf
build:
desc: "Build the template PDF"
silent: true
cmds:
- echo "Installing the package into @preview namespace..."
- task: install-preview
- echo "Compiling the template into PDF"
- mkdir -p build
- typst compile template/main.typ build/template.pdf
watch:
desc: "Build and watch the template"
silent: true
cmds:
- typst watch template/main.typ build/template.pdf
thumbnail:
desc: "Build the package thumbnail"
silent: true
vars:
TEMP_DIR: tmp
cmds:
- echo "Building the thumbnail..."
- mkdir -p {{.TEMP_DIR}}
- defer: rm --recursive --force {{.TEMP_DIR}}
- typst compile --ppi 250 template/main.typ '{{.TEMP_DIR}}/example{n}.png'
- mv {{.TEMP_DIR}}/example01.png thumbnail.png
showcase:
desc: "Watch the template showcase"
silent: true
cmds:
- echo "Building the images..."
- mkdir -p showcase
- typst watch --ppi 250 template/main.typ 'showcase/page{n}.png'
install-local:
desc: "Install or update the template locally"
cmds:
- rm --force {{.TYPST_PACKAGES}}/local/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)
- mkdir -p {{.TYPST_PACKAGES}}/local/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); print $2}' typst.toml)
- ln -s $(pwd) {{.TYPST_PACKAGES}}/local/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)
uninstall-local:
desc: "Uninstall the template from the local storage"
cmds:
- rm {{.TYPST_PACKAGES}}/local/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)
install-preview:
desc: "Install or update the template scoped into @preview namespace cache"
cmds:
- rm --force {{.TYPST_PACKAGES}}/preview/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)
- mkdir -p {{.TYPST_PACKAGES}}/preview/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); print $2}' typst.toml)
- ln -s $(pwd) {{.TYPST_PACKAGES}}/preview/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)
uninstall-preview:
desc: "Uninstall the template from the @preview namespace cache"
cmds:
- rm {{.TYPST_PACKAGES}}/preview/$(awk -F ' = ' '/name/ {gsub(/"/, "", $2); name=$2} /version/ {gsub(/"/, "", $2); print name "/" $2}' typst.toml)