Giter Club home page Giter Club logo

Comments (6)

yoshuawuyts avatar yoshuawuyts commented on May 18, 2024 3

I'm thinking ideally we could generate a README. In JS land READMEs are usually some metadata + statement of intent + API documentation.

Most of the metadata can probably be extracted from Cargo.toml. API docs can probably be generated from the generated code. Because it's typescript, we can probably also find the signatures (although this probably requires some patches). Statement of intent might need some human intervention (e.g. allow passing a markdown snippet), but just including the project description should be fine I reckon?

E.g. output would look somewhat like this:


bar-to-baz-wasm

npm badge downloads

Convert bars into bazzi. WebAssembly bindings generated using wasm-pack.

API

baz: String = foo(bar: String)

Convert a bar into a baz.

License

Apache-2.0

from wasm-pack.

ootoovak avatar ootoovak commented on May 18, 2024 1

I personally like README files that help guide new people into explaining what the intent of the library is how though some simple to slightly more complex examples. Then either a list of or links off to some API docs. Not to mention any other human / ecosystem related information.

In that people centric sense I think auto file generation could help but I personally would also like the option to have hand written parts (or the whole file) as well.

So, if the pkg folder is considered ephemeral what I was thinking is that developers could either write a README_NPM.md file that gets automatically pulled into pkg and renamed or there is an argument you could pass into the build command where you could specify which file you want to pull in as a NPM README like wasm-pack build --readme=README_WASM.md or something.

Perhaps there is room for all options?

A possible order:

  1. If --readme flag is set use that file and put it in pkg/README.md.
  2. If README_NPM.md file exist use that file and put it in pkg/README.md
  3. If neither exist autogenerate pkg/README.md.

from wasm-pack.

jhernandez-at-wiris avatar jhernandez-at-wiris commented on May 18, 2024 1

Is there any update about this? I like both ideas, from @yoshuawuyts and @ootoovak.

In my case the same crate can be used itself as Cargo dependency and publish it as NPM dependency, but the README.md for Rust crate is not useful for NPM package or I need to write both together.

from wasm-pack.

ashleygwilliams avatar ashleygwilliams commented on May 18, 2024

this is a great suggestion @yoshuawuyts - i really like it! do you think creating a separate crate to handle taking rustdoc generation -> markdown file would be useful? then we could just integrate it in here. seems like a vaguely big enough job that it warrants another crate. thoughts?

from wasm-pack.

ootoovak avatar ootoovak commented on May 18, 2024

For now I might try method 2 manually in my crate and see if I find much duplication between the READMEs. (Rightly or wrongly I am aiming to have my crate usable by both Rust and JS.)

from wasm-pack.

ootoovak avatar ootoovak commented on May 18, 2024

Oh, also I guess there is the question about media referenced in the Readme. 🤔

from wasm-pack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.