Skip to content

Commit

Permalink
Refactor to htmx and _hyperscript (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszKielar authored May 23, 2024
1 parent 5ed4381 commit aec2f46
Show file tree
Hide file tree
Showing 59 changed files with 1,390 additions and 4,457 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
7 changes: 7 additions & 0 deletions .cargo/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
edition = "2021"
group_imports = "StdExternalCrate"
imports_granularity = "Module"
imports_layout = "HorizontalVertical"
reorder_impl_items = true
reorder_imports = true
reorder_modules = true
17 changes: 6 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ FROM mcr.microsoft.com/devcontainers/rust:1-bookworm
# Include lld linker to improve build times either by using environment variable
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install clang lld \
&& apt-get autoremove -y && apt-get clean -y
&& apt-get -y install clang lld \
&& apt-get autoremove -y && apt-get clean -y

RUN rustup toolchain install nightly \
&& rustup default nightly \
&& rustup target add wasm32-unknown-unknown \
&& rustup component add rustfmt rust-docs clippy
RUN rustup component add rustfmt rust-docs clippy

RUN cargo install cargo-generate
RUN cargo install cargo-leptos
RUN cargo install leptosfmt
RUN cargo install trunk --no-default-features --features native-tls
RUN cargo install sqlx-cli --no-default-features --features native-tls,sqlite
RUN cargo install cargo-watch

RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
&& apt-get install -y nodejs \
&& npm install -g [email protected]

USER vscode

Expand Down
49 changes: 25 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust-postgres
{
"name": "lokai",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"mtxr.sqltools",
"mtxr.sqltools-driver-sqlite",
"tabbyml.vscode-tabby"
]
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"name": "lokai",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"mtxr.sqltools",
"mtxr.sqltools-driver-sqlite",
"oderwat.indent-rainbow",
"tabbyml.vscode-tabby"
]
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
24 changes: 12 additions & 12 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: '3.8'
version: "3.8"

services:
app:
build:
context: .
dockerfile: Dockerfile
env_file:
# Ensure that the variables in .env match the same variables in devcontainer.json
- ../.env
volumes:
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
app:
build:
context: .
dockerfile: Dockerfile
env_file:
# Ensure that the variables in .env match the same variables in devcontainer.json
- ../.env
volumes:
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
DATABASE_URL=sqlite://db.sqlite3
LEPTOS_TAILWIND_VERSION=v3.4.3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# will have compiled files and executables
/target/
pkg
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
Expand All @@ -16,3 +17,5 @@ db.sqlite3*
localhost.sql
tmp/
.DS_Store
build/
static/
195 changes: 103 additions & 92 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,94 +1,105 @@
{
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[rust]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
},
"[sql]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.formatOnSave": true
},
"[toml]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.formatOnSave": true
},
"[markdown]": {
"editor.formatOnSave": true
},
"editor.detectIndentation": false,
"editor.indentSize": "tabSize",
"editor.quickSuggestions": {
"strings": "on"
},
"editor.renderFinalNewline": "dimmed",
"editor.renderLineHighlight": "all",
"editor.renderWhitespace": "all",
"editor.tabSize": 4,
"files.associations": {
"*.css": "tailwindcss"
},
"prettier.tabWidth": 4,
"prettier.trailingComma": "es5",
"prettier.useTabs": true,
"rust-analyzer.cargo.features": ["hydrate", "ssr"],
"rust-analyzer.procMacro.ignored": {
"leptos_macro": ["server"]
},
"rust-analyzer.rustfmt.overrideCommand": [
"leptosfmt",
"--stdin",
"--rustfmt"
],
"rust-analyzer.showUnlinkedFileNotification": false,
"sqltools.connections": [
{
"database": "db.sqlite3",
"driver": "SQLite",
"name": "localhost",
"previewLimit": 50
}
],
"sqltools.useNodeRuntime": true,
"tabby.api.endpoint": "http://host.docker.internal:8080",
"tabby.inlineCompletion.triggerMode": "automatic",
"tabby.usage.anonymousUsageTracking": true,
"tailwindCSS.experimental.classRegex": ["class: \"(.*)\""],
"tailwindCSS.includeLanguages": {
"rust": "html"
},
"workbench.editor.highlightModifiedTabs": true
"[dockercompose]": {
"editor.formatOnSave": true,
"editor.tabSize": 4
},
"[dockerfile]": {
"editor.formatOnSave": true
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[markdown]": {
"editor.formatOnSave": true
},
"[rust]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
},
"[sql]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.formatOnSave": true
},
"[tailwindcss]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[toml]": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.formatOnSave": true
},
"editor.detectIndentation": false,
"editor.indentSize": "tabSize",
"editor.quickSuggestions": {
"strings": "on"
},
"editor.renderFinalNewline": "dimmed",
"editor.renderLineHighlight": "all",
"editor.renderWhitespace": "all",
"editor.tabSize": 4,
"files.associations": {
"*.css": "tailwindcss"
},
"files.trimTrailingWhitespace": true,
"prettier.tabWidth": 4,
"prettier.trailingComma": "es5",
"prettier.useTabs": false,
"rust-analyzer.showUnlinkedFileNotification": false,
"sqltools.connections": [
{
"database": "db.sqlite3",
"driver": "SQLite",
"name": "localhost",
"previewLimit": 50
}
],
"sqltools.useNodeRuntime": true,
"tabby.api.endpoint": "http://host.docker.internal:8080",
"tabby.inlineCompletion.triggerMode": "automatic",
"tabby.usage.anonymousUsageTracking": true,
"tailwindCSS.experimental.classRegex": ["class: \"(.*)\""],
"tailwindCSS.includeLanguages": {
"rust": "html"
},
"workbench.editor.highlightModifiedTabs": true
}
Loading

0 comments on commit aec2f46

Please sign in to comment.