diff --git a/Cargo.toml b/Cargo.toml index e44ff5e..8b2fd67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 1524216..1a588d8 100755 Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ diff --git a/frontend/js/index.ts b/frontend/js/index.ts index 9bf2960..ec47c46 100644 --- a/frontend/js/index.ts +++ b/frontend/js/index.ts @@ -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'; diff --git a/frontend/package.json b/frontend/package.json index f383784..25acf33 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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" diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index c5c44a6..4b1fe61 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -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: {}, }, diff --git a/justfile b/justfile index 37cc30e..c54b42e 100755 --- a/justfile +++ b/justfile @@ -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 diff --git a/src/actors/importer.rs b/src/actors/importer.rs index 15dd01f..734e79a 100644 --- a/src/actors/importer.rs +++ b/src/actors/importer.rs @@ -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; diff --git a/src/bin/web.rs b/src/bin/web.rs index 489cafa..4989934 100644 --- a/src/bin/web.rs +++ b/src/bin/web.rs @@ -19,7 +19,6 @@ use dotenvy::dotenv; use fred::prelude::*; use lettre::transport::smtp::authentication::Credentials; use lettre::SmtpTransport; -use notify::Watcher; use reqwest::Client; use sqlx::postgres::PgPoolOptions; use time::Duration; @@ -27,7 +26,6 @@ use tokio::sync::watch::channel; use tokio::sync::Mutex; use tower::ServiceBuilder; use tower_http::{services::ServeDir, trace::TraceLayer}; -use tower_livereload::LiveReloadLayer; use tower_sessions::cookie::Key; use tower_sessions_redis_store::{ fred::{ @@ -193,6 +191,8 @@ async fn main() -> Result<()> { .layer(ip_source_extension); if cfg!(debug_assertions) { + use notify::Watcher; + use tower_livereload::LiveReloadLayer; debug!("starting livereload"); let livereload = LiveReloadLayer::new().request_predicate(not_htmx_predicate); let reloader = livereload.reloader(); diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index d22a7e1..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const config = require('./frontend/tailwind.config.js'); -export default config;