Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracking issue: examples #299

Open
4 of 7 tasks
mockersf opened this issue Mar 15, 2022 · 7 comments
Open
4 of 7 tasks

tracking issue: examples #299

mockersf opened this issue Mar 15, 2022 · 7 comments

Comments

@mockersf
Copy link
Member

mockersf commented Mar 15, 2022

#225 introduced a new page for wasm examples at https://bevyengine.org/examples/

This page is currently lacking in style and not linked from the website. I think it should be the main page for example discovery instead of the git repo:

  • it is easier to ensure that the examples are at the latest tag instead of main as the website is only about latest
  • it is easier to evolve organisation with tags and categories instead of just a list of folders
  • it is easier to control presentation as GitHub will always show files first, then the optional readme.md
  • it is easier to have a nice presentation instead of just one large and basic readme.md

So... in case it's not clear, I think it would be easier.

What would be needed to get it in top shape:

This should be tied with #159 (bevy assets page) to evolve a consistent style.

The first two points need to be done before a release, the two next with that release

@cart
Copy link
Member

cart commented Mar 15, 2022

I love these ideas. Is there a good way to specify custom per-example metadata in Cargo.toml? I think id prefer that if its possible. If not, a single centralized file for this config has my preference. I dont want to throw a bunch of metadata in custom per file header format, or have a bunch of per-example config files. That could be weird/confusing for users.

@mockersf
Copy link
Member Author

Is there a good way to specify custom per-example metadata in Cargo.toml?

It's possible to add any field we want in the Cargo.toml file:

[[example]]
name = "3d_scene"
path = "examples/3d/3d_scene.rs"
display_name = "3D Scene"
description = "Simple 3D scene with basic shapes and lighting"

but this issues warnings:

warning: /bevy/Cargo.toml: unused manifest key: example.13.description
warning: /bevy/Cargo.toml: unused manifest key: example.13.display_name

@mockersf
Copy link
Member Author

I posted https://internals.rust-lang.org/t/cargo-manifest-and-unused-manifest-key-allow-other-tools-to-extend-the-manifest/16333 as that would be the best solution if only there was a way to remove that warning

@cart
Copy link
Member

cart commented Mar 16, 2022

Maybe we could use this: https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table?

[[example]]
name = "3d_scene"
path = "examples/3d/3d_scene.rs"

[package.metadata.example.3d_scene]
display_name = "3D Scene"
description = "Simple 3D scene with basic shapes and lighting"

@cart
Copy link
Member

cart commented Mar 16, 2022

Sadly a bit verbose + redundant (example.3d_scene would need to match name = "3d_scene"), but it might work :)

@mockersf
Copy link
Member Author

mockersf commented Mar 18, 2022

I would love for this to work:

[[example]]
name = "3d_scene"
path = "examples/3d/3d_scene.rs"

[example.metadata]
display_name = "3D Scene"
description = "Simple 3D scene with basic shapes and lighting"

Array of Tables: Any reference to an array of tables points to the most recently defined table element of the array. This allows you to define sub-tables, and even sub-arrays of tables, inside the most recent table. That means the metadata field would refer to the example defined just above

I looked a little into cargo code, it wouldn't be hard to add, I'll check if they would accept a PR for that

bors bot pushed a commit to bevyengine/bevy that referenced this issue Jun 25, 2022
# Objective

