mirror of
https://github.com/yewprint/yewprint
synced 2025-02-16 12:08:25 +00:00
fix: support for macos OOTB
This commit is contained in:
parent
3a88ea3996
commit
4ef1cd5927
3 changed files with 29 additions and 6 deletions
15
README.md
15
README.md
|
@ -13,11 +13,19 @@ a star to let me know you are interested in this project.
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
This section will walk you through setting up the environment required to modify
|
||||||
|
the source of `yewprint`.
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
* wasm-pack
|
- [Rust](https://rustup.rs/)
|
||||||
* cargo-watch
|
- [wasm-pack](https://github.com/rustwasm/wasm-pack)
|
||||||
* Rust nightly
|
- [simple-http-server](https://github.com/TheWaWaR/simple-http-server)
|
||||||
|
- [cargo-watch](https://github.com/passcod/cargo-watch)
|
||||||
|
|
||||||
|
> You may encounter issues when running this command on MacOS. Refer to this issue for more details [cargo-watch/issues/129](https://github.com/passcod/cargo-watch/issues/129)
|
||||||
|
|
||||||
### Use as a library
|
### Use as a library
|
||||||
|
|
||||||
|
@ -28,7 +36,6 @@ yewprint = { git = "https://github.com/cecton/yewprint.git", branch = "main" }
|
||||||
### Development server
|
### Development server
|
||||||
|
|
||||||
```
|
```
|
||||||
rustup override set nightly
|
|
||||||
./dev.sh
|
./dev.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
12
build.sh
12
build.sh
|
@ -11,10 +11,20 @@ if ! [ -f core.tgz ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p static
|
mkdir -p static
|
||||||
|
|
||||||
rm -fR static/.gitignore static/*
|
rm -fR static/.gitignore static/*
|
||||||
tar xvzf core.tgz -C static --wildcards \*.css --transform='s/.*\///'
|
|
||||||
|
# decompress the tar file but extract the `.css` files only
|
||||||
|
# find every file in the nested directories and move it behind `./static`
|
||||||
|
# finally remove every directory behind `./static`
|
||||||
|
bsdtar xvzf core.tgz -C static \*.css &&
|
||||||
|
find ./static -mindepth 2 -type f -print -exec mv {} ./static \; &&
|
||||||
|
find ./static -mindepth 1 -type d -print -exec rm -rf {} \;
|
||||||
|
|
||||||
wasm-pack build --no-typescript --target web --out-name wasm --out-dir ./static "${options[@]}" "$@"
|
wasm-pack build --no-typescript --target web --out-name wasm --out-dir ./static "${options[@]}" "$@"
|
||||||
|
|
||||||
rc=$?
|
rc=$?
|
||||||
|
|
||||||
rm -fR static/{.gitignore,package.json}
|
rm -fR static/{.gitignore,package.json}
|
||||||
|
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|
8
dev.sh
8
dev.sh
|
@ -1,3 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
exec cargo watch -s './build.sh --dev -- --features dev && simple-http-server -i --nocache --cors' -w src
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# if current OS is `darwin` then avoid running `cargo watch` by default
|
||||||
|
# refer to: https://github.com/passcod/cargo-watch/issues/129
|
||||||
|
./build.sh --dev -- --features dev && simple-http-server -i --nocache --cors
|
||||||
|
else
|
||||||
|
exec cargo watch -s './build.sh --dev -- --features dev && simple-http-server -i --nocache --cors' -w src
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue