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

chore: update nx packages #1147

Merged
merged 18 commits into from
Jan 10, 2025
Merged

chore: update nx packages #1147

merged 18 commits into from
Jan 10, 2025

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Jan 7, 2025

This PR:

  • updates to nx@latest (had to do 17, then latest to get new lint modules to work). I did:
    • npx nx migrate 17
    • npx nx migrate latest
    • then just run the lint fix and manually fixed a couple lint issues
    • removed deprecated workspace-lint from CI (this validates the project config, but it's automatic now): feat(core): remove deprecated workspace-lint nrwl/nx#16212
    • added the new lint rule below
  • updates @types/node (required to fix new compilation issues)
  • updates the generators

⚠️

There is one significant change in how this repo works: we no longer automatically compute the deps for all packages, BUT we instead throw a lint error if nx calculates that you have failed to include a dep in your package.json which you import in your code.

For example, flagd uses the lru-cache package. Because we import it in our ts files, if we DON'T include it in our pacakge.json, we see this lint error (which causes the build to fail):

nx run providers-flagd:lint
      Linting "providers-flagd"...
      
      /home/todd/git/js-sdk-contrib/libs/providers/flagd/package.json
        9:3  error  The "providers-flagd" project uses the following packages, but they are missing from "peerDependencies":
          - lru-cache  @nx/dependency-checks
      
      ✖ 1 problem (1 error, 0 warnings)
        1 error and 0 warnings potentially fixable with the `--fix` option.

I think this is actually an improvement over the last behavior, since it will cause devs to think carefully about their deps.

⚠️

I have updated all the deps for all the packages appropriately according to this check. Please check the deps of your package.json.

Copy link
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good that we update that!

@toddbaert
Copy link
Member Author

toddbaert commented Jan 7, 2025

Unfortunately, the nx-computed dependencies created by buildableProjectDepsInPackageJsonType no longer work (it was removed); this means we aren't properly computing deps at package time anymore. There's a new way to do this I need to get working.

Marking draft until I figure this out.

@toddbaert toddbaert marked this pull request as draft January 7, 2025 21:02
@toddbaert
Copy link
Member Author

Unfortunately, the nx-computed dependencies created by buildableProjectDepsInPackageJsonType no longer work (it was removed); this means we aren't properly computing deps at package time anymore. There's a new way to do this I need to get working.

Marking draft until I figure this out.

Looks like we can use @nx/dependency-checks for a comparable feature. I almost have it working.

@toddbaert
Copy link
Member Author

toddbaert commented Jan 8, 2025

⚠️

There is one significant change in how this repo works: we no longer automatically compute the deps for all packages, BUT we instead throw a lint error if nx calculates that you have failed to include a dep in your package.json which you import in your code.

For example, flagd uses the lru-cache package. Because we import it in our ts files, if we DON'T include it in our package.json, we see this lint error (which causes the build to fail):

nx run providers-flagd:lint
      Linting "providers-flagd"...
      
      /home/todd/git/js-sdk-contrib/libs/providers/flagd/package.json
        9:3  error  The "providers-flagd" project uses the following packages, but they are missing from "peerDependencies":
          - lru-cache  @nx/dependency-checks
      
      ✖ 1 problem (1 error, 0 warnings)
        1 error and 0 warnings potentially fixable with the `--fix` option.

I think this is actually an improvement over the last behavior, since it will cause devs to think carefully about their deps.

⚠️

I have updated all the deps for all the packages appropriately according to this check. Please check the deps of your package.json.

@toddbaert toddbaert marked this pull request as ready for review January 8, 2025 20:52
Signed-off-by: Todd Baert <[email protected]>
Copy link
Member

@jonathannorris jonathannorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the nx-computed dependencies created by buildableProjectDepsInPackageJsonType no longer work (it was removed); this means we aren't properly computing deps at package time anymore. There's a new way to do this I need to get working.

We've also had this issue while trying to upgrade our NX usage, these NX migrations are not for the faint of heart.

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

Successfully merging this pull request may close these issues.

10 participants