You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using workspaces it's common to have a directory hierarchy like this:
/
Cargo.toml
README.md
my-wasm-code/
Cargo.toml
src/
pkg/
...
And the my-wasm-code crate will use the package.readme field in Cargo.toml to tell cargo where to find the README.
[package]
name = "aimc_sim"version = "0.1.0"authors = ["Michael Bryan <michaelfbryan@gmail.com>"]
edition = "2018"description = "WASM frontend for the Adventures in Motion Control simulator"license = "MIT or Apache-2.0"repository = "https://github.com/Michael-F-Bryan/adventures-in-motion-control"publish = falsereadme = "../README.md"
At the moment wasm-pack doesn't follow this convention, and will just look in the crate's directory for a README file.
🤔 Expected Behavior
wasm-pack should check the Cargo.toml for a readme field, before falling back to crate_dir.join("README.md") when adding a README.md to the pkg/ directory.
I'm guessing this is the relevant area of code? The naive solution (parse Cargo.toml and try to use the filename from package.readme, if provided) would probably be good enough, but I'm not sure whether this sort of work should be handled elsewhere in the application.
👟 Steps to reproduce
$ mkdir /tmp/repro &&cd /tmp/repro
$ cat Cargo.toml[workspace]members = ["my-wasm-code"]
$ cat README.md
# Minimal Repro
$ cargo generate --git https://github.com/rustwasm/wasm-pack-template --name my-wasm-code Creating project called `my-wasm-code`... Done! New project created /tmp/repro/my-wasm-code
$ ls my-wasm-codeCargo.toml src tests
$ head my-wasm-code/Cargo.toml [package]name = "my-wasm-code"version = "0.1.0"authors = ["Michael Bryan <michaelfbryan@gmail.com>"]edition = "2018"readme = "../README.md"
$ wasm-pack build my-wasm-code [INFO]: Checking for the Wasm target...[INFO]: Compiling to Wasm......[INFO]: :-) Done in 2m 41s[INFO]: :-) Your wasm pkg is ready to publish at my-wasm-code/pkg.
$ ls pkg my_wasm_code.d.ts my_wasm_code.js my_wasm_code_bg.d.ts my_wasm_code_bg.wasm package.json
The text was updated successfully, but these errors were encountered:
Michael-F-Bryan
changed the title
A README from a parent directory isn't added to the pkg/
A README from a parent directory isn't added to the pkg
Sep 26, 2019
🐛 Bug description
When using workspaces it's common to have a directory hierarchy like this:
And the
my-wasm-code
crate will use thepackage.readme
field inCargo.toml
to tellcargo
where to find the README.At the moment
wasm-pack
doesn't follow this convention, and will just look in the crate's directory for aREADME
file.🤔 Expected Behavior
wasm-pack
should check theCargo.toml
for areadme
field, before falling back tocrate_dir.join("README.md")
when adding aREADME.md
to thepkg/
directory.I'm guessing this is the relevant area of code? The naive solution (parse
Cargo.toml
and try to use the filename frompackage.readme
, if provided) would probably be good enough, but I'm not sure whether this sort of work should be handled elsewhere in the application.👟 Steps to reproduce
🌍 Your environment
The text was updated successfully, but these errors were encountered: