bevyengine / bevy-website

The source files for the official Bevy website
https://bevyengine.org
MIT License
200 stars 352 forks source link

tracking issue: examples #299

Open mockersf opened 2 years ago

mockersf commented 2 years ago

https://github.com/bevyengine/bevy-website/pull/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:

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 https://github.com/bevyengine/bevy-website/issues/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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

mockersf commented 2 years ago

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

BD103 commented 8 months ago

Here is an updated checklist: