diff --git a/@commitlint/config-nx-scopes/fixtures/basic/nx.json b/@commitlint/config-nx-scopes/fixtures/basic/nx.json index 8101f3d70a..7d14dd19e9 100644 --- a/@commitlint/config-nx-scopes/fixtures/basic/nx.json +++ b/@commitlint/config-nx-scopes/fixtures/basic/nx.json @@ -4,11 +4,11 @@ "defaultBase": "main" }, "cli": { - "defaultCollection": "@nrwl/react" + "defaultCollection": "@nx/react" }, "tasksRunnerOptions": { "default": { - "runner": "@nrwl/nx-cloud", + "runner": "nx-cloud", "options": { "cacheableOperations": [ "build", @@ -20,7 +20,7 @@ } }, "generators": { - "@nrwl/react": { + "@nx/react": { "application": { "style": "css", "linter": "eslint", diff --git a/@commitlint/config-nx-scopes/fixtures/basic/nx/a/project.json b/@commitlint/config-nx-scopes/fixtures/basic/nx/a/project.json index 643c9f86eb..6d65b16d03 100644 --- a/@commitlint/config-nx-scopes/fixtures/basic/nx/a/project.json +++ b/@commitlint/config-nx-scopes/fixtures/basic/nx/a/project.json @@ -4,7 +4,7 @@ "projectType": "library", "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": [ "{options.outputFile}" ], @@ -15,7 +15,7 @@ } }, "test": { - "executor": "@nrwl/jest:jest", + "executor": "@nx/jest:jest", "outputs": [ "coverage/nx/a" ], diff --git a/@commitlint/config-nx-scopes/fixtures/basic/nx/b/project.json b/@commitlint/config-nx-scopes/fixtures/basic/nx/b/project.json index 734fca153d..256f6af075 100644 --- a/@commitlint/config-nx-scopes/fixtures/basic/nx/b/project.json +++ b/@commitlint/config-nx-scopes/fixtures/basic/nx/b/project.json @@ -4,7 +4,7 @@ "projectType": "library", "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": [ "{options.outputFile}" ], @@ -15,7 +15,7 @@ } }, "test": { - "executor": "@nrwl/jest:jest", + "executor": "@nx/jest:jest", "outputs": [ "coverage/nx/b" ], diff --git a/@commitlint/config-nx-scopes/fixtures/basic/package.json b/@commitlint/config-nx-scopes/fixtures/basic/package.json index c3827cefb7..557fdf5904 100644 --- a/@commitlint/config-nx-scopes/fixtures/basic/package.json +++ b/@commitlint/config-nx-scopes/fixtures/basic/package.json @@ -2,6 +2,6 @@ "name": "basic", "version": "1.0.0", "devDependencies": { - "nx": "^14.0.0" + "nx": "^16.0.0" } } \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/empty/nx.json b/@commitlint/config-nx-scopes/fixtures/empty/nx.json index b3fbc22df8..a5e2f1f8f9 100644 --- a/@commitlint/config-nx-scopes/fixtures/empty/nx.json +++ b/@commitlint/config-nx-scopes/fixtures/empty/nx.json @@ -3,9 +3,6 @@ "affected": { "defaultBase": "main" }, - "cli": { - "defaultCollection": "@nrwl/workspace" - }, "implicitDependencies": { "package.json": { "dependencies": "*", @@ -15,7 +12,7 @@ }, "tasksRunnerOptions": { "default": { - "runner": "@nrwl/workspace/tasks-runners/default", + "runner": "nx/tasks-runners/default", "options": { "cacheableOperations": [ "build", diff --git a/@commitlint/config-nx-scopes/fixtures/empty/package.json b/@commitlint/config-nx-scopes/fixtures/empty/package.json index f260d8fb5e..af4f3c9f89 100644 --- a/@commitlint/config-nx-scopes/fixtures/empty/package.json +++ b/@commitlint/config-nx-scopes/fixtures/empty/package.json @@ -2,6 +2,6 @@ "name": "empty", "version": "1.0.0", "devDependencies": { - "nx": "^14.0.0" + "nx": "^16.0.0" } } \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/empty/workspace.json b/@commitlint/config-nx-scopes/fixtures/empty/workspace.json deleted file mode 100644 index 3701672da5..0000000000 --- a/@commitlint/config-nx-scopes/fixtures/empty/workspace.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": 2, - "projects": {} -} diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/nx.json b/@commitlint/config-nx-scopes/fixtures/nx14/nx.json new file mode 100644 index 0000000000..e1fda9a1e9 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/nx.json @@ -0,0 +1,39 @@ +{ + "npmScope": "secretarium", + "affected": { + "defaultBase": "main" + }, + "cli": { + "defaultCollection": "@nrwl/react" + }, + "tasksRunnerOptions": { + "default": { + "runner": "@nrwl/nx-cloud", + "options": { + "cacheableOperations": [ + "build", + "lint", + "test", + "e2e" + ] + } + } + }, + "generators": { + "@nrwl/react": { + "application": { + "style": "css", + "linter": "eslint", + "babel": true + }, + "component": { + "style": "css" + }, + "library": { + "style": "css", + "linter": "eslint" + } + } + }, + "defaultProject": "c" +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/package.json b/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/package.json new file mode 100644 index 0000000000..abd3384930 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/package.json @@ -0,0 +1,4 @@ +{ + "name": "c", + "version": "1.0.0" +} diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/project.json b/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/project.json new file mode 100644 index 0000000000..b70597129a --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/nx/c/project.json @@ -0,0 +1,29 @@ +{ + "root": "nx/c", + "sourceRoot": "nx/c/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": [ + "{options.outputFile}" + ], + "options": { + "lintFilePatterns": [ + "nx/c/**/*.ts" + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": [ + "coverage/nx/c" + ], + "options": { + "jestConfig": "nx/c/jest.config.js", + "passWithNoTests": true + } + } + }, + "tags": [] +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/package.json b/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/package.json new file mode 100644 index 0000000000..9a87c98d21 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/package.json @@ -0,0 +1,4 @@ +{ + "name": "d", + "version": "1.0.0" +} diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/project.json b/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/project.json new file mode 100644 index 0000000000..9b7a3a2d19 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/nx/d/project.json @@ -0,0 +1,29 @@ +{ + "root": "nx/d", + "sourceRoot": "nx/d/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": [ + "{options.outputFile}" + ], + "options": { + "lintFilePatterns": [ + "nx/d/**/*.ts" + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": [ + "coverage/nx/d" + ], + "options": { + "jestConfig": "nx/d/jest.config.js", + "passWithNoTests": true + } + } + }, + "tags": [] +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx14/package.json b/@commitlint/config-nx-scopes/fixtures/nx14/package.json new file mode 100644 index 0000000000..c3827cefb7 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx14/package.json @@ -0,0 +1,7 @@ +{ + "name": "basic", + "version": "1.0.0", + "devDependencies": { + "nx": "^14.0.0" + } +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/basic/workspace.json b/@commitlint/config-nx-scopes/fixtures/nx14/workspace.json similarity index 54% rename from @commitlint/config-nx-scopes/fixtures/basic/workspace.json rename to @commitlint/config-nx-scopes/fixtures/nx14/workspace.json index 81b6247b45..ba6aa2d02c 100644 --- a/@commitlint/config-nx-scopes/fixtures/basic/workspace.json +++ b/@commitlint/config-nx-scopes/fixtures/nx14/workspace.json @@ -1,7 +1,7 @@ { "version": 2, "projects": { - "a": "nx/a", - "b": "nx/b" + "c": "nx/c", + "d": "nx/d" } } \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/nx.json b/@commitlint/config-nx-scopes/fixtures/nx15/nx.json new file mode 100644 index 0000000000..3f0e9751de --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/nx.json @@ -0,0 +1,39 @@ +{ + "npmScope": "secretarium", + "affected": { + "defaultBase": "main" + }, + "cli": { + "defaultCollection": "@nrwl/react" + }, + "tasksRunnerOptions": { + "default": { + "runner": "@nrwl/nx-cloud", + "options": { + "cacheableOperations": [ + "build", + "lint", + "test", + "e2e" + ] + } + } + }, + "generators": { + "@nrwl/react": { + "application": { + "style": "css", + "linter": "eslint", + "babel": true + }, + "component": { + "style": "css" + }, + "library": { + "style": "css", + "linter": "eslint" + } + } + }, + "defaultProject": "e" +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/package.json b/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/package.json new file mode 100644 index 0000000000..f3ca19803a --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/package.json @@ -0,0 +1,4 @@ +{ + "name": "e", + "version": "1.0.0" +} diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/project.json b/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/project.json new file mode 100644 index 0000000000..08ba437419 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/nx/e/project.json @@ -0,0 +1,29 @@ +{ + "root": "nx/e", + "sourceRoot": "nx/e/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": [ + "{options.outputFile}" + ], + "options": { + "lintFilePatterns": [ + "nx/e/**/*.ts" + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": [ + "coverage/nx/e" + ], + "options": { + "jestConfig": "nx/e/jest.config.js", + "passWithNoTests": true + } + } + }, + "tags": [] +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/package.json b/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/package.json new file mode 100644 index 0000000000..64560a1558 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/package.json @@ -0,0 +1,4 @@ +{ + "name": "f", + "version": "1.0.0" +} diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/project.json b/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/project.json new file mode 100644 index 0000000000..e3fb849310 --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/nx/f/project.json @@ -0,0 +1,29 @@ +{ + "root": "nx/f", + "sourceRoot": "nx/f/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": [ + "{options.outputFile}" + ], + "options": { + "lintFilePatterns": [ + "nx/f/**/*.ts" + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": [ + "coverage/nx/f" + ], + "options": { + "jestConfig": "nx/f/jest.config.js", + "passWithNoTests": true + } + } + }, + "tags": [] +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/fixtures/nx15/package.json b/@commitlint/config-nx-scopes/fixtures/nx15/package.json new file mode 100644 index 0000000000..038809a9ed --- /dev/null +++ b/@commitlint/config-nx-scopes/fixtures/nx15/package.json @@ -0,0 +1,7 @@ +{ + "name": "basic", + "version": "1.0.0", + "devDependencies": { + "nx": "^15.0.0" + } +} \ No newline at end of file diff --git a/@commitlint/config-nx-scopes/index.test.js b/@commitlint/config-nx-scopes/index.test.js index 3acdb476b8..2650706f93 100644 --- a/@commitlint/config-nx-scopes/index.test.js +++ b/@commitlint/config-nx-scopes/index.test.js @@ -58,3 +58,19 @@ test('returns expected value for basic nx repository', async () => { const [, , value] = await fn({cwd}); expect(value).toEqual(['a', 'b']); }); + +test('expect correct result from Nx 14', async () => { + const {'scope-enum': fn} = config.rules; + const cwd = await npm.bootstrap('fixtures/nx14', __dirname); + + const [, , value] = await fn({cwd}); + expect(value).toEqual(['c', 'd']); +}); + +test('expect correct result from Nx 15', async () => { + const {'scope-enum': fn} = config.rules; + const cwd = await npm.bootstrap('fixtures/nx15', __dirname); + + const [, , value] = await fn({cwd}); + expect(value).toEqual(['e', 'f']); +}); diff --git a/@commitlint/config-nx-scopes/package.json b/@commitlint/config-nx-scopes/package.json index 890b0f1092..13aa7f0d22 100644 --- a/@commitlint/config-nx-scopes/package.json +++ b/@commitlint/config-nx-scopes/package.json @@ -1,7 +1,7 @@ { "name": "@commitlint/config-nx-scopes", "version": "17.4.3", - "description": "Shareable commitlint config enforcing nx project and workspace names as scopes", + "description": "Shareable commitlint config enforcing nx project names as scopes", "files": [ "index.js" ], @@ -27,7 +27,7 @@ }, "homepage": "https://commitlint.js.org/", "peerDependencies": { - "nx": "^14.0.0 || ^15.0.0" + "nx": "^14.0.0 || ^15.0.0 || ^16.0.0" }, "peerDependenciesMeta": { "nx": { @@ -39,8 +39,7 @@ }, "devDependencies": { "@commitlint/test": "^17.4.2", - "@commitlint/utils": "^17.4.0", - "nx": "^15.0.0" + "@commitlint/utils": "^17.4.0" }, "gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc" } diff --git a/yarn.lock b/yarn.lock index 7b794912f0..e13aee6bb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1495,13 +1495,6 @@ dependencies: nx "15.4.8" -"@nrwl/cli@15.5.0": - version "15.5.0" - resolved "https://registry.npmjs.org/@nrwl/cli/-/cli-15.5.0.tgz#c6aead1f0e6bb61264029766feb0452414a938bc" - integrity sha512-bHO0kn3pTARDCSDkNtRtGge2a08yWTW/Kjg1vBXqUUv5+Bwu7XndHi/Mfy87ZCxW78hedtQYSnNc84p5d7kYAg== - dependencies: - nx "15.5.0" - "@nrwl/devkit@>=15.4.2 < 16": version "15.4.8" resolved "https://registry.npmjs.org/@nrwl/devkit/-/devkit-15.4.8.tgz#e812285059b1ce39acd8e3b705159db280b33982" @@ -1520,13 +1513,6 @@ dependencies: nx "15.4.8" -"@nrwl/tao@15.5.0": - version "15.5.0" - resolved "https://registry.npmjs.org/@nrwl/tao/-/tao-15.5.0.tgz#efa930157ae0d53e3c262f027c9dcb74a9d01d07" - integrity sha512-50blIKmbjkd8JvUNkAe9nPYX1bTrPS1n5vUh5rLJAvShGSKfulORPmght5I6M8JhBtRgYOsqyqsB0s0LZll85A== - dependencies: - nx "15.5.0" - "@octokit/auth-token@^3.0.0": version "3.0.2" resolved "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.2.tgz#a0fc8de149fd15876e1ac78f6525c1c5ab48435f" @@ -6732,47 +6718,6 @@ nx@15.4.8, "nx@>=15.4.2 < 16": yargs "^17.6.2" yargs-parser "21.1.1" -nx@15.5.0, nx@^15.0.0: - version "15.5.0" - resolved "https://registry.npmjs.org/nx/-/nx-15.5.0.tgz#6c5da686f78472d2b56177ea24219093bd788527" - integrity sha512-N6gp339SS6YaDClY1Vpxad9OsdGyVmkXWEUpUbdm+YZw1GVCAD7MQd5jy9xU/byccTlv32eZ0/tTAfvTf+HQzA== - dependencies: - "@nrwl/cli" "15.5.0" - "@nrwl/tao" "15.5.0" - "@parcel/watcher" "2.0.4" - "@yarnpkg/lockfile" "^1.1.0" - "@yarnpkg/parsers" "^3.0.0-rc.18" - "@zkochan/js-yaml" "0.0.6" - axios "^1.0.0" - chalk "4.1.0" - cli-cursor "3.1.0" - cli-spinners "2.6.1" - cliui "^7.0.2" - dotenv "~10.0.0" - enquirer "~2.3.6" - fast-glob "3.2.7" - figures "3.2.0" - flat "^5.0.2" - fs-extra "^11.1.0" - glob "7.1.4" - ignore "^5.0.4" - js-yaml "4.1.0" - jsonc-parser "3.2.0" - lines-and-columns "~2.0.3" - minimatch "3.0.5" - npm-run-path "^4.0.1" - open "^8.4.0" - semver "7.3.4" - string-width "^4.2.3" - strong-log-transformer "^2.1.0" - tar-stream "~2.2.0" - tmp "~0.2.1" - tsconfig-paths "^4.1.2" - tslib "^2.3.0" - v8-compile-cache "2.3.0" - yargs "^17.6.2" - yargs-parser "21.1.1" - object-inspect@^1.12.2, object-inspect@^1.12.3, object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9"