Skip to content

Commit

Permalink
Nx 15 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvieirasilva committed Jan 9, 2023
1 parent f144494 commit 47359e9
Show file tree
Hide file tree
Showing 30 changed files with 9,880 additions and 17,597 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
},
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.validate": ["json"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'nx-python-e2e',
preset: '../../jest.preset.js',
globals: {
Expand Down
5 changes: 3 additions & 2 deletions e2e/nx-python-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"root": "e2e/nx-python-e2e",
"name": "nx-python-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/nx-python-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "nx-python:build",
"jestConfig": "e2e/nx-python-e2e/jest.config.js"
"jestConfig": "e2e/nx-python-e2e/jest.config.ts"
}
}
},
Expand Down
18 changes: 9 additions & 9 deletions e2e/nx-python-e2e/tests/nx-python.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ describe('nx-python e2e', () => {
it('should create nx-python project', async () => {
const app1 = 'app1';
const lib1 = 'lib1';
ensureNxProject('@nxlv/nx-python', 'dist/packages/nx-python');
ensureNxProject('@nxlv/python', 'dist/packages/nx-python');

const nxJson = readJson('nx.json');
nxJson.plugins = ['@nxlv/nx-python'];
nxJson.plugins = ['@nxlv/python'];

updateFile('nx.json', JSON.stringify(nxJson, null, 4));

await runNxCommandAsync(
`generate @nxlv/nx-python:project ${app1} --type "application" --packageName ${app1} --description ${app1}`
`generate @nxlv/python:project ${app1} --type "application" --packageName ${app1} --description ${app1}`
);

await runNxCommandAsync(
`generate @nxlv/nx-python:project ${lib1} --type "library" --packageName ${lib1} --description ${lib1}`
`generate @nxlv/python:project ${lib1} --type "library" --packageName ${lib1} --description ${lib1}`
);

await runNxCommandAsync(`run ${app1}:add --name ${lib1} --local`);
Expand All @@ -45,23 +45,23 @@ describe('nx-python e2e', () => {
const lib1 = 'lib1';
const lib2 = 'lib2';

ensureNxProject('@nxlv/nx-python', 'dist/packages/nx-python');
ensureNxProject('@nxlv/python', 'dist/packages/nx-python');

const nxJson = readJson('nx.json');
nxJson.plugins = ['@nxlv/nx-python'];
nxJson.plugins = ['@nxlv/python'];

updateFile('nx.json', JSON.stringify(nxJson, null, 4));

await runNxCommandAsync(
`generate @nxlv/nx-python:project ${app1} --type "application" --packageName ${app1} --description ${app1}`
`generate @nxlv/python:project ${app1} --type "application" --packageName ${app1} --description ${app1}`
);

await runNxCommandAsync(
`generate @nxlv/nx-python:project ${lib1} --type "library" --packageName ${lib1} --description ${lib1}`
`generate @nxlv/python:project ${lib1} --type "library" --packageName ${lib1} --description ${lib1}`
);

await runNxCommandAsync(
`generate @nxlv/nx-python:project ${lib2} --type "library" --packageName ${lib2} --description ${lib2}`
`generate @nxlv/python:project ${lib2} --type "library" --packageName ${lib2} --description ${lib2}`
);

await runNxCommandAsync(`run ${lib1}:add --name ${lib2} --local`);
Expand Down
3 changes: 0 additions & 3 deletions e2e/nx-python-e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
},
{
"path": "./tsconfig.spec.json"
}
Expand Down
7 changes: 6 additions & 1 deletion e2e/nx-python-e2e/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';

export default {
projects: getJestProjects(),
};
2 changes: 1 addition & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');
const nxPreset = require('@nrwl/jest/preset').default;

module.exports = { ...nxPreset };
42 changes: 14 additions & 28 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
{
"npmScope": "lucasvieira",
"affected": {
"defaultBase": "main"
},
"cli": {
"defaultCollection": "@nrwl/workspace"
},
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": "*"
},
".eslintrc.json": "*"
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "@nxlv/nx-plugins",
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
]
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
},
"test": {
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"]
}
},
"workspaceLayout": {
"appsDir": "e2e",
Expand Down
Loading

0 comments on commit 47359e9

Please sign in to comment.