Skip to content

Commit

Permalink
remove npm and use picocss
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Nov 21, 2024
1 parent 17255de commit 1519d70
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 786 deletions.
207 changes: 179 additions & 28 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ license = "MIT"
homepage = "https://github.com/untitaker/mastodon-list-bot"
repository = "https://github.com/untitaker/mastodon-list-bot"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
hotreload = ["maud/hotreload"]

[dependencies]
anyhow = { version = "1.0.75", features = ["backtrace"] }
Expand All @@ -24,9 +25,11 @@ clap = { version = "4.4.2", features = ["derive"] }
axum = { version = "0.7.7", features = ["macros"] }
thiserror = "1.0.49"
serde_json = "1.0.132"
maud = "0.26.0"
# https://github.com/lambda-fairy/maud/issues/392
maud = { version = "0.26.0", features = ["axum"], git = "https://github.com/untitaker/maud", branch = "hotreload-prototype-v2" }
sentry = { version = "0.34.0", features = ["tracing", "reqwest", "rustls"], default-features = false }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tower-sessions = "0.13.0"
time = "0.3.36"
memory-serve = "0.6.0"
12 changes: 2 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
FROM node:21-alpine3.20 AS frontend-builder

WORKDIR /app
COPY package-lock.json package.json buildscript.js ./
COPY src ./src/
RUN npm ci
RUN npm run build

FROM rust:1.82-alpine3.20 AS builder

RUN mkdir -p ~/.cargo && \
Expand All @@ -31,8 +23,8 @@ RUN cargo build --release && rm -rf src/
# This should only compile the app itself as the
# dependencies were already built above.
COPY . ./
COPY --from=frontend-builder /app/build/ /app/build/
COPY --from=frontend-builder /app/node_modules/ /app/node_modules/
RUN apk add --no-cache make
RUN make static
RUN rm ./target/release/deps/mastodon_list_bot* && cargo build --release
RUN strip target/release/mastodon-list-bot

Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dev: static
find src/ static/ | entr -sr 'cargo sqlx prepare --database-url sqlite:accounts.db && cargo run --features hotreload serve --database accounts.db'

static: static/htmx.js static/pico.css static/pico.colors.css

.PHONY: dev static

static/htmx.js:
curl -Lf https://unpkg.com/[email protected] -o $@

static/pico.css:
curl -Lf https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.violet.min.css -o $@

static/pico.colors.css:
curl -Lf https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.colors.min.css -o $@
Loading

0 comments on commit 1519d70

Please sign in to comment.