Skip to content

Commit

Permalink
feat(config-nx-scopes): support latest nx version (#3728)
Browse files Browse the repository at this point in the history
* fix(commitlint-config-nx-scopes): support nx version 17

updated peer dependencies to support nx version 17

* refactor(commitlint-config-nx-scopes): follow package name convention

renamed packages in fixtures to follow the subsequent name convention
  • Loading branch information
clemenscodes committed Oct 26, 2023
1 parent dcc0424 commit 22e6f74
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 1 deletion.
38 changes: 38 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"affected": {
"defaultBase": "main"
},
"cli": {
"defaultCollection": "@nx/react"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
]
}
}
},
"generators": {
"@nx/react": {
"application": {
"style": "css",
"linter": "eslint",
"babel": true
},
"component": {
"style": "css"
},
"library": {
"style": "css",
"linter": "eslint"
}
}
},
"defaultProject": "g"
}
4 changes: 4 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/nx/g/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "g",
"version": "1.0.0"
}
29 changes: 29 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/nx/g/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"root": "nx/g",
"sourceRoot": "nx/g/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"nx/g/**/*.ts"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"coverage/nx/g"
],
"options": {
"jestConfig": "nx/g/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}
4 changes: 4 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/nx/h/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "h",
"version": "1.0.0"
}
29 changes: 29 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/nx/h/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"root": "nx/h",
"sourceRoot": "nx/h/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"nx/h/**/*.ts"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"coverage/nx/h"
],
"options": {
"jestConfig": "nx/h/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}
7 changes: 7 additions & 0 deletions @commitlint/config-nx-scopes/fixtures/nx17/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "basic",
"version": "1.0.0",
"devDependencies": {
"nx": "^17.0.0"
}
}
8 changes: 8 additions & 0 deletions @commitlint/config-nx-scopes/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ test('expect correct result from Nx 15', async () => {
const [, , value] = await fn({cwd});
expect(value).toEqual(['e', 'f']);
});

test('expect correct result from Nx 17', async () => {
const {'scope-enum': fn} = config.rules;
const cwd = await npm.bootstrap('fixtures/nx17', __dirname);

const [, , value] = await fn({cwd});
expect(value).toEqual(['g', 'h']);
});
2 changes: 1 addition & 1 deletion @commitlint/config-nx-scopes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"homepage": "https://commitlint.js.org/",
"peerDependencies": {
"nx": "^14.0.0 || ^15.0.0 || ^16.0.0"
"nx": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"peerDependenciesMeta": {
"nx": {
Expand Down

0 comments on commit 22e6f74

Please sign in to comment.