ft/prepares for shuttle launch

This commit is contained in:
itsscb 2024-05-31 22:35:39 +02:00
parent 08b0b058f2
commit b003033ca6
61 changed files with 196 additions and 24 deletions

View File

@ -3,14 +3,9 @@ name = "digitaler-frieden"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
web-sys = {version="0.3.69", features = ["HtmlInputElement"]} axum = "0.7.4"
yew = { version = "0.21.0", features = ["csr"] } shuttle-axum = "0.45.0"
yew-router = { version = "0.18.0"} shuttle-runtime = "0.45.0"
gloo-console = "0.3.0" tokio = "1.28.2"
yewdux = "0.10.0" tower-http = { version = "0.5.2", features = ["fs"] }
serde = "1.0.198"
serde_json = "1.0.116"
regex = "1.10.4"

6
flake.lock generated
View File

@ -49,11 +49,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1716517042, "lastModified": 1717121863,
"narHash": "sha256-PDPMpBVv+6XdV4FvBWk002IBGofDIWCpo9ewks0kStM=", "narHash": "sha256-/3sxIe7MZqF/jw1RTQCSmgTjwVod43mmrk84m50MJQ4=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "66a43411079d0d1b1b776c0a6ced20a5df896edb", "rev": "2a7b53172ed08f856b8382d7dcfd36a4e0cbd866",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -45,9 +45,9 @@
# Development environment output # Development environment output
devShells = forAllSystems ({ pkgs }: { devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell { default = pkgs.mkShell {
# buildInputs = [ buildInputs = [
# rustup pkgs.cargo-shuttle
# ]; ];
# shellHook = '' # shellHook = ''
# rustup target add wasm32-unknown-unknown # rustup target add wasm32-unknown-unknown
# ''; # '';

16
frontend/Cargo.toml Normal file
View File

@ -0,0 +1,16 @@
[package]
name = "digitaler-frieden-frontend"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
web-sys = {version="0.3.69", features = ["HtmlInputElement"]}
yew = { version = "0.21.0", features = ["csr"] }
yew-router = { version = "0.18.0"}
gloo-console = "0.3.0"
yewdux = "0.10.0"
serde = "1.0.198"
serde_json = "1.0.116"
regex = "1.10.4"

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 315 B

View File

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

View File

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 332 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 348 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -998,7 +998,7 @@ async function __wbg_init(input) {
if (wasm !== undefined) return wasm; if (wasm !== undefined) return wasm;
if (typeof input === 'undefined') { if (typeof input === 'undefined') {
input = new URL('digitaler-frieden-66f4a2f1dfe699d158fb216baa50f09298585f4829c65922dcdfe4324ea2e6d37b258786aad38b71270f40b7bef9e4d0_bg.wasm', import.meta.url); input = new URL('digitaler-frieden-frontend-966184f58f0dec130de874bf4a4e9dbea4d2e01aeb5d4c580e786766d8bf5d5d1405401be9a2426f131ac8176ef49da1_bg.wasm', import.meta.url);
} }
const imports = __wbg_get_imports(); const imports = __wbg_get_imports();

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -7,15 +7,15 @@
<link rel="manifest" href="public/manifest.json"> <link rel="manifest" href="public/manifest.json">
<link rel="preload" href="/digitaler-frieden-66f4a2f1dfe699d158fb216baa50f09298585f4829c65922dcdfe4324ea2e6d37b258786aad38b71270f40b7bef9e4d0_bg.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" integrity="sha384-ZvSi8d_mmdFY-yFrqlDwkphYX0gpxlki3N_kMk6i5tN7JYeGqtOLcScPQLe--eTQ"> <link rel="preload" href="/digitaler-frieden-frontend-966184f58f0dec130de874bf4a4e9dbea4d2e01aeb5d4c580e786766d8bf5d5d1405401be9a2426f131ac8176ef49da1_bg.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" integrity="sha384-lmGE9Y8N7BMN6HS_Sk6dvqTS4BrrXUxYDnhnZti_XV0UBUAb6aJCbxMayBdu9J2h">
<link rel="modulepreload" href="/digitaler-frieden-66f4a2f1dfe699d158fb216baa50f09298585f4829c65922dcdfe4324ea2e6d37b258786aad38b71270f40b7bef9e4d0.js" crossorigin="anonymous" integrity="sha384-wp6sqTySFAnU_e-tFtq2_-hxFMNiD46wtXFfn9-N_Sucj0pEppfQsGk2x10MkLQC"></head> <link rel="modulepreload" href="/digitaler-frieden-frontend-966184f58f0dec130de874bf4a4e9dbea4d2e01aeb5d4c580e786766d8bf5d5d1405401be9a2426f131ac8176ef49da1.js" crossorigin="anonymous" integrity="sha384-mgpWzZIPoUI4-EYN3fy8ZWDj99XZaUu9aa_xTYGF5civVs-o7hT-Bae1y3GLtLeS"></head>
<body class="bg-black text-white"> <body class="bg-black text-white">
<script type="module"> <script type="module">
import init, * as bindings from '/digitaler-frieden-66f4a2f1dfe699d158fb216baa50f09298585f4829c65922dcdfe4324ea2e6d37b258786aad38b71270f40b7bef9e4d0.js'; import init, * as bindings from '/digitaler-frieden-frontend-966184f58f0dec130de874bf4a4e9dbea4d2e01aeb5d4c580e786766d8bf5d5d1405401be9a2426f131ac8176ef49da1.js';
init('/digitaler-frieden-66f4a2f1dfe699d158fb216baa50f09298585f4829c65922dcdfe4324ea2e6d37b258786aad38b71270f40b7bef9e4d0_bg.wasm'); init('/digitaler-frieden-frontend-966184f58f0dec130de874bf4a4e9dbea4d2e01aeb5d4c580e786766d8bf5d5d1405401be9a2426f131ac8176ef49da1_bg.wasm');
window.wasmBindings = bindings; window.wasmBindings = bindings;
</script><script>"use strict"; </script><script>"use strict";

83
frontend/flake.lock generated Normal file
View File

@ -0,0 +1,83 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706487304,
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "90f456026d284c22b3e3497be980b2e47d0b28ac",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": [
"rust-overlay",
"nixpkgs"
],
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1716517042,
"narHash": "sha256-PDPMpBVv+6XdV4FvBWk002IBGofDIWCpo9ewks0kStM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "66a43411079d0d1b1b776c0a6ced20a5df896edb",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

67
frontend/flake.nix Normal file
View File

@ -0,0 +1,67 @@
{
description = "Example Rust development environment for Zero to Nix";
# Flake inputs
inputs = {
# nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix
# cargo2nix.url = "github:cargo2nix/cargo2nix/";
nixpkgs.follows = "rust-overlay/nixpkgs";
};
# Flake outputs
outputs = { self, nixpkgs, rust-overlay}:
let
# Overlays enable you to customize the Nixpkgs attribute set
overlays = [
# Makes a `rust-bin` attribute available in Nixpkgs
(import rust-overlay)
# Provides a `rustToolchain` attribute for Nixpkgs that we can use to
# create a Rust environment
(self: super: {
rustToolchain = super.rust-bin.stable.latest.default;
})
];
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# rustTarget = nixpkgs.pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
# extensions = [ "rust-src" "rustup" "rust-analyzer" "rust-std" ];
# targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ];
# });
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
# Development environment output
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
# buildInputs = [
# rustup
# ];
# shellHook = ''
# rustup target add wasm32-unknown-unknown
# '';
# The Nix packages provided in the environment
packages = (with pkgs; [
# The package provided by our custom overlay. Includes cargo, Clippy, cargo-fmt,
# rustdoc, rustfmt, and other tools.
rust-analyzer
clippy
trunk
tailwindcss
rustToolchain
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
};
});
};
}

5
frontend/src/main.rs Normal file
View File

@ -0,0 +1,5 @@
use digitaler_frieden_frontend::router::Main;
fn main() {
yew::Renderer::<Main>::new().render();
}

View File

@ -1,5 +1,11 @@
use digitaler_frieden::router::Main; use axum::Router;
use tower_http::services::ServeDir;
fn main() { #[shuttle_runtime::main]
yew::Renderer::<Main>::new().render(); async fn main() -> shuttle_axum::ShuttleAxum {
let router = Router::new()
// .route("/", get(hello_world))
.nest_service("/", ServeDir::new("frontend/dist"));
Ok(router.into())
} }