Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Fix preview subcommand when package has dashes on its name #38

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

jaysonsantos
Copy link
Contributor

Hey there, when trying to run wrangler preview on version 0.1.0 installed with cargo
1.35.0-nightly (0e35bd8af 2019-03-13) it will break with the following
error:

wrangler preview
🌀 Compiling your project to WebAssembly...
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
warning: unused manifest key: package.author
    Finished release [optimized] target(s) in 0.10s
[INFO]: ⬇️  Installing wasm-bindgen...
[INFO]: Optional fields missing from Cargo.toml: 'description', 'repository', and 'license'. These are not necessary, but recommended
[INFO]: ✨   Done in 0.25s
[INFO]: 📦   Your wasm pkg is ready to publish at ./pkg.
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

because the package name generated by wrangler generate is called wasm-worker and on pkg folder only wasm_worker.js can be found.

To better show the user what failed I also put a context to show what happened.
The fix probably is not ideal, let me know if I can make it better.

Copy link
Contributor

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @jaysonsantos ! this is great- and fixes #36 ! if you have a second i believe this is failing on cargo fmt- you can run and commit --amend, or i can take it over for you if you'd like. thanks so much for this contribution. i'm happy to cut a point release to get this fix in :)

@jaysonsantos
Copy link
Contributor Author

Hi, my bad, I just did an amend to the last commit.

@ashleygwilliams
Copy link
Contributor

no worries @jaysonsantos ! i hadn't documented that we were enforcing cargo fmt on CI~ i'll make sure to do that. thank you so much for contributing!!

@ashleygwilliams ashleygwilliams merged commit 8ce7d92 into cloudflare:master Mar 29, 2019
@jaysonsantos
Copy link
Contributor Author

What do you think about having something like pre-commit?

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

Successfully merging this pull request may close these issues.

2 participants