Repository navigation
Conversation
create_pkg_dir unconditionally deleted out_dir/package.json so a stale wasm-pack manifest could not break the dependency merge in write_package_json. With --no-pack that merge never runs, so the deletion only destroyed a user-provided file. Skip the cleanup when no_pack is set. Fixes wasm-bindgen#1521
Author
|
Closing this one so it does not sit in the queue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1521.
create_pkg_dirinsrc/command/utils.rsopens by deletingpackage.jsonfrom the out dir:That is right when wasm-pack is about to write a new one, and wrong under
--no-pack, where itnever will. The user's own file is removed and nothing replaces it.
--no-packreads as "do notgenerate one", not "delete the one I put there", which is what the issue reports.
The flag is threaded through and the removal is skipped when it is set.
create_pkg_diralreadytakes
no_gitignorefor the same reason, sono_packsits beside it rather than introducing a newshape:
Worth flagging since the function is
pub: that is a signature change for anything outside thisrepo calling it. The two callers inside it are updated, and the fourteen call sites in
tests/all/manifest.rstakefalse.Only the removal is gated. The directory is still created and
.gitignorestill written under--no-pack, both unchanged.Test
it_should_not_delete_existing_pkg_json_if_passed_no_packwrites{ "name": "pre-existing" }intopkg/package.json, builds with--no-pack, and asserts the file still reads back byte for byte.It pins the change rather than merely passing: with the guard reverted it fails on the read, and its
sibling
it_should_not_make_a_pkg_json_if_passed_no_packstill passes, so the two cover the twohalves of what
--no-packmeans.cargo check --all-targetsandcargo fmt --checkare clean.