-
Notifications
You must be signed in to change notification settings - Fork 2.9k
chore: use nx graph instead of manually defined devDependencies in package.json files across whole workspace #35611
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
Conversation
3bc38e3 to
5659e41
Compare
| "devDependencies": { | ||
| "@fluentui/eslint-plugin": "*", | ||
| "@fluentui/react": "*", | ||
| "@types/react-addons-test-utils": "0.14.18", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused 3rd party package. removing
📊 Bundle size report✅ No changes found |
…ache to trigger affected tree rather than hard dependency on that package
…kage.json files across whole workspace
…r test and define it as implicit dep
…rather than nested dictionary which doesnt work on ci?
… order to properly resolve dependency graph
6d68ef2 to
5fd1b11
Compare
…of using nx implicitDeps to build graph resolution
…d for build/bundle targets
|
Pull request demo site: URL |
… rule from lint configs within stories projects
…from stories project
| "description": "Fluent UI React local demo app", | ||
| "main": "lib-commonjs/index.js", | ||
| "module": "lib/index.js", | ||
| "exports": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these nested path imports are used across ssr-tests and public-docsite ( v8 ), in order to be able to resovle the dep graph correctly by nx we added proper API export maps
| "build": { | ||
| "dependsOn": ["^build"], | ||
| "inputs": ["production", "^production"], | ||
| "inputs": ["production", "^production", "{workspaceRoot}/scripts/api-extractor/api-extractor.*.json"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we change any api-extractor config within our scoped library it will invalidate caches and trigger affected build of all packages that use its definitions without need of providing implicit Dependency
dmytrokirpa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome to see so much of the boilerplate gone, even if implicit staff isn’t really my preference.
Everything looks good to me! Just wanted to double-check - are we dropping import/no-extraneous-dependencies, and is it okay to import transitive dependencies now?
| { | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'warn', | ||
| 'import/no-extraneous-dependencies': [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this rule? What would happen if a developer imports a transitive dependency that isn't listed in the package/monorepo's package.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this rule?
yes ! good catch ty! didn't caught this one as it wasn't failing pipeline. lemme update
What would happen if a developer imports a transitive dependency that isn't listed in the package/monorepo's package.json?
for devDeps or non publishable packages in general we don't care (exempt are applications that can be deployed - aka production deps necessary for docker etc), that's unnecessary overhead as nx will build the graph for us.
- we still need to enforce SVP via a workspace sync generator feat: adopt single version policy for monorepo dependencies #21395
@dmytrokirpa not for publishable packages yet, but we will replace it with nx dep check microsoft/fluentui-contrib#316, this will also enable us to remove |
Previous Behavior
New Behavior
This pull request removes manually defined
devDependenciesfrom thepackage.jsonfiles across multiple application packages in the workspace. The change is part of a shift to using the Nx dependency graph to manage development dependencies, simplifying package maintenance and reducing duplication. No production dependencies or application logic are affected.Details:
1. Removed all manually specified
devDependenciesfrom thepackage.jsonfiles2.
scripts-api-extractordependency resolution is now driven viainputcache invalidation rather than hard dependency on the project.Before:
if
scripts-api-extractoris changed all its dependants were affected and triggered all targetsAfter:
if
scripts-api-extractoris changed all its dependants were affected and will trigger only contextually related target. In our casegenerate-apiandbuild3.
jest-serializer-merge-stylesdependency resolutionis now explicitly being loaded via node
require.resolveso Nx can infer it as project dependency instead of manually specifing in package.json / implicitDependencies4. v9 stories lint update
removed invalid 'import/no-extraneous-dependencies' as dep graph is now created purely by Nx
5. removing
"@types/react-addons-test-utilsafter cleanup, yarn started to fail on CI which was caused by v1 and aliasing issue, this is resolved as part of this PR
Related Issue(s)