- Have information about examples only in one place that can be used for the repo and for the website (and remove the need to keep a list of example to build for wasm in the website https://github.com/bevyengine/bevy-website/blob/75acb730406ef9c5928d37daf8bb32e4dbeb8b13/generate-wasm-examples/generate_wasm_examples.sh#L92-L99)

## Solution

- Add metadata about examples in `Cargo.toml`
- Build the `examples/README.md` from a template using those metadata. I used tera as the template engine to use the same tech as the website.
- Make CI fail if an example is missing metadata, or if the readme file needs to be updated (the command to update it is displayed in the failed step in CI)

## Remaining To Do

- After the next release with this merged in, the website will be able to be updated to use those metadata too
- I would like to build the examples in wasm and make them available at http://dev-docs.bevyengine.org/ but that will require more design
- bevyengine/bevy-website#299 for other ToDos

Co-authored-by: Readme <github-actions@github.com>
inodentry pushed a commit to IyesGames/bevy that referenced this issue Aug 8, 2022
# Objective

- Have information about examples only in one place that can be used for the repo and for the website (and remove the need to keep a list of example to build for wasm in the website https://github.com/bevyengine/bevy-website/blob/75acb730406ef9c5928d37daf8bb32e4dbeb8b13/generate-wasm-examples/generate_wasm_examples.sh#L92-L99)

## Solution

- Add metadata about examples in `Cargo.toml`
- Build the `examples/README.md` from a template using those metadata. I used tera as the template engine to use the same tech as the website.
- Make CI fail if an example is missing metadata, or if the readme file needs to be updated (the command to update it is displayed in the failed step in CI)

## Remaining To Do

- After the next release with this merged in, the website will be able to be updated to use those metadata too
- I would like to build the examples in wasm and make them available at http://dev-docs.bevyengine.org/ but that will require more design
- bevyengine/bevy-website#299 for other ToDos

Co-authored-by: Readme <github-actions@github.com>
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
# Objective

- Have information about examples only in one place that can be used for the repo and for the website (and remove the need to keep a list of example to build for wasm in the website https://github.com/bevyengine/bevy-website/blob/75acb730406ef9c5928d37daf8bb32e4dbeb8b13/generate-wasm-examples/generate_wasm_examples.sh#L92-L99)

## Solution

- Add metadata about examples in `Cargo.toml`
- Build the `examples/README.md` from a template using those metadata. I used tera as the template engine to use the same tech as the website.
- Make CI fail if an example is missing metadata, or if the readme file needs to be updated (the command to update it is displayed in the failed step in CI)

## Remaining To Do

- After the next release with this merged in, the website will be able to be updated to use those metadata too
- I would like to build the examples in wasm and make them available at http://dev-docs.bevyengine.org/ but that will require more design
- bevyengine/bevy-website#299 for other ToDos

Co-authored-by: Readme <github-actions@github.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Have information about examples only in one place that can be used for the repo and for the website (and remove the need to keep a list of example to build for wasm in the website https://github.com/bevyengine/bevy-website/blob/75acb730406ef9c5928d37daf8bb32e4dbeb8b13/generate-wasm-examples/generate_wasm_examples.sh#L92-L99)

## Solution

- Add metadata about examples in `Cargo.toml`
- Build the `examples/README.md` from a template using those metadata. I used tera as the template engine to use the same tech as the website.
- Make CI fail if an example is missing metadata, or if the readme file needs to be updated (the command to update it is displayed in the failed step in CI)

## Remaining To Do

- After the next release with this merged in, the website will be able to be updated to use those metadata too
- I would like to build the examples in wasm and make them available at http://dev-docs.bevyengine.org/ but that will require more design
- bevyengine/bevy-website#299 for other ToDos

Co-authored-by: Readme <github-actions@github.com>
@BD103
Copy link
Member

BD103 commented Mar 8, 2024

Here is an updated checklist:

  • add metadata to Cargo.toml about each example [Merged by Bors] - Examples metadata in Cargo.toml bevy#4741
  • add an example page built with the dev docs
    • Given how building all of the WASM examples takes roughly 2.5 hours, I don't think this is viable
  • update the website to display all examples with their metadata, but only build wasm version for the one where it is enabled
  • remove/simplify the readme.md in bevy repo example folder. This file can't scale
    • Perhaps an individual README.md can be created per subdirectory: one for 2d, one for ecs, etc.
  • link more prominently to the website for examples [Merged by Bors] - Make web examples more visible #335
  • (optional) add screenshot of the examples as part of the metadata
  • (optional) add tags to the metadata to help with discovery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants