-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
executable file
·233 lines (204 loc) · 7.35 KB
/
Copy pathjustfile
File metadata and controls
executable file
·233 lines (204 loc) · 7.35 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/env -S just --justfile
set unstable := true
public_base_prefix := "https://salif.github.io/zola-themes-collection/demo/"
local_base_prefix := "http://127.0.0.1:1111/demo/"
browser := "chromium"
ext := "webp"
font := "Roboto"
this_file := source_file()
this := just_executable() + " -f " + quote(this_file)
scripts := source_directory() / "scripts"
node_modules := scripts / "node_modules"
bin := scripts / ".bin"
zola_version := "0.22.1"
export PATH := bin / zola_version + PATH_VAR_SEP + node_modules / ".bin" + PATH_VAR_SEP + env_var("PATH")
_:
@{{ this }} --list --unsorted
[group("help")]
[script("node")]
status_short:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setArgs({
local_base_prefix: "{{ local_base_prefix }}", public_base_prefix: "{{ public_base_prefix }}",
bin: "{{ bin }}", browser: "{{ browser }}", ext: "{{ ext }}", font: "{{ font }}",
})
m.justStatusShort()
[group("help")]
[script("node")]
status:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.justStatus()
[group("build")]
[script("node")]
demo_build path base_prefix=public_base_prefix:
import { ThemeManager, Do } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({bin: "{{ bin }}"})
m.justDemoBuild("{{ path }}", Do.INSTALL)
[group("build")]
[script("node")]
demo_build_all base_prefix=public_base_prefix:
import { ThemeManager, Do } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({bin: "{{ bin }}"})
m.justDemoBuildAll(Do.INSTALL)
[group("build")]
[script("node")]
check_build path base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({bin: "{{ bin }}"})
const [exitCode, version] = m.justCheckBuild("{{ path }}")
console.log("VERSION {{ path }}: " + version)
process.exit(exitCode)
[group("build")]
[script("node")]
check_build_all base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({bin: "{{ bin }}"})
m.justCheckBuildAll()
[group("build")]
[script("node")]
demo_remove_all:
import fs from "fs"
import path from "path"
const demos = fs.readdirSync(path.resolve("static", "demo"),
{ withFileTypes: true }).filter(e => e.isDirectory())
console.log(`Removing ${demos.length} dirs`)
for (const demo of demos) {
fs.rmSync(path.join(demo.parentPath, demo.name), { recursive: true, force: true })
}
[group("build")]
[script("node")]
data_update:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ public_base_prefix }}")
m.setArgs({bin: "{{ bin }}", ext: "{{ ext }}"})
m.justDataUpdate()
[group("screenshot")]
[script("node")]
screenshot_changed mode browser=browser base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({browser: "{{ browser }}", ext: "{{ ext }}", font: "{{ font }}"})
m.getChangedThemes().forEach(theme => {
m.justScreenshot(theme.path, "{{ mode }}")
})
[group("screenshot")]
[script("node")]
screenshot_all_dark browser=browser base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({browser: "{{ browser }}", ext: "{{ ext }}", font: "{{ font }}"})
m.themes.forEach(theme => {
m.justScreenshot(theme.path, "dark")
})
[group("screenshot")]
[script("node")]
screenshot_all_light browser=browser base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({browser: "{{ browser }}", ext: "{{ ext }}", font: "{{ font }}"})
m.themes.forEach(theme => {
m.justScreenshot(theme.path, "light")
})
[group("screenshot")]
[script("node")]
screenshot path mode browser=browser base_prefix=local_base_prefix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
m.setBasePrefix("{{ base_prefix }}")
m.setArgs({browser: "{{ browser }}", ext: "{{ ext }}", font: "{{ font }}"})
m.justScreenshot("{{ path }}", "{{ mode }}")
[group("screenshot")]
[script("node")]
screenshots_to_fix:
import { ThemeManager } from "{{ scripts }}/ThemeManager.js"
const m = new ThemeManager()
const [toAdd, toDelete] = m.checkScreenshots(".{{ ext }}")
m.printCheckedScreenshots(toAdd, toDelete)
[group("build")]
local_test_all: (demo_build_all local_base_prefix) data_update
zola serve
[confirm]
[private]
docker_build:
docker build -t zola-ztc -f Dockerfile .
[private]
docker_test:
docker run --rm -v "$PWD:/src" \
zola-ztc:latest sh -c \
"just"
[group("help")]
install_zola version=zola_version ar='x86_64-unknown-linux-gnu':
mkdir -p "{{ bin }}/{{ version }}"
curl -s -L "https://github.com/getzola/zola/releases/download/v{{ version }}/zola-v{{ version }}-{{ ar }}.tar.gz" | \
tar xvzf - -C "{{ bin }}/{{ version }}"
[group("help")]
submodule_remove path: && screenshots_to_fix
@git diff --quiet .gitmodules
test -d '{{ path }}'
git submodule deinit -f '{{ path }}'
rm -rf '.git/modules/{{ path }}'
git rm -f '{{ path }}'
[group("help")]
submodule-add url name:
@if ! [[ "{{ name }}" =~ ^[A-Za-z0-9._-]+$ ]]; then \
printf "Name not allowed!\n"; exit 1; fi;
@git diff --quiet .gitmodules
! test -d 'themes/{{ name }}'
git submodule add -- '{{ url }}' 'themes/{{ name }}'
git config -f .gitmodules submodule.'themes/{{ name }}'.ignore dirty
git config -f .gitmodules submodule.'themes/{{ name }}'.color both
git config -f .gitmodules submodule.'themes/{{ name }}'.zola {{ zola_version }}
{{ this }} check_build 'themes/{{ name }}'
git add .gitmodules
[group("help")]
submodule_update_all:
@git diff --quiet .gitmodules
git submodule update --remote
git submodule foreach --recursive git submodule update --init
git submodule summary
[group("help")]
submodule_dates:
for t in themes/*; do \
git log --diff-filter=A --pretty=format:"%ad" --date=short -- "$t"; \
done
[group("push")]
[script("node")]
fix_public_dir:
import fs from "fs"
const filesToDelete = fs.globSync(["docs/demo/**/*.mp4", "docs/demo/**/*.webm", "docs/demo/*/robots.txt"])
for (const fileToDelete of filesToDelete) {
fs.rmSync(fileToDelete, { recursive: true, force: true })
}
console.log(`Deleted ${filesToDelete.length} files`)
[confirm]
[group("push")]
gh_pages: && demo_remove_all (demo_build_all public_base_prefix) screenshots_to_fix data_update gh_pages_2
git diff --cached --quiet
git switch gh-pages
git merge main -X theirs --no-ff --no-commit
[group("push")]
[private]
gh_pages_2: && fix_public_dir gh_pages_3
rm -rf docs
zola build -o docs
[group("push")]
[private]
gh_pages_3:
git add docs
git merge --continue
git push
git switch -