Write a deployment packaging script
The packaging script and the configuration files around it are based on the ones from the `Vectornaut/dyna3:demo-summer-2025` branch.
This commit is contained in:
parent
a4565281d5
commit
c0294123d8
4 changed files with 37 additions and 0 deletions
14
README.md
14
README.md
|
@ -65,3 +65,17 @@ The latest prototype is in the folder `app-proto`. It includes both a user inter
|
|||
|
||||
1. Go into the `app-proto` folder
|
||||
2. Call `cargo test`
|
||||
|
||||
### Deploy the prototype
|
||||
|
||||
1. From the `app-proto` folder, call `trunk build --release`.
|
||||
- Building in [release mode](https://doc.rust-lang.org/cargo/reference/profiles.html#release) produces an executable which is smaller and often much faster, but harder to debug and more time-consuming to build.
|
||||
2. Use `bash` to run the packaging script `tools/package-for-deployment.bash`.
|
||||
- The script is location-independent, so you can do this from anywhere in the dyna3 repository.
|
||||
- The call from the top level of the repository is:
|
||||
```bash
|
||||
bash tools/package-for-deployment.bash
|
||||
```
|
||||
- This will overwrite or replace the files in `deploy/dyna3`.
|
||||
3. Put the contents of `deploy/dyna3` in the folder on your server that the prototype will be served from.
|
||||
- To simplify uploading, you might want to combine these files into an archive called `deploy/dyna3.zip`. Git has been set to ignore this path.
|
2
app-proto/Trunk.toml
Normal file
2
app-proto/Trunk.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
public_url = "./"
|
5
deploy/.gitignore
vendored
Normal file
5
deploy/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/dyna3.zip
|
||||
/dyna3/index.html
|
||||
/dyna3/dyna3-*.js
|
||||
/dyna3/dyna3-*.wasm
|
||||
/dyna3/main-*.css
|
16
tools/package-for-deployment.bash
Normal file
16
tools/package-for-deployment.bash
Normal file
|
@ -0,0 +1,16 @@
|
|||
# set paths. this technique for getting the script location comes from
|
||||
# `mklement0` on Stack Overflow
|
||||
#
|
||||
# https://stackoverflow.com/a/24114056
|
||||
#
|
||||
tools=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
|
||||
src="$tools/../app-proto/dist"
|
||||
dest="$tools/../deploy/dyna3"
|
||||
|
||||
# remove the old hash-named files
|
||||
[ -e "$dest"/dyna3-*.js ] && rm "$dest"/dyna3-*.js
|
||||
[ -e "$dest"/dyna3-*.wasm ] && rm "$dest"/dyna3-*.wasm
|
||||
[ -e "$dest"/main-*.css ] && rm "$dest"/main-*.css
|
||||
|
||||
# copy the distribution
|
||||
cp -r "$src/." "$dest"
|
Loading…
Add table
Add a link
Reference in a new issue