axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.43k stars 60 forks source link

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

Open Gankra opened 3 months ago

Gankra commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

No it super does lmao.