convert_to_actix #2

Merged
Yehowshua merged 20 commits from convert_to_actix into main 2025-01-06 06:25:19 +00:00
4 changed files with 13 additions and 18 deletions
Showing only changes of commit db00669800 - Show all commits

View file

@ -27,11 +27,7 @@ $(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
cp $< $@ cp $< $@
$(FRONTEND_DIR)/elm.min.js: $(FRONTEND_DIR)/elm.min.js:
ifeq ($(DEBUG),1) make -C $(FRONTEND_DIR)
make -C $(FRONTEND_DIR) DEBUG=1
else ifeq ($(RELEASE),1)
make -C $(FRONTEND_DIR) RELEASE=1
endif
.PHONY: frontend backend .PHONY: frontend backend
@ -47,10 +43,10 @@ serve: frontend backend
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
else ifeq ($(RELEASE),1) else ifeq ($(RELEASE),1)
$(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml $(CARGO_RUN) --release --manifest-path=$(BACKEND_DIR)/Cargo.toml
endif endif
clean: clean:
rm -rf $(PUBLIC_DIR)/* rm -rf $(PUBLIC_DIR)/*
rm -rf $(BACKEND_DIR)/target rm -rf $(BACKEND_DIR)/target
make -C $(FRONTEND_DIR) clean

View file

@ -2,16 +2,12 @@
Example demonstrating how one might architect a single page application Example demonstrating how one might architect a single page application
Elm app. Elm app.
# Dependencies MacOS
You will need to have rust and cargo installed on MacOS.
```bash
brew install node elm
npm install -g uglify-js@2.4.11
```
# Building # Building
`make serve` or `make serve_debug` ```bash
nix-shell -p elmPackages.elm cargo uglify-js
make serve RELEASE=1 # can also do DEBUG=1 instead
```
Now open `http://127.0.0.1:8080` in your browser. Now open `http://127.0.0.1:8080` in your browser.

View file

@ -17,3 +17,6 @@ ifeq ($(DEBUG),1)
else ifeq ($(RELEASE),1) else ifeq ($(RELEASE),1)
./build.sh --optimize src/Main.elm ./build.sh --optimize src/Main.elm
endif endif
clean:
rm elm.js elm.min.js

View file

@ -14,8 +14,8 @@ else
exit 1 exit 1
fi fi
uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output=elm.js uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output elm.js
uglifyjs elm.js --mangle --output=elm.js uglifyjs elm.js --mangle --output $min
echo "Compiled size: $(wc -c < $js) bytes ($js)" echo "Compiled size: $(wc -c < $js) bytes ($js)"
echo "Minified size: $(wc -c < $min) bytes ($min)" echo "Minified size: $(wc -c < $min) bytes ($min)"