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(repo): add conformance rule for our package.json files #29078

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,43 @@
"nxCloudUrl": "https://staging.nx.app",
"parallel": 1,
"bust": 1,
"defaultBase": "master"
"defaultBase": "master",
"conformance": {
"rules": [
{
"rule": "@nx/workspace-plugin/conformance-rules/project-package-json",
"projects": [
"!.",
"!create-nx-*",
"!cypress",
"!detox",
"!devkit",
"!esbuild",
"!eslint-plugin",
"!eslint",
"!expo",
"!express",
"!jest",
"!js",
"!module-federation",
"!nest",
"!next",
"!node",
"!nuxt",
"!packages/nx/**",
"!plugin",
"!react-native",
"!react",
"!rollup",
"!rsbuild",
"!rspack",
"!storybook",
"!vue",
"!web",
"!webpack",
"!workspace"
]
}
]
}
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"@eslint/eslintrc": "^2.1.1",
"@eslint/js": "^8.48.0",
"@floating-ui/react": "0.26.6",
"@jest/reporters": "^29.4.1",
"@jest/test-result": "^29.4.1",
"@jest/types": "^29.4.1",
"@jest/reporters": "29.7.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Our jest packages weren't aligned for some reason

"@jest/test-result": "29.7.0",
"@jest/types": "29.6.3",
"@module-federation/enhanced": "0.7.6",
"@module-federation/sdk": "0.7.6",
"@monodon/rust": "2.1.1",
Expand All @@ -79,9 +79,9 @@
"@nx/js": "20.3.0-beta.0",
"@nx/next": "20.3.0-beta.0",
"@nx/playwright": "20.3.0-beta.0",
"@nx/powerpack-conformance": "1.1.0-beta.9",
"@nx/powerpack-enterprise-cloud": "1.1.0-beta.9",
"@nx/powerpack-license": "1.1.0-beta.9",
"@nx/powerpack-conformance": "1.1.1-alpha.1",
"@nx/powerpack-enterprise-cloud": "1.1.1-alpha.1",
"@nx/powerpack-license": "1.1.1-alpha.1",
"@nx/react": "20.3.0-beta.0",
"@nx/rsbuild": "20.3.0-beta.0",
"@nx/rspack": "20.3.0-beta.0",
Expand Down Expand Up @@ -219,13 +219,13 @@
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"jest": "29.7.0",
"jest-config": "^29.4.1",
"jest-diff": "^29.4.1",
"jest-config": "29.7.0",
"jest-diff": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-environment-node": "^29.4.1",
"jest-resolve": "^29.4.1",
"jest-runtime": "^29.4.1",
"jest-util": "^29.4.1",
"jest-environment-node": "29.7.0",
"jest-resolve": "29.7.0",
"jest-runtime": "29.7.0",
"jest-util": "29.7.0",
"js-tokens": "^4.0.0",
"jsonc-eslint-parser": "^2.1.0",
"jsonc-parser": "3.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,8 @@
},
"nx-migrations": {
"migrations": "./migrations.json"
},
"publishConfig": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Found by the new rule!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we needed this for provenance... how does rspack have provenance without this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not for provenance, it's needed because the default access for new scoped package is restricted and so the first time we publish a new package we need this explicit config. Technically after that point we no longer need it anymore, but it doesn't do any harm, just makes its state explicit, and so having this be a rule for all package.json files means we won't run into any issues when new packages are added in future.

"access": "public"
}
}
645 changes: 374 additions & 271 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion scripts/patched-jest-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ module.exports = function (path, options) {
}
// Try to use the defaultResolver
try {
if (path.startsWith('@nx/')) throw new Error('custom resolution');
// powerpack packages are installed via npm and resolved like any other packages
if (path.startsWith('@nx/') && !path.startsWith('@nx/powerpack-')) {
throw new Error('custom resolution');
}
if (path.startsWith('nx/')) throw new Error('custom resolution');

if (path.indexOf('@nx/workspace') > -1) {
Expand Down
Loading
Loading