File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,11 @@ struct CrateInformation {
144144 max_version : String ,
145145}
146146
147+ #[ derive( Deserialize , Debug ) ]
148+ struct WasmBindgenPackageJson {
149+ dependencies : Option < HashMap < String , String > > ,
150+ }
151+
147152impl Crate {
148153 /// Returns latest wasm-pack version
149154 pub fn return_wasm_pack_latest_version ( ) -> Result < Option < String > > {
@@ -629,9 +634,8 @@ impl CrateData {
629634 // we merge the NPM dependencies already specified in it.
630635 let existing_deps = if pkg_file_path. exists ( ) {
631636 // It's just a map of dependency names to versions
632- Some ( serde_json:: from_str :: < HashMap < String , String > > (
633- & fs:: read_to_string ( & pkg_file_path) ?,
634- ) ?)
637+ serde_json:: from_str :: < WasmBindgenPackageJson > ( & fs:: read_to_string ( & pkg_file_path) ?) ?
638+ . dependencies
635639 } else {
636640 None
637641 } ;
Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ fn it_creates_a_package_json_with_npm_dependencies_provided_by_wasm_bindgen() {
332332 utils:: manifest:: create_wbg_package_json (
333333 & out_dir,
334334 r#"
335- { "foo": "^1.2.3" }
335+ {"dependencies": { "foo": "^1.2.3"} }
336336 "# ,
337337 )
338338 . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments