Skip to content

chore: update to nx 20 #10128

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

Merged
merged 4 commits into from
Oct 14, 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
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

// @ts-check
const { getJestProjects } = require('@nx/jest');
const { getJestProjectsAsync } = require('@nx/jest');
Copy link
Member

Choose a reason for hiding this comment

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

I'm getting flashbacks to C#/.NET 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

The sync version is only deprecated and still there so sadly we have to have another name for this one!


/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
projects: getJestProjects(),
};
module.exports = async () => ({
projects: await getJestProjectsAsync(),
});
1 change: 0 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"nxCloudAccessToken": "YjIzMmMxMWItMjhiMS00NWY2LTk1NWYtYWU3YWQ0YjE4YjBlfHJlYWQ=",
"release": {
"projects": [
"*",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is no longer needed, we can use a list of only negative matchers and the ALL EXCEPT is implied

"!repo",
"!website*",
"!integration-tests",
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "^8.57.0",
"@jest/types": "29.6.3",
"@nx/devkit": "19.5.2",
"@nx/eslint": "19.5.2",
"@nx/jest": "19.5.2",
"@nx/workspace": "19.5.2",
"@nx/devkit": "20.0.0",
"@nx/eslint": "20.0.0",
"@nx/jest": "20.0.0",
"@nx/workspace": "20.0.0",
"@swc/core": "^1.4.12",
"@swc/jest": "^0.2.36",
"@types/babel__code-frame": "^7.0.6",
"@types/babel__core": "^7.20.5",
"@types/debug": "^4.1.12",
"@types/is-glob": "^4.0.4",
"@types/jest": "29.5.12",
"@types/jest": "29.5.13",
"@types/jest-specific-snapshot": "^0.5.9",
"@types/natural-compare": "^1.4.3",
"@types/ncp": "^2.0.8",
Expand Down Expand Up @@ -117,7 +117,7 @@
"make-dir": "^4.0.0",
"markdownlint-cli": "^0.42.0",
"ncp": "^2.0.0",
"nx": "19.5.2",
"nx": "20.0.0",
"prettier": "3.3.2",
"pretty-format": "^29.7.0",
"rimraf": "^5.0.5",
Expand Down
37 changes: 9 additions & 28 deletions tools/release/changelog-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,15 @@

// @ts-check
const {
default: defaultChangelogRenderer,
default: DefaultChangelogRenderer,
} = require('nx/release/changelog-renderer');

const changelogRenderer = async ({
projectGraph,
commits,
releaseVersion,
project,
entryWhenNoChanges,
changelogRenderOptions,
repoSlug,
conventionalCommitsConfig,
changes,
}) => {
const defaultChangelog = await defaultChangelogRenderer({
projectGraph,
commits,
releaseVersion,
project,
entryWhenNoChanges,
changelogRenderOptions,
repoSlug,
conventionalCommitsConfig,
changes,
});

// Append our custom messaging to the generated changelog entry
return `${defaultChangelog}\n\nYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.`;
module.exports = class CustomChangelogRenderer extends (
Copy link
Member Author

Choose a reason for hiding this comment

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

The changelog renderer API is now class based where individual elements of the render can be easily patched by overwriting base methods. In our case we are just bolting text onto the full default render, so we only need to amend the main render() method.

DefaultChangelogRenderer
) {
async render() {
const defaultChangelog = await super.render();
// Append our custom messaging to the generated changelog entry
return `${defaultChangelog}\n\nYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.`;
}
};

module.exports = changelogRenderer;
8 changes: 6 additions & 2 deletions tools/release/release.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ if (workspaceVersion === null) {
process.exit(0);
}

const publishStatus = await releasePublish({
const publishProjectsResult = await releasePublish({
Copy link
Member Author

Choose a reason for hiding this comment

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

releasePublish now always returns a mapping of project names to data (which right now only contains exit codes), rather than one simplistic exit code for the whole set of projects

dryRun: options.dryRun,
verbose: options.verbose,
});

// eslint-disable-next-line no-process-exit
process.exit(publishStatus);
process.exit(
// If any of the individual project publish tasks returned a non-zero exit code, exit with code 1
Object.values(publishProjectsResult).some(({ code }) => code !== 0) ? 1 : 0,
);
Loading
Loading