Skip to content

Commit 4ccd5bf

Browse files
feat!: migrating from Makefile to Just
Apologies about the unrequested change. Opening this as **demo** one of some QoL improvement suggestions for @nellshamrell . It's up to you all do decide :) ## Migrate from Makefile to Justfile This PR converts the existing Makefile to a Justfile for improved developer experience and modern tooling. ### Changes Made **Core Migration:** - Converted all Make targets to Just recipes with equivalent functionality - Updated syntax from Make to Just format (removed `#!/bin/sh`, updated variable references) - Replaced `$(shell pwd)` with `{{justfile_directory()}}` for path resolution - **All original functionalities preserved** - no behavioral changes to existing workflows **Enhanced User Experience:** - Added `help` recipe that displays all available commands with descriptions - Improved recipe descriptions for better clarity in help output - Added project title and essential user information **Container Runtime:** - Renamed `build` → `docker-build` for explicit Docker usage - Fixed directory creation before container execution to prevent volume mount errors **Documentation Updates:** - Updated README.md to reference [Just](https://just.systems/) instead of Make - Changed all command examples from `make` to `just` ### Testing - **Verified `just website` works end-to-end**: Successfully generated 625 articles and hosted local server on port 8000 - **Verified `just email` works end-to-end**: Successfully generated email template `622-2025-10-22-email.html` - **Verified individual email commands**: Both `just generate-email` and `just optimize-email` work correctly as standalone operations - **Verified clean operations**: Both `just clean-website` and `just clean-email` work correctly - All container operations function correctly with the new justfile syntax ### Usage ```bash # Show all available commands just help # Main workflows (same as before) just website # Generate and host website locally just email # Generate and optimize email template just copy-website-contents # Sync to github.io repo # Container build just docker-build # Build Docker image ``` ### Benefits - **Better UX**: Built-in help system with clear command descriptions - **Modern tooling**: Just provides better syntax and features than Make - **Improved reliability**: Fixed volume mounting issues - **Full compatibility**: All existing workflows remain unchanged All existing workflows remain unchanged - users can simply replace `make` with `just` in their commands. Signed-off-by: andreacfromtheapp <[email protected]>
1 parent 165f175 commit 4ccd5bf

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Use the included `new_contribs.sh` script:
177177
## Building
178178

179179
To ensure consistency across development setups, we use a [Docker](https://www.docker.com) container-based
180-
workflow for building the website and email newsletter. Similarly, we use a `makefile` to ensure you have Docker installed on your system if
180+
workflow for building the website and email newsletter. Similarly, we use [Just](https://just.systems/) to ensure you have Docker installed on your system if
181181
you intend to build the website or email newsletter.
182182

183183
### Building the website
@@ -196,7 +196,7 @@ cd publishing
196196
- Run the Docker build and website local-host command:
197197

198198
```sh
199-
make website
199+
just website
200200
```
201201

202202
- View the website locally at default
@@ -226,7 +226,7 @@ cd publishing
226226
- Run the Docker build and website local-host command:
227227

228228
```sh
229-
make email
229+
just email
230230
```
231231

232232
- View the email newsletter formatting of specific posts at
Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#!/bin/sh
2-
1+
# This Week in Rust - Publishing Tools
32
# TODO: Make sure running from latest "main" branch commit
43

4+
# Show available recipes
5+
help:
6+
@just --list
7+
58
# Typical flows:
69
#
7-
# 1. `make website`
10+
# 1. `just website`
811
# The first workflow will generate the desired website, landing
9-
# the end contents in the local "output-website/" directory. This is the
12+
# the end contents in the local "output-website/" directory. This is the
1013
# equivalent of running `pelican --delete-output-directory content`
1114
# from a properly instantantiated environment.
1215
#
@@ -16,62 +19,76 @@
1619
#
1720
# Output: `output-website/`
1821
#
19-
# 2. `make copy-website-contents`
22+
# 2. `just copy-website-contents`
2023
# This workflow will sync the `output-website/` directory from above, and sync
2124
# it with the directory passed to it. Used for syncing state with
2225
# this-week-in-rust.github.io repo.
2326
#
24-
# 3. `make email`
27+
# 3. `just email`
2528
# This workflow will generate the desired email template, landing
26-
# the end contents in the local "email/" directory. This is the
29+
# the end contents in the local "email/" directory. This is the
2730
# equivalent of running `USE_EMAIL_THEME=1 pelican --delete-output-directory content`
2831
# from a properly instantantiated environment, and running
2932
# `juice --web-resources-images false /juice/in.html /juice/out.html` on the latest content post.
30-
#
33+
#
3134
# $ build clean generate-email optimize-email
3235
#
3336
# Output: `email/<NUMBER>-<YEAR>-<MONTH>-<DAY>-email.html`
3437
#
3538

39+
# Generate and host website locally
3640
website: generate-website host-website
41+
42+
# Copy website contents to this-week-in-rust.github.io repo
3743
copy-website-contents:
38-
@./copy_website_content_to_repo.sh
44+
./copy_website_content_to_repo.sh
45+
46+
# Generate and optimize email template
3947
email: generate-email optimize-email
4048

41-
build:
49+
# Build Docker image
50+
docker-build:
4251
cd .. && docker build -t twir -f publishing/Dockerfile . && cd -
4352

53+
# Clean website output directories
4454
clean-website:
45-
@rm -rf output/ && rm -rf output-website/ && rm -rf juice/
55+
rm -rf output/ output-website/ juice/
56+
57+
# Clean email output directories
4658
clean-email:
47-
@rm -rf output/ && rm -rf output-email-format/ && rm -rf email/ && rm -rf juice/
59+
rm -rf output/ output-email-format/ email/ juice/
4860

49-
generate-website: build clean-website
61+
# Generate website content
62+
generate-website: docker-build clean-website
5063
@echo "Generating website..."
51-
@docker run -it \
52-
-v $(shell pwd)/output-website:/usr/twir/output \
53-
twir:latest
64+
docker run -it \
65+
-v {{justfile_directory()}}/output-website:/usr/twir/output \
66+
twir:latest
5467
@echo "Finished generating website."
5568

69+
# Host website locally on port 8000
5670
host-website:
5771
@echo "Hosting website..."
58-
@docker run -it \
72+
docker run -it \
5973
-p 8000:8000 \
60-
-v $(shell pwd)/output-website:/usr/twir/output:ro \
74+
-v {{justfile_directory()}}/output-website:/usr/twir/output:ro \
6175
-it \
6276
twir:latest \
6377
bash run_server.sh
6478
@echo "Finished hosting website."
6579
@echo ""
66-
@echo "To sync contents with your local 'this-week-in-rust.github.io' repo, run \033[1;33m'make copy-website-contents'\033[0m"
80+
@echo "To sync contents with your local 'this-week-in-rust.github.io' repo, run 'just copy-website-contents'"
6781

68-
generate-email: build clean-email
82+
# Generate email content
83+
generate-email: docker-build clean-email
6984
@echo "Generating email..."
70-
@docker run -it \
85+
mkdir -p output-email-format
86+
docker run -it \
7187
-e USE_EMAIL_THEME=1 \
72-
-v $(shell pwd)/output-email-format:/usr/twir/output \
88+
-v {{justfile_directory()}}/output-email-format:/usr/twir/output \
7389
twir:latest
7490

91+
# Optimize email HTML for delivery
7592
optimize-email:
7693
@echo "Generating optimized email..."
77-
@OUTPUT_PREFIX=output-email-format ./create_optimized_email.sh
94+
OUTPUT_PREFIX=output-email-format ./create_optimized_email.sh

0 commit comments

Comments
 (0)