WIP frontend isn't completely broken now

Still more work left with integrating apalis and need to fully update
it.

These changes are mostly for fixing the frontend I broke by eagerly
updating everything.
This commit is contained in:
2025-02-10 00:51:04 -05:00
parent 7a8f7dc415
commit 6bd661765e
9 changed files with 1051 additions and 609 deletions

1565
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,21 +16,21 @@ ammonia = "4"
ansi-to-html = "0.2"
anyhow = "1"
# apalis v0.6 fixes this issue: https://github.com/geofmureithi/apalis/issues/351
apalis = { version = "0.6.0-rc.7", features = ["retry"] }
apalis-cron = "0.6.0-rc.7"
apalis-redis = "0.6.0-rc.7"
apalis = { version = "0.6.0-rc.8", features = ["retry"] }
apalis-cron = "0.6.0-rc.8"
apalis-redis = "0.6.0-rc.8"
async-trait = "0.1"
axum = { version = "0.7", features = ["form", "multipart", "query"] }
axum-client-ip = "0.6"
axum-extra = { version = "0.9", features = ["typed-header"] }
axum-login = "0.15"
axum-login = "0.16"
base64 = "0.22"
bytes = "1.4"
# TODO: replace chrono with time
chrono = { version = "0.4", features = ["serde"] }
clap = { version = "4.4", features = ["derive", "env"] }
dotenvy = "0.15"
feed-rs = "1.3"
feed-rs = "2.1"
fred = "9"
futures = "0.3"
headers = "0.4"
@@ -41,6 +41,7 @@ lettre = { version = "0.11", features = ["builder"] }
maud = { git = "https://github.com/vidhanio/maud", branch = "patch-1", features = [
"axum",
] }
# upgrading this to > 6 causes infinite reloads with tower-livereload
notify = "6"
once_cell = "1.18"
opml = "1.1"
@@ -59,21 +60,21 @@ sqlx = { version = "0.7", features = [
"uuid",
"ipnetwork",
] }
thiserror = "1"
thiserror = "2"
time = "0.3"
tokio = { version = "1", features = ["full"] }
tokio-stream = { version = "0.1", features = ["sync"] }
tower = "0.4"
tower = { version = "0.5", features = ["retry"] }
tower-livereload = "0.9"
tower-http = { version = "0.5", features = ["trace", "fs"] }
tower-sessions = { version = "0.12", features = ["signed"] }
tower-sessions-redis-store = "0.12"
tower-http = { version = "0.6", features = ["trace", "fs"] }
tower-sessions = { version = "0.13", features = ["signed"] }
tower-sessions-redis-store = "0.14"
tracing = { version = "0.1", features = ["valuable", "attributes"] }
tracing-appender = "0.2"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
uuid = { version = "1.4", features = ["serde"] }
url = "2.4"
validator = { version = "0.18", features = ["derive"] }
validator = { version = "0.19", features = ["derive"] }
[profile.dev.package.sqlx-macros]
opt-level = 3

Binary file not shown.

View File

@@ -1,10 +1,5 @@
import htmx from 'htmx.org';
// import assets so they get named with a content hash that busts caches
// import '../css/styles.css';
import './localTimeController';
declare global {
interface Window {
htmx: typeof htmx;
@@ -13,5 +8,16 @@ declare global {
window.htmx = htmx;
// eslint-disable-next-line import/first
import 'htmx.org/dist/ext/sse';
// Wait for htmx to be fully initialized before loading extensions
document.addEventListener(
'htmx:load',
() => {
import('htmx.org/dist/ext/sse');
},
{ once: true }
);
// import assets so they get named with a content hash that busts caches
// import '../css/styles.css';
import './localTimeController';

View File

@@ -2,21 +2,21 @@
"name": "crawlnicle-frontend",
"module": "js/index.ts",
"devDependencies": {
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"bun-types": "^1.1.8",
"eslint": "^9.2.0",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"bun-types": "^1.2.2",
"eslint": "^9.20.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "latest",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.6.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-promise": "^6.6.0",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3"
},
"peerDependencies": {
"typescript": "^5.0.0"

View File

@@ -1,8 +1,8 @@
const plugin = require('tailwindcss/plugin');
import plugin from 'tailwindcss/plugin';
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.rs'],
content: ['../src/**/*.rs'],
theme: {
extend: {},
},

View File

@@ -7,14 +7,22 @@ install-frontend:
clean-frontend:
rm -rf ./static/js/* ./static/css/* ./static/img/*
build-frontend: clean-frontend
bunx tailwindcss -i frontend/css/styles.css -o static/css/styles.css --minify
[working-directory: 'frontend']
build-css:
bunx tailwindcss -i css/styles.css -o ../static/css/styles.css --minify
[working-directory: 'frontend']
build-dev-css:
bunx tailwindcss -i css/styles.css -o ../static/css/styles.css
build-frontend: clean-frontend build-css
bun build frontend/js/index.ts \
--outdir ./static \
--root ./frontend \
--entry-naming [dir]/[name]-[hash].[ext] \
--chunk-naming [dir]/[name]-[hash].[ext] \
--asset-naming [dir]/[name]-[hash].[ext] \
--sourcemap=linked \
--minify
mkdir -p static/img
cp frontend/img/* static/img/
@@ -22,14 +30,14 @@ build-frontend: clean-frontend
touch ./static/css/manifest.txt # create empty manifest to be overwritten by build.rs
touch .frontend-built # trigger build.rs to run
build-dev-frontend: clean-frontend
bunx tailwindcss -i frontend/css/styles.css -o static/css/styles.css
build-dev-frontend: clean-frontend build-dev-css
bun build frontend/js/index.ts \
--outdir ./static \
--root ./frontend \
--entry-naming [dir]/[name]-[hash].[ext] \
--chunk-naming [dir]/[name]-[hash].[ext] \
--asset-naming [dir]/[name]-[hash].[ext]
--asset-naming [dir]/[name]-[hash].[ext] \
--sourcemap=linked
mkdir -p static/img
cp frontend/img/* static/img/
touch ./static/js/manifest.txt # create empty manifest needed so binary compiles

View File

@@ -11,7 +11,7 @@ use uuid::Uuid;
use crate::actors::crawl_scheduler::{CrawlSchedulerHandle, CrawlSchedulerHandleMessage};
use crate::error::Error;
use crate::models::feed::{Feed, CreateFeed};
use crate::models::feed::{CreateFeed, Feed};
use crate::state::Imports;
use crate::uuid::Base62Uuid;

View File

@@ -1,2 +0,0 @@
const config = require('./frontend/tailwind.config.js');
export default config;