Skip to content

Commit d02e624

Browse files
authored
feat: Update to Nx 22.3.3 (#268)
* Update to Nx 22.3.3 * Dont check for jest files, thats Nx's responsibility * Fix jest config references in tests * Bump package version to 22.3.3
1 parent 6cdfb5a commit d02e624

9 files changed

Lines changed: 172 additions & 229 deletions

File tree

e2e/nx-firebase-e2e/test-utils/test-utils-functions.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,19 @@ export function expectedFunctionProjectTargets(
4040
},
4141
dependsOn: ['build'],
4242
},
43-
// In Nx 18+, lint is inferred by plugins, but test target is kept
43+
lint: {
44+
executor: '@nx/eslint:lint',
45+
},
46+
// Test target is kept with passWithNoTests so functions without tests don't fail
4447
// with passWithNoTests so functions without tests don't fail
48+
// Nx 22+ uses jest.config.cts for ESM projects
4549
test: {
4650
executor: '@nx/jest:jest',
4751
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
4852
options: {
49-
jestConfig: `${functionProject.projectDir}/jest.config.ts`,
53+
jestConfig: expect.stringMatching(
54+
new RegExp(`^${functionProject.projectDir}/jest\\.config\\.c?ts$`),
55+
),
5056
passWithNoTests: true,
5157
},
5258
},

e2e/nx-firebase-e2e/tests/test-function.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function expectedFunctionFiles(projectData: ProjectData) {
3333
const projectPath = projectData.projectDir
3434
return [
3535
`${projectPath}/src/main.ts`,
36-
`${projectPath}/jest.config.ts`,
3736
`${projectPath}/package.json`,
3837
`${projectPath}/project.json`,
3938
`${projectPath}/readme.md`,

migrations.json

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,63 @@
11
{
22
"migrations": [
33
{
4-
"version": "21.0.0-beta.8",
5-
"description": "Removes the legacy cache configuration from nx.json",
6-
"implementation": "./src/migrations/update-21-0-0/remove-legacy-cache",
4+
"version": "22.0.0-beta.1",
5+
"description": "Updates release version config based on the breaking changes in Nx v22",
6+
"implementation": "./src/migrations/update-22-0-0/release-version-config-changes",
77
"package": "nx",
8-
"name": "remove-legacy-cache"
8+
"name": "22-0-0-release-version-config-changes"
99
},
1010
{
11-
"version": "21.0.0-beta.8",
12-
"description": "Removes the legacy cache configuration from nx.json",
13-
"implementation": "./src/migrations/update-21-0-0/remove-custom-tasks-runner",
11+
"version": "22.0.0-beta.2",
12+
"description": "Consolidates releaseTag* options into nested releaseTag object structure",
13+
"implementation": "./src/migrations/update-22-0-0/consolidate-release-tag-config",
1414
"package": "nx",
15-
"name": "remove-custom-tasks-runner"
15+
"name": "22-0-0-consolidate-release-tag-config"
1616
},
1717
{
18-
"version": "21.0.0-beta.11",
19-
"description": "Updates release version config based on the breaking changes in Nx v21",
20-
"implementation": "./src/migrations/update-21-0-0/release-version-config-changes",
21-
"package": "nx",
22-
"name": "release-version-config-changes"
23-
},
24-
{
25-
"version": "21.0.0-beta.11",
26-
"description": "Updates release changelog config based on the breaking changes in Nx v21",
27-
"implementation": "./src/migrations/update-21-0-0/release-changelog-config-changes",
28-
"package": "nx",
29-
"name": "release-changelog-config-changes"
30-
},
31-
{
32-
"version": "21.1.0-beta.2",
33-
"description": "Adds **/nx-rules.mdc and **/nx.instructions.md to .gitignore if not present",
34-
"implementation": "./src/migrations/update-21-1-0/add-gitignore-entry",
18+
"cli": "nx",
19+
"version": "22.1.0-beta.5",
20+
"description": "Updates the nx wrapper.",
21+
"implementation": "./src/migrations/update-22-1-0/update-nx-wrapper",
3522
"package": "nx",
36-
"name": "21-1-0-add-ignore-entries-for-nx-rule-files"
23+
"name": "22-1-0-update-nx-wrapper"
3724
},
3825
{
39-
"version": "21.5.0-beta.2",
40-
"description": "Migrate the legacy 'development' custom condition to a workspace-unique custom condition name.",
41-
"factory": "./src/migrations/update-21-5-0/migrate-development-custom-condition",
26+
"version": "22.0.0-beta.0",
27+
"description": "Remove the deprecated `external` and `externalBuildTargets` options from the `@nx/js:swc` and `@nx/js:tsc` executors.",
28+
"factory": "./src/migrations/update-22-0-0/remove-external-options-from-js-executors",
4229
"package": "@nx/js",
43-
"name": "migrate-development-custom-condition"
30+
"name": "remove-external-options-from-js-executors"
4431
},
4532
{
46-
"cli": "nx",
47-
"version": "21.0.0-beta.9",
48-
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
49-
"implementation": "./src/migrations/update-21-0-0/replace-getJestProjects-with-getJestProjectsAsync",
50-
"package": "@nx/jest",
51-
"name": "replace-getJestProjects-with-getJestProjectsAsync-v21"
52-
},
53-
{
54-
"version": "21.0.0-beta.10",
55-
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
56-
"implementation": "./src/migrations/update-21-0-0/remove-tsconfig-option-from-jest-executor",
57-
"package": "@nx/jest",
58-
"name": "remove-tsconfig-option-from-jest-executor"
33+
"version": "22.1.0-rc.1",
34+
"description": "Removes redundant TypeScript project references from project's tsconfig.json files when runtime tsconfig files (e.g., tsconfig.lib.json, tsconfig.app.json) exist.",
35+
"factory": "./src/migrations/update-22-1-0/remove-redundant-ts-project-references",
36+
"package": "@nx/js",
37+
"name": "remove-redundant-ts-project-references"
5938
},
6039
{
61-
"version": "21.3.0-beta.3",
62-
"description": "Rename the CLI option `testPathPattern` to `testPathPatterns`.",
63-
"implementation": "./src/migrations/update-21-3-0/rename-test-path-pattern",
40+
"version": "22.2.0-beta.2",
41+
"description": "Convert jest.config.ts files from ESM to CJS syntax (export default -> module.exports, import -> require) for projects using CommonJS resolution to ensure correct loading under Node.js type-stripping.",
42+
"implementation": "./src/migrations/update-22-2-0/convert-jest-config-to-cjs",
6443
"package": "@nx/jest",
65-
"name": "rename-test-path-pattern"
44+
"name": "convert-jest-config-to-cjs"
6645
},
6746
{
68-
"version": "21.3.0-beta.3",
47+
"version": "22.3.2-beta.0",
6948
"requires": { "jest": ">=30.0.0" },
7049
"description": "Replace removed matcher aliases in Jest v30 with their corresponding matcher",
7150
"implementation": "./src/migrations/update-21-3-0/replace-removed-matcher-aliases",
7251
"package": "@nx/jest",
73-
"name": "replace-removed-matcher-aliases"
52+
"name": "replace-removed-matcher-aliases-v22-3"
7453
},
7554
{
7655
"cli": "nx",
77-
"version": "21.0.0-beta.11",
78-
"description": "Remove isolatedConfig option for @nx/webpack:webpack",
79-
"implementation": "./src/migrations/update-21-0-0/remove-isolated-config",
56+
"version": "22.0.0-beta.0",
57+
"description": "Remove deprecated deleteOutputPath and sassImplementation options from @nx/webpack:webpack",
58+
"implementation": "./src/migrations/update-22-0-0/remove-deprecated-options",
8059
"package": "@nx/webpack",
81-
"name": "update-21-0-0-remove-isolated-config"
60+
"name": "update-22-0-0-remove-deprecated-options"
8261
}
8362
]
8463
}

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"devDependencies": {
2222
"@eslint/eslintrc": "^2.1.1",
2323
"@google-cloud/functions-framework": "^3.3.0",
24-
"@nx/devkit": "21.6.10",
25-
"@nx/eslint": "21.6.10",
26-
"@nx/eslint-plugin": "21.6.10",
27-
"@nx/jest": "21.6.10",
28-
"@nx/js": "21.6.10",
29-
"@nx/node": "21.6.10",
30-
"@nx/plugin": "21.6.10",
31-
"@nx/webpack": "21.6.10",
32-
"@nx/workspace": "21.6.10",
24+
"@nx/devkit": "22.3.3",
25+
"@nx/eslint": "22.3.3",
26+
"@nx/eslint-plugin": "22.3.3",
27+
"@nx/jest": "22.3.3",
28+
"@nx/js": "22.3.3",
29+
"@nx/node": "22.3.3",
30+
"@nx/plugin": "22.3.3",
31+
"@nx/webpack": "22.3.3",
32+
"@nx/workspace": "22.3.3",
3333
"@types/jest": "30.0.0",
3434
"@types/node": "20.19.0",
3535
"@types/semver": "^7.3.13",
@@ -45,7 +45,7 @@
4545
"jest": "30.0.5",
4646
"jest-environment-jsdom": "30.0.5",
4747
"kill-port": "2.0.1",
48-
"nx": "21.6.10",
48+
"nx": "22.3.3",
4949
"only-allow": "^1.2.1",
5050
"prettier": "^3.x",
5151
"semver": "^7.6.0",

packages/nx-firebase/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simondotm/nx-firebase",
3-
"version": "21.6.10",
3+
"version": "22.3.3",
44
"description": "A Firebase plugin for Nx monorepo workspaces.",
55
"author": "Simon Morris",
66
"license": "MIT",
@@ -21,9 +21,9 @@
2121
"generators": "./generators.json",
2222
"executors": "./executors.json",
2323
"peerDependencies": {
24-
"@nx/devkit": ">= 21.6.10",
25-
"@nx/workspace": ">= 21.6.10",
26-
"nx": ">= 21.6.10"
24+
"@nx/devkit": ">= 22.3.3",
25+
"@nx/workspace": ">= 22.3.3",
26+
"nx": ">= 22.3.3"
2727
},
2828
"dependencies": {}
2929
}

packages/nx-firebase/src/__generated__/nx-firebase-versions.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/nx-firebase/src/generators/function/function.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ describe('function generator', () => {
9898
executor: '@nx/jest:jest',
9999
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
100100
options: {
101-
jestConfig: 'myFirebaseFunction/jest.config.ts',
101+
jestConfig: expect.stringMatching(
102+
/^myFirebaseFunction\/jest\.config\.c?ts$/,
103+
),
102104
passWithNoTests: true,
103105
},
104106
},
@@ -140,7 +142,6 @@ describe('function generator', () => {
140142
expect(tree.exists(`${root}/src/assets/.gitkeep`)).toBeTruthy()
141143
expect(tree.exists(`${root}/package.json`)).toBeTruthy()
142144
expect(tree.exists(`${root}/readme.md`)).toBeTruthy()
143-
expect(tree.exists(`${root}/jest.config.ts`)).toBeTruthy()
144145
expect(tree.exists(`${root}/project.json`)).toBeTruthy()
145146
expect(tree.exists(`${root}/tsconfig.app.json`)).toBeTruthy()
146147
expect(tree.exists(`${root}/tsconfig.json`)).toBeTruthy()
@@ -173,7 +174,6 @@ describe('function generator', () => {
173174
expect(tree.exists(`${root}/src/assets/.gitkeep`)).toBeTruthy()
174175
expect(tree.exists(`${root}/package.json`)).toBeTruthy()
175176
expect(tree.exists(`${root}/readme.md`)).toBeTruthy()
176-
expect(tree.exists(`${root}/jest.config.ts`)).toBeTruthy()
177177
expect(tree.exists(`${root}/project.json`)).toBeTruthy()
178178
expect(tree.exists(`${root}/tsconfig.app.json`)).toBeTruthy()
179179
expect(tree.exists(`${root}/tsconfig.json`)).toBeTruthy()

packages/nx-firebase/src/generators/function/lib/update-project.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ export function updateProject(host: Tree, options: NormalizedSchema): void {
7171
// when running the firebase app's test target. passWithNoTests is a CLI option,
7272
// not a jest.config option, so we need to set it in the target.
7373
// In Nx 18+, the test target may not exist (inferred by plugin), so we create it.
74+
// Nx 22+ creates jest.config.cts for ESM projects, so we check which file exists
75+
const jestConfigFile = host.exists(`${options.projectRoot}/jest.config.cts`)
76+
? 'jest.config.cts'
77+
: 'jest.config.ts'
7478
project.targets.test = {
7579
executor: '@nx/jest:jest',
7680
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
7781
options: {
78-
jestConfig: `${options.projectRoot}/jest.config.ts`,
82+
jestConfig: `${options.projectRoot}/${jestConfigFile}`,
7983
passWithNoTests: true,
8084
},
8185
}

0 commit comments

Comments
 (0)