-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
113 lines (98 loc) · 3 KB
/
justfile
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
##################################################
# Variables
#
open := if os() == "linux" {
"xdg-open"
} else if os() == "macos" {
"open"
} else {
"start \"\" /max"
}
project_dir := justfile_directory()
project_name := file_stem(justfile_directory())
typst_version := "typst -V"
typst_github := "https://github.com/typst/typst typst-cli --tag v0.11.0"
output_dir := "06-pdf"
doc_name := "main"
##################################################
# COMMANDS
#
# List all commands
@default:
just --list
# Information about the environment
@info:
echo "Environment Informations\n------------------------\n"
echo " OS : {{os()}}({{arch()}})"
echo " Open : {{open}}"
echo " Typst : `{{typst_version}}`"
echo " Projectdir : {{project_dir}}"
echo " Projectname : {{project_name}}"
# install required sw
[windows]
[linux]
@install:
echo "Install typst"
cargo install --git {{typst_github}}
echo "Install polylux"
cargo install --git https://github.com/andreasKroepelin/polylux/ --branch release
# install required sw
[macos]
@install:
echo "Install typst"
brew install typst
echo "Install polylux"
cargo install --git https://github.com/andreasKroepelin/polylux/ --branch release
# watch a typ file for continuous incremental build
watch file_name=doc_name:
typst w {{file_name}}.typ
# open pdf
open file_name=doc_name:
{{open}} {{file_name}}.pdf
# build, rename and copy a typ file to a pdf
@pdf file_name=doc_name:
echo "--------------------------------------------------"
echo "-- Generate {{file_name}}.pdf"
echo "--"
typst c {{file_name}}.typ
mkdir -p {{output_dir}}
mv {{file_name}}.pdf "{{output_dir}}/{{project_name}}.pdf"
just clean
# build, rename and copy a typ file in all variants
@pdf-all file_name=doc_name:
echo "--------------------------------------------------"
echo "-- Generate all variants of {{file_name}}.pdf"
echo "--"
just pdf {{file_name}}
@slides folder_name=doc_name:
echo "--------------------------------------------------"
echo "-- Generate 05-meetings/{{folder_name}}/slides.pdf"
typst compile --root ./ 05-meetings/{{folder_name}}/slides.typ
echo "-- Generate 05-meetings/{{folder_name}}/slides.pdfpc"
polylux2pdfpc --root ./ 05-meetings/{{folder_name}}/slides.typ
echo "--"
@open-slides folder_name=doc_name:
pdfpc 05-meetings/{{folder_name}}/slides.pdf # -s
# cleanup intermediate files
[linux]
[macos]
@clean:
echo "--------------------------------------------------"
echo "-- Clean {{project_name}}"
echo "--"
rm 00-templates/*.pdf || true
rm 01-settings/*.pdf || true
rm 02-main/**/*.pdf || true
rm 03-tail/*.pdf || true
rm 04-resources/*.pdf || true
# cleanup intermediate files
[windows]
@clean:
echo "--------------------------------------------------"
echo "-- Clean {{project_name}}"
echo "--"
del /q /s 00-templates\*.pdf 2>nul
del /q /s 01-settings\*.pdf 2>nul
del /q /s 02-main\**\*.pdf 2>nul
del /q /s 03-tail\*.pdf 2>nul
del /q /s 04-resources\*.pdf 2>nul