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

feat: store flags that impact tree building in the package-lock.json #636

Open
nlf opened this issue Jan 26, 2023 · 1 comment
Open

feat: store flags that impact tree building in the package-lock.json #636

nlf opened this issue Jan 26, 2023 · 1 comment

Comments

@nlf
Copy link

nlf commented Jan 26, 2023

Is your feature request related to a problem? Please describe.

Yes. For example, if a user runs npm install --legacy-peer-deps followed by npm ls without including the --legacy-peer-deps flag, they will see errors in their tree related to peer dependencies. Running npm ls --legacy-peer-deps however, returns correctly.

Describe the solution you'd like

We should store flags that impact the shape of the dependency tree in the package-lock.json, this way future commands can be aware those flags were used and can enable them, providing our users a more consistent experience. For our users who disable package-lock.json (like ourselves, we do that) this data should be persisted in the hidden lockfile as well.

Describe alternatives you've considered

The only alternative I can think of is implicitly saving these settings to a project level .npmrc. This could be a viable approach too.

Additional context

Here's a spot to link related issues as we find them:

@ljharb
Copy link

ljharb commented Jan 26, 2023

I think it would be best to save it to both the lockfile and the npmrc, and then, if in the future the config in use doesn't match what's in the lockfile, error out and require -f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants