tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.41k stars 289 forks source link

chore(web): add missing dependencies from warnings #6359

Closed vindard closed 2 months ago

vindard commented 2 months ago

Description

These changes will allow 'yarn install' to run with an '--immutable' flag which is useful for some build systems like when building in nixpkgs.

Sample error log from nix build:

error: builder for '/nix/store/jb93fk7wjn07k63n7hf6fin3hxypf3n4-yarn-deps.drv' failed with exit code 1;
       last 25 log lines:
       > ➤ YN0000: ┌ Post-resolution validation
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0060---incompatible_peer_dependencyYN00608;;: │ eslint is listed by your project with version 7.32.0, which doesn't satisfy what react-scripts (pe15cc) and other dependencies request (^8.1.0).
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide @babel/core (p19c5b), requested by babel-loader.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide @babel/core (p890ff), requested by @storybook/addon-essentials.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide @babel/core (pe72d4), requested by @storybook/preset-create-react-app.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide @storybook/node-logger (p56567), requested by @storybook/preset-create-react-app.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide react-is (p3e872), requested by styled-components.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependencyYN00028;;: │ tilt-ui@workspace:. doesn't provide require-from-string (p149c8), requested by @storybook/react.
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0086---explain_peer_dependencies_ctaYN00868;;: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
       > ➤ YN0000: │
       > ➤ YN0000: │ @@ -2,9 +2,9 @@
       > ➤ YN0000: │  # Manual changes might be lost - proceed with caution!
       > ➤ YN0000: │  
       > ➤ YN0000: │  __metadata:
       > ➤ YN0000: │    version: 8
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0028---frozen_lockfile_exceptionYN00288;;: │ -  cacheKey: 10
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0028---frozen_lockfile_exceptionYN00288;;: │ +  cacheKey: 10c0
       > ➤ YN0000: │  
       > ➤ YN0000: │  "@aashutoshrathi/word-wrap@npm:^1.2.3":
       > ➤ YN0000: │    version: 1.2.6
       > ➤ YN0000: │    resolution: "@aashutoshrathi/word-wrap@npm:1.2.6"
       > ➤ YN0000: │
       > ➤ 8;;https://yarnpkg.com/advanced/error-codes#yn0028---frozen_lockfile_exceptionYN00288;;: │ The lockfile would have been modified by this install, which is explicitly forbidden.
       > ➤ YN0000: └ Completed
       > ➤ YN0000: · Failed with errors in 0s 399ms
nicks commented 2 months ago

Hmmm...our ci already runs with --immutable:

https://github.com/tilt-dev/tilt/blob/37e0a526a779d47a870f5acc61320433c0e542e8/Makefile#L80

So I'm a bit confused about what the difference is in your nix env.

Most of this PR is adding dev dependencies as library dependencies, which doesn't seem right...

vindard commented 2 months ago

Ah you're right. It was a YARN_COMPRESSION_LEVEL in my build that was causing the lockfile to mutate, not these dependencies. Closing as resolved, thanks for checking this

vindard commented 2 months ago

For context, this is what I was working on. The update to yarn berry broke fetchYarnDeps for the normal upgrade path in nixpkgs for tilt so I had to change how this is done a bit

https://github.com/NixOS/nixpkgs/pull/306333

Edit: My approach wasn't reproducible across Linux and Darwin systems. This means that until someone figures out a different way to build yarn deps with yarn-berry lockfile format for nix, the nix version will be stuck at 0.3.11 for the latest (cc @nicks as an fyi)