cargo-dist icon indicating copy to clipboard operation
cargo-dist copied to clipboard

[npm-installer] avoid sorting package.json and npm-shrinkwrap.json

Open Gankra opened this issue 1 year ago • 2 comments

This isn't a big deal but it's ugly.

Serde is auto-sorting them, when really we'd like to keep them in the same order they're checked in. I'm not sure if this is a "don't use serde" (is there a "json_edit" library equivalent to toml_edit? or "find the right flags for serde" or what.

https://github.com/axodotdev/cargo-dist/blob/e64776d69f7dda13f4e7dcb99d2714efc187740a/cargo-dist/src/backend/installer/npm.rs#L185

Gankra avatar May 02 '24 20:05 Gankra

Oh also node_modules is in .gitignore but in localdev you can create it and the template system I think will gobble it up and we should prevent that. I think just add a continue here if the dir's name is node_modules:

https://github.com/axodotdev/cargo-dist/blob/e64776d69f7dda13f4e7dcb99d2714efc187740a/cargo-dist/src/backend/templates.rs#L323-L335

Gankra avatar May 07 '24 18:05 Gankra

~~(Or maybe it does avoid node_modules? In which case: why? is that a bug in the template code?)~~

No it super does lmao.

Gankra avatar May 07 '24 18:05 Gankra