-
Notifications
You must be signed in to change notification settings - Fork 444
feat(manifest): add main entry #95
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
Conversation
916219c
to
fa9c364
Compare
819cc7c
to
267d9f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. I had a question but I think that's for another pr or issue. Namely how do we keep wasm -bindgen up to date. If there's nothing else you need to change let's get this pr merged! :D
@@ -13,11 +14,15 @@ pub fn cargo_install_wasm_bindgen() -> Result<(), Error> { | |||
let pb = PBAR.message(&step); | |||
let output = Command::new("cargo") | |||
.arg("install") | |||
.arg("wasm-bindgen") | |||
.arg("wasm-bindgen-cli") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah that was the error you mentioned before nice catch!
.output()?; | ||
pb.finish(); | ||
if !output.status.success() { | ||
let s = String::from_utf8_lossy(&output.stderr); | ||
if s.contains("already exists") { | ||
PBAR.one_off_message("wasm-bindgen already installed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if there's a newer version that needs to be installed? I think we can add that in a separate PR though. This is just to patch broken behavior for now
@@ -46,6 +51,9 @@ pub fn wasm_bindgen_build(path: &str, name: &str) -> Result<(), Error> { | |||
PBAR.error("wasm-bindgen failed to execute properly"); | |||
bail!(format!("Details:\n{}", s)); | |||
} else { | |||
let js_file = format!("{}/pkg/{}.js", path, binary_name); | |||
let index_file = format!("{}/pkg/index.js", path); | |||
fs::rename(&js_file, &index_file)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay I see. We didn't have an index.js file so npm complained. This part looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm didn't complain but this is leveraging npm better
fixes #94
this PR does a few things:
wasm_bindgen
run that renames the generated js file toindex.js
main
entry to thepackage.json
that points toindex.js
main
entrypackage.json
contents in some tests