Skip to content
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
10 changes: 8 additions & 2 deletions e2e/nx-firebase-e2e/test-utils/test-utils-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ export function expectedFunctionProjectTargets(
},
dependsOn: ['build'],
},
// In Nx 18+, lint is inferred by plugins, but test target is kept
lint: {
executor: '@nx/eslint:lint',
},
// Test target is kept with passWithNoTests so functions without tests don't fail
// with passWithNoTests so functions without tests don't fail
// Nx 22+ uses jest.config.cts for ESM projects
test: {
executor: '@nx/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: `${functionProject.projectDir}/jest.config.ts`,
jestConfig: expect.stringMatching(
new RegExp(`^${functionProject.projectDir}/jest\\.config\\.c?ts$`),
),
passWithNoTests: true,
},
},
Expand Down
1 change: 0 additions & 1 deletion e2e/nx-firebase-e2e/tests/test-function.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function expectedFunctionFiles(projectData: ProjectData) {
const projectPath = projectData.projectDir
return [
`${projectPath}/src/main.ts`,
`${projectPath}/jest.config.ts`,
`${projectPath}/package.json`,
`${projectPath}/project.json`,
`${projectPath}/readme.md`,
Expand Down
85 changes: 32 additions & 53 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,63 @@
{
"migrations": [
{
"version": "21.0.0-beta.8",
"description": "Removes the legacy cache configuration from nx.json",
"implementation": "./src/migrations/update-21-0-0/remove-legacy-cache",
"version": "22.0.0-beta.1",
"description": "Updates release version config based on the breaking changes in Nx v22",
"implementation": "./src/migrations/update-22-0-0/release-version-config-changes",
"package": "nx",
"name": "remove-legacy-cache"
"name": "22-0-0-release-version-config-changes"
},
{
"version": "21.0.0-beta.8",
"description": "Removes the legacy cache configuration from nx.json",
"implementation": "./src/migrations/update-21-0-0/remove-custom-tasks-runner",
"version": "22.0.0-beta.2",
"description": "Consolidates releaseTag* options into nested releaseTag object structure",
"implementation": "./src/migrations/update-22-0-0/consolidate-release-tag-config",
"package": "nx",
"name": "remove-custom-tasks-runner"
"name": "22-0-0-consolidate-release-tag-config"
},
{
"version": "21.0.0-beta.11",
"description": "Updates release version config based on the breaking changes in Nx v21",
"implementation": "./src/migrations/update-21-0-0/release-version-config-changes",
"package": "nx",
"name": "release-version-config-changes"
},
{
"version": "21.0.0-beta.11",
"description": "Updates release changelog config based on the breaking changes in Nx v21",
"implementation": "./src/migrations/update-21-0-0/release-changelog-config-changes",
"package": "nx",
"name": "release-changelog-config-changes"
},
{
"version": "21.1.0-beta.2",
"description": "Adds **/nx-rules.mdc and **/nx.instructions.md to .gitignore if not present",
"implementation": "./src/migrations/update-21-1-0/add-gitignore-entry",
"cli": "nx",
"version": "22.1.0-beta.5",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-22-1-0/update-nx-wrapper",
"package": "nx",
"name": "21-1-0-add-ignore-entries-for-nx-rule-files"
"name": "22-1-0-update-nx-wrapper"
},
{
"version": "21.5.0-beta.2",
"description": "Migrate the legacy 'development' custom condition to a workspace-unique custom condition name.",
"factory": "./src/migrations/update-21-5-0/migrate-development-custom-condition",
"version": "22.0.0-beta.0",
"description": "Remove the deprecated `external` and `externalBuildTargets` options from the `@nx/js:swc` and `@nx/js:tsc` executors.",
"factory": "./src/migrations/update-22-0-0/remove-external-options-from-js-executors",
"package": "@nx/js",
"name": "migrate-development-custom-condition"
"name": "remove-external-options-from-js-executors"
},
{
"cli": "nx",
"version": "21.0.0-beta.9",
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
"implementation": "./src/migrations/update-21-0-0/replace-getJestProjects-with-getJestProjectsAsync",
"package": "@nx/jest",
"name": "replace-getJestProjects-with-getJestProjectsAsync-v21"
},
{
"version": "21.0.0-beta.10",
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"implementation": "./src/migrations/update-21-0-0/remove-tsconfig-option-from-jest-executor",
"package": "@nx/jest",
"name": "remove-tsconfig-option-from-jest-executor"
"version": "22.1.0-rc.1",
"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.",
"factory": "./src/migrations/update-22-1-0/remove-redundant-ts-project-references",
"package": "@nx/js",
"name": "remove-redundant-ts-project-references"
},
{
"version": "21.3.0-beta.3",
"description": "Rename the CLI option `testPathPattern` to `testPathPatterns`.",
"implementation": "./src/migrations/update-21-3-0/rename-test-path-pattern",
"version": "22.2.0-beta.2",
"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.",
"implementation": "./src/migrations/update-22-2-0/convert-jest-config-to-cjs",
"package": "@nx/jest",
"name": "rename-test-path-pattern"
"name": "convert-jest-config-to-cjs"
},
{
"version": "21.3.0-beta.3",
"version": "22.3.2-beta.0",
"requires": { "jest": ">=30.0.0" },
"description": "Replace removed matcher aliases in Jest v30 with their corresponding matcher",
"implementation": "./src/migrations/update-21-3-0/replace-removed-matcher-aliases",
"package": "@nx/jest",
"name": "replace-removed-matcher-aliases"
"name": "replace-removed-matcher-aliases-v22-3"
},
{
"cli": "nx",
"version": "21.0.0-beta.11",
"description": "Remove isolatedConfig option for @nx/webpack:webpack",
"implementation": "./src/migrations/update-21-0-0/remove-isolated-config",
"version": "22.0.0-beta.0",
"description": "Remove deprecated deleteOutputPath and sassImplementation options from @nx/webpack:webpack",
"implementation": "./src/migrations/update-22-0-0/remove-deprecated-options",
"package": "@nx/webpack",
"name": "update-21-0-0-remove-isolated-config"
"name": "update-22-0-0-remove-deprecated-options"
}
]
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"devDependencies": {
"@eslint/eslintrc": "^2.1.1",
"@google-cloud/functions-framework": "^3.3.0",
"@nx/devkit": "21.6.10",
"@nx/eslint": "21.6.10",
"@nx/eslint-plugin": "21.6.10",
"@nx/jest": "21.6.10",
"@nx/js": "21.6.10",
"@nx/node": "21.6.10",
"@nx/plugin": "21.6.10",
"@nx/webpack": "21.6.10",
"@nx/workspace": "21.6.10",
"@nx/devkit": "22.3.3",
"@nx/eslint": "22.3.3",
"@nx/eslint-plugin": "22.3.3",
"@nx/jest": "22.3.3",
"@nx/js": "22.3.3",
"@nx/node": "22.3.3",
"@nx/plugin": "22.3.3",
"@nx/webpack": "22.3.3",
"@nx/workspace": "22.3.3",
"@types/jest": "30.0.0",
"@types/node": "20.19.0",
"@types/semver": "^7.3.13",
Expand All @@ -45,7 +45,7 @@
"jest": "30.0.5",
"jest-environment-jsdom": "30.0.5",
"kill-port": "2.0.1",
"nx": "21.6.10",
"nx": "22.3.3",
"only-allow": "^1.2.1",
"prettier": "^3.x",
"semver": "^7.6.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/nx-firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@simondotm/nx-firebase",
"version": "21.6.10",
"version": "22.3.3",
"description": "A Firebase plugin for Nx monorepo workspaces.",
"author": "Simon Morris",
"license": "MIT",
Expand All @@ -21,9 +21,9 @@
"generators": "./generators.json",
"executors": "./executors.json",
"peerDependencies": {
"@nx/devkit": ">= 21.6.10",
"@nx/workspace": ">= 21.6.10",
"nx": ">= 21.6.10"
"@nx/devkit": ">= 22.3.3",
"@nx/workspace": ">= 22.3.3",
"nx": ">= 22.3.3"
},
"dependencies": {}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/nx-firebase/src/generators/function/function.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ describe('function generator', () => {
executor: '@nx/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: 'myFirebaseFunction/jest.config.ts',
jestConfig: expect.stringMatching(
/^myFirebaseFunction\/jest\.config\.c?ts$/,
),
passWithNoTests: true,
},
},
Expand Down Expand Up @@ -140,7 +142,6 @@ describe('function generator', () => {
expect(tree.exists(`${root}/src/assets/.gitkeep`)).toBeTruthy()
expect(tree.exists(`${root}/package.json`)).toBeTruthy()
expect(tree.exists(`${root}/readme.md`)).toBeTruthy()
expect(tree.exists(`${root}/jest.config.ts`)).toBeTruthy()
expect(tree.exists(`${root}/project.json`)).toBeTruthy()
expect(tree.exists(`${root}/tsconfig.app.json`)).toBeTruthy()
expect(tree.exists(`${root}/tsconfig.json`)).toBeTruthy()
Expand Down Expand Up @@ -173,7 +174,6 @@ describe('function generator', () => {
expect(tree.exists(`${root}/src/assets/.gitkeep`)).toBeTruthy()
expect(tree.exists(`${root}/package.json`)).toBeTruthy()
expect(tree.exists(`${root}/readme.md`)).toBeTruthy()
expect(tree.exists(`${root}/jest.config.ts`)).toBeTruthy()
expect(tree.exists(`${root}/project.json`)).toBeTruthy()
expect(tree.exists(`${root}/tsconfig.app.json`)).toBeTruthy()
expect(tree.exists(`${root}/tsconfig.json`)).toBeTruthy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,15 @@ export function updateProject(host: Tree, options: NormalizedSchema): void {
// when running the firebase app's test target. passWithNoTests is a CLI option,
// not a jest.config option, so we need to set it in the target.
// In Nx 18+, the test target may not exist (inferred by plugin), so we create it.
// Nx 22+ creates jest.config.cts for ESM projects, so we check which file exists
const jestConfigFile = host.exists(`${options.projectRoot}/jest.config.cts`)
? 'jest.config.cts'
: 'jest.config.ts'
project.targets.test = {
executor: '@nx/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: `${options.projectRoot}/jest.config.ts`,
jestConfig: `${options.projectRoot}/${jestConfigFile}`,
passWithNoTests: true,
},
}
Expand Down
Loading