Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Gankra opened this issue May 2, 2024 · 2 comments
Open

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

Gankra opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Gankra
Copy link
Member

Gankra commented May 2, 2024

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.

let new_package_json = serde_json::to_string_pretty(&package_json).expect("serde_json failed");

@Gankra Gankra added the bug Something isn't working label May 2, 2024
@Gankra
Copy link
Member Author

Gankra commented May 7, 2024

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:

if let Some(dir) = entry.as_dir() {
let name = path
.file_name()
.expect("jinja2 template didn't have a name!?")
.to_owned();
let mut new_dir = TemplateDir {
_name: name.clone(),
path: path.to_owned(),
entries: SortedMap::new(),
};
Self::load_files(envs, raw_files, dir, &mut new_dir)
.expect("failed to load jinja2 templates from binary");
parent.entries.insert(name, TemplateEntry::Dir(new_dir));

@Gankra
Copy link
Member Author

Gankra commented May 7, 2024

(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 Gankra added the good first issue Good for newcomers label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant