Host examples on Firebase (#1582)

* remove getrandom from game_of_life

I know the wasm-bindgen feature is deprecated but this is more convenient for now
and all the other examples use it this way as well.
We can update all of them in one go when rand 0.8 rolls around

* update todomvc README

* clean up yew-macro makefile

See: https://github.com/yewstack/yew/pull/1541#discussion_r488747622

* Use Firebase Hosting
This commit is contained in:
Simon 2020-09-22 18:04:32 +02:00 committed by GitHub
parent 491ee720cd
commit 41af85e6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 89 deletions

View File

@ -1,5 +1,17 @@
{
"projects": {
"default": "yew-rs"
},
"targets": {
"yew-rs": {
"hosting": {
"website": [
"yew-rs"
],
"examples": [
"yew-rs-examples"
]
}
}
}
}

View File

@ -1,8 +1,7 @@
name: Publish website
on:
push:
branches:
- master
branches: [master]
paths:
- "docs/**/*"
- "website/**/*"
@ -16,13 +15,16 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Install dependencies
run: cd website && yarn install && cd ../
- name: Build site
run: cd website && yarn run build && cd ../
- name: Build
run: |
cd website
yarn install
yarn run build
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
args: deploy --only hosting:website
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

View File

@ -58,9 +58,9 @@ jobs:
)
done
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-8
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: examples.yew.rs
args: deploy --only hosting:examples
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

View File

@ -10,7 +10,6 @@ edition = "2018"
[dependencies]
log = "0.4"
rand = { version = "0.7", features = ["getrandom"] }
getrandom = { version = "0.1", features = ["wasm-bindgen"] }
rand = { version = "0.7", features = ["wasm-bindgen"] }
wasm-logger = "0.2"
yew = { path = "../../yew" }

View File

@ -24,14 +24,15 @@ This example involves many different parts, here are just the Yew specific thing
## Improvements
- Use a special image component which shows a progress bar until the image is loaded.
- Scroll back to the top after switching route
- Run content generation in a dedicated web worker
- Use longer Markov chains to achieve more coherent results
- Make images deterministic (the same seed should produce the same images)
- Show posts by the author on their page
(this is currently impossible because we need to find post seeds which in turn generate the author's seed)
- Scroll back to the top after selecting a new page in the post list
- Show other posts at the end of a post ("continue reading")
- Home (`/`) should include links to the post list and the author introduction
- Detect sub-path from `--public-url` value passed to Trunk. See: thedodd/trunk#51
[`intervalservice`]: https://docs.rs/yew/latest/yew/services/struct.IntervalService.html
[`yew-router`]: https://docs.rs/yew-router/latest/yew_router/

View File

@ -4,3 +4,15 @@ This is an implementation of [TodoMVC](http://todomvc.com/) for Yew.
Unlike other implementations, this stores the full state of the model,
including: all entries, entered text and chosen filter.
## Concepts
- Uses [`StorageService`] to persist the state
- [`Refs`] are used to manipulate DOM elements after they're rendered (to automatically focus input fields for instance)
## Improvements
- Use `yew-router` for the filters
[`storageservice`]: https://docs.rs/yew/latest/yew/services/struct.StorageService.html
[`refs`]: https://yew.rs/docs/en/concepts/components/refs/

View File

@ -1,46 +1,65 @@
{
"hosting": {
"site": "yew-rs",
"public": "website/build/yew",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [ {
"source": "/",
"destination": "/docs/en/intro/",
"type": 301
}, {
"source": "/docs",
"destination": "/docs/en/intro/",
"type": 301
}, {
"regex": "/(docs/)?(?P<lang>en|ja|zh-TW|zh-CN)",
"destination": "/docs/:lang/intro/",
"type": 301
}, {
"source": "/docs/v/zh_cn",
"destination": "/docs/zh-CN/intro/",
"type": 301
}, {
"source": "/docs/v/zh_tw",
"destination": "/docs/zh-TW/intro/",
"type": 301
}, {
"regex": "/docs/v/zh_cn/(.*)",
"destination": "/docs/zh-CN/:1",
"type": 301
}, {
"regex": "/docs/v/zh_tw/(.*)",
"destination": "/docs/zh-TW/:1",
"type": 301
} ],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
"hosting": [
{
"target": "website",
"public": "website/build/yew",
"redirects": [
{
"source": "/",
"destination": "/docs/en/intro/",
"type": 301
},
{
"source": "/docs",
"destination": "/docs/en/intro/",
"type": 301
},
{
"regex": "/(docs/)?(?P<lang>en|ja|zh-TW|zh-CN)",
"destination": "/docs/:lang/intro/",
"type": 301
},
{
"source": "/docs/v/zh_cn",
"destination": "/docs/zh-CN/intro/",
"type": 301
},
{
"source": "/docs/v/zh_tw",
"destination": "/docs/zh-TW/intro/",
"type": 301
},
{
"regex": "/docs/v/zh_cn/(.*)",
"destination": "/docs/zh-CN/:1",
"type": 301
},
{
"regex": "/docs/v/zh_tw/(.*)",
"destination": "/docs/zh-TW/:1",
"type": 301
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "examples",
"public": "dist",
"rewrites": [
{
"source": "/router/**",
"destination": "/router/index.html"
},
{
"source": "/todomvc/**",
"destination": "/todomvc/index.html"
}
]
}
]
}

View File

@ -1,34 +1,9 @@
[env]
MSRV = "1.45.2"
[tasks.install-msrv-toolchain]
script_runner = "@duckscript"
script = [
"""
output = exec --fail-on-error rustup toolchain list
stdout = set ${output.stdout}
already_installed = contains ${stdout} ${MSRV}
if not ${already_installed}
echo "Installing toolchain for ${MSRV} (Yew MSRV) to run macro compilation tests"
exec --fail-on-error rustup toolchain install --profile minimal ${MSRV}
end
"""
]
[tasks.test]
clear = true
dependencies = ["install-msrv-toolchain"]
script = [
"""
cargo +${MSRV} test
"""
]
toolchain = "1.45.2"
command = "cargo"
args = ["test"]
[tasks.test-overwrite]
clear = true
dependencies = ["install-msrv-toolchain"]
script = [
"""
TRYBUILD=overwrite cargo +${MSRV} test
"""
]
extend = "test"
env = { TRYBUILD = "overwrite" }