Compare commits

..

21 Commits

Author SHA1 Message Date
5be85e7b6b build: get rid of wasm-pack
It get's doing naughty things with network access.
2024-06-23 12:50:24 -04:00
24f045e757 build: fix rust-tls resolver issues 2024-06-23 11:23:57 -04:00
e048767773 build: use rustls 2024-03-10 15:13:39 -04:00
b52fdedb58 maint: having the wasm-pack version in the logs is useful 2024-02-20 17:48:17 -05:00
4230eabcae fix: Unsafe recursive object use 2024-02-20 17:12:16 -05:00
40ff02bb46 Alloy models for browser_state 2024-01-28 16:56:36 -05:00
8de0307e44 Add some models 2024-01-28 15:09:24 -05:00
63fec9f6df Display current plan date at the top 2024-01-18 17:13:17 -05:00
bd058150ed NOTE comment. 2024-01-06 10:25:55 -05:00
579a726dd8 cargo fmt 2024-01-05 18:58:48 -05:00
e393047448 Stop using singular for normalization 2024-01-03 15:26:33 -05:00
c00865e633 Have a packaging unit for measures 2024-01-03 15:14:29 -05:00
d97913e676 ui: more layout tweaks 2023-12-25 13:40:42 -06:00
4aaa2b1a06 ui: normalization and font tweaks 2023-12-04 18:54:09 -05:00
388fbc9ee4 ui: Typography tweaks 2023-12-04 15:05:45 -05:00
550d92179b docs: comments for the event handling in login 2023-12-04 14:48:50 -05:00
3cc52a06a3 ui: Menu font sizes 2023-12-04 14:48:31 -05:00
d282da4b76 maint: upgrade wasm-bindgen version 2023-12-02 15:29:47 -05:00
40f0b5db66 maint: Use gloo_net directly 2023-12-02 15:29:24 -05:00
149dc8961e fix: Issue with request blocking occuring on login 2023-12-02 15:28:08 -05:00
4a5efd52de UI: Cleansheet CSS redesign
Initial skeleton and layout is working.
Still needs a bunch of tweaks.
2023-12-02 09:44:19 -05:00
11 changed files with 26 additions and 83 deletions

View File

@ -1,6 +1,5 @@
[workspace]
members = [ "recipes", "kitchen", "web", "api" ]
resolver = "2"
[patch.crates-io]
# TODO(jwall): When the fix for RcSignal Binding is released we can drop this patch.

View File

@ -14,11 +14,6 @@
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
sqlite_url := sqlite://$(mkfile_dir)/.session_store/store.db
out := dist
project := kitchen
export out
export kitchen
kitchen: wasm kitchen/src/*.rs
cd kitchen; cargo build
@ -32,18 +27,15 @@ static-prep: web/index.html web/favicon.ico web/static/*.css
cp -r web/favicon.ico web/dist/
cp -r web/static web/dist/
wasmrelease: wasm-opt static-prep
wasm-opt: wasmrelease-dist
cd web; sh ../scripts/wasm-opt.sh release
wasmrelease: wasmrelease-dist static-prep
wasmrelease-dist: web/src/*.rs web/src/components/*.rs
cd web; sh ../scripts/wasm-build.sh release
cd web; wasm-pack build --mode no-install --release --target web --no-typescript --out-name kitchen_wasm --out-dir dist/
wasm: wasm-dist static-prep
wasm-dist: web/src/*.rs web/src/components/*.rs
cd web; sh ../scripts/wasm-build.sh debug
cd web; wasm-pack build --mode no-install --target web --no-typescript --out-dir dist/ --features debug_logs
clean:
rm -rf web/dist/*
@ -58,5 +50,5 @@ sqlx-add-%:
sqlx-revert:
cd kitchen; cargo sqlx migrate revert --database-url $(sqlite_url)
sqlx-prepare: kitchen
sqlx-prepare:
cd kitchen; cargo sqlx prepare --database-url $(sqlite_url)

33
flake.lock generated
View File

@ -31,24 +31,6 @@
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"flake": false,
"locked": {
@ -142,21 +124,6 @@
"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",

View File

@ -45,14 +45,6 @@
wasm-bindgen = pkgs.callPackage wasm-bindgenGen { inherit pkgs; };
kitchenWasm = kitchenWasmGen {
inherit pkgs rust-wasm wasm-bindgen version;
lockFile = ./Cargo.lock;
outputHashes = {
# I'm maintaining some patches for these so the lockfile hashes are a little
# incorrect. We override those here.
"wasm-web-component-0.2.0" = "sha256-quuPgzGb2F96blHmD3BAUjsWQYbSyJGZl27PVrwL92k=";
"sycamore-0.8.2" = "sha256-D968+8C5EelGGmot9/LkAlULZOf/Cr+1WYXRCMwb1nQ=";
"sqlx-0.6.2" = "sha256-X/LFvtzRfiOIEZJiVzmFvvULPpjhqvI99pSwH7a//GM=";
};
};
kitchen = (kitchenGen {
inherit pkgs version naersk-lib kitchenWasm rust-wasm;

View File

@ -1,2 +0,0 @@
-- Add down migration script here
ALTER TABLE recipes DROP COLUMN serving_count;

View File

@ -1,2 +0,0 @@
-- Add up migration script here
ALTER TABLE recipes ADD column serving_count number;

View File

@ -3,18 +3,23 @@
features ? "",
rust-wasm,
wasm-bindgen,
lockFile,
outputHashes,
}:
with pkgs;
let
pname = "kitchen-wasm";
src = ./../..;
lockFile = ./../../Cargo.lock;
# NOTE(jwall): Because we use wasm-pack directly below we need
# the cargo dependencies to already be installed.
cargoDeps = (pkgs.rustPlatform.importCargoLock { inherit lockFile outputHashes; });
cargoDeps = (pkgs.rustPlatform.importCargoLock { inherit lockFile; outputHashes = {
# I'm maintaining some patches for these so the lockfile hashes are a little
# incorrect. We override those here.
"wasm-web-component-0.2.0" = "sha256-quuPgzGb2F96blHmD3BAUjsWQYbSyJGZl27PVrwL92k=";
"sycamore-0.8.2" = "sha256-D968+8C5EelGGmot9/LkAlULZOf/Cr+1WYXRCMwb1nQ=";
"sqlx-0.6.2" = "sha256-X/LFvtzRfiOIEZJiVzmFvvULPpjhqvI99pSwH7a//GM=";
};
});
in
# TODO(zaphar): I should actually be leveraging naersklib.buildPackage with a postInstall for the optimization and bindgen
stdenv.mkDerivation {
inherit src pname;
version = version;
@ -29,13 +34,14 @@ stdenv.mkDerivation {
'';
# TODO(jwall): Build this from the root rather than the src.
buildPhase = ''
set -x
echo building with wasm-pack
wasm-pack --version
mkdir -p $out
cd web
cp -r static $out
sh ../scripts/wasm-build.sh release
#cargo build --lib --release --target wasm32-unknown-unknown --target-dir $out ${features} --offline
#wasm-bindgen $out/wasm32-unknown-unknown/release/kitchen_wasm.wasm --out-dir $out --typescript --target web
#sh ../scripts/wasm-opt.sh release
cargo build --lib --release --target wasm32-unknown-unknown --target-dir $out --offline
wasm-bindgen $out/wasm32-unknown-unknown/release/kitchen_wasm.wasm --out-dir $out --typescript --target web
wasm-opt $out/kitchen_wasm_bg.wasm -o $out/kitchen_wasm_bg-opt.wasm -O
rm -f $out/kitchen_wasm_bg.wasm
mv $out/kitchen_wasm_bg-opt.wasm $out/kitchen_wasm_bg.wasm

View File

@ -8,7 +8,9 @@ in
, nodejs
, pkg-config
, openssl
, stdenv
, curl
, runCommand
}:
# This package is special so we don't use the naersk infrastructure to build it.

View File

@ -6,6 +6,10 @@ A web assembly experiment in Meal Planning and Shopping List management.
Ensure you have rust installed with support for the web assembly target. You can see instructions here: [Rust wasm book](https://rustwasm.github.io/docs/book/game-of-life/setup.html).
You will also want to have trunk installed. You can see instructions for that here: [trunk](https://trunkrs.dev/)
Then obtain the source. We do not at this time publish kitchen on [crates.io](https://crates.io/).
```sh
git clone https://github.com/zaphar/kitchen
cd kitchen
@ -19,7 +23,7 @@ make release
# Hacking on kitchen
The run script will run build the app and run it for you.
If you want to hack on kitchen, then you may find it useful to use trunk in dev mode. The run script will run build the app and run trunk with it watching for changes and reloading on demand in your browser.
```sh
./run.sh
@ -33,4 +37,4 @@ If all of the above looks like too much work, and you already use the nix packag
```sh
nix run github:zaphar/kitchen
```
```

View File

@ -1,9 +0,0 @@
set -x
buildtype=$1;
if [ ${buildtype} = "release" ]; then
buildtype_flag="--release"
fi
cargo build --lib ${buildtype_flag} --target wasm32-unknown-unknown --target-dir $out --features debug_logs
wasm-bindgen $out/wasm32-unknown-unknown/${buildtype}/kitchen_wasm.wasm --out-dir $out --typescript --target web

View File

@ -1,6 +0,0 @@
set -x
buildtype=$1;
wasm-opt $out/wasm32-unknown-unkown/${buildtype}/${project}_wasm.wasm --out-dir dist/ -O
rm -f $out/${project}_wasm_bg.wasm
mv $out/${project}_wasm_bg-opt.wasm dist/${project}_wasm_bg.wasm