38 lines
1.2 KiB
Makefile
38 lines
1.2 KiB
Makefile
articles := "./content/articles"
|
|
docker_image := "homelab/docs"
|
|
docker_tag := "latest"
|
|
shortdate := `date +%F`
|
|
|
|
[private]
|
|
default:
|
|
@just --list
|
|
|
|
# Run the development server.
|
|
[group('dev')]
|
|
run:
|
|
#!/usr/bin/env zsh
|
|
touch .build/browser-dev-sync
|
|
browser-sync start -p localhost:1414 --watch --files '.build/browser-dev-sync' &
|
|
watchexec -w Sources -e .swift -r 'swift run && touch .build/browser-dev-sync' &
|
|
watchexec -w content -e .md -r 'swift run && touch .build/browser-dev-sync' &
|
|
watchexec -w .build/browser-dev-sync --ignore-nothing -r 'npx -y pagefind --site deploy --serve'
|
|
|
|
# Create a new article with given name and tags.
|
|
new-article name *tags:
|
|
@echo "---" > {{articles}}/{{shortdate}}-{{name}}.md
|
|
@echo "date: {{shortdate}}" >> {{articles}}/{{shortdate}}-{{name}}.md
|
|
@echo "tags: `./scripts/join-tags.sh {{tags}}`" >> {{articles}}/{{shortdate}}-{{name}}.md
|
|
@echo "---" >> {{articles}}/{{shortdate}}-{{name}}.md
|
|
@echo {{articles}}/{{shortdate}}-{{name}}.md
|
|
|
|
alias n := new-article
|
|
|
|
latest-article:
|
|
@echo "$(find {{articles}} -maxdepth 1 -mindepth 1 -type f | sort -nr | head -1)"
|
|
|
|
alias l := latest-article
|
|
|
|
[group('dev')]
|
|
build:
|
|
@docker build --tag {{docker_image}}:{{docker_tag}} .
|