Skip to content

Commit ba85e71

Browse files
committed
feat: add nx plugin for ng add
1 parent 20ad0e0 commit ba85e71

27 files changed

+1431
-145
lines changed

.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
"jest": true
3838
},
3939
"rules": {}
40+
},
41+
{
42+
"files": "*.json",
43+
"parser": "jsonc-eslint-parser",
44+
"rules": {}
4045
}
4146
]
4247
}

.release-it.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"releaseName": "Release ${version}"
4141
},
4242
"hooks": {
43-
"before:bump": "npx nx build angular-three",
43+
"before:bump": "npx nx package angular-three",
4444
"after:bump": ["git checkout -- package.json"]
4545
}
4646
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.validate": ["json"]
3+
}

apps/plugin-e2e/jest.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'plugin-e2e',
4+
preset: '../../jest.preset.js',
5+
globals: {
6+
'ts-jest': {
7+
tsconfig: '<rootDir>/tsconfig.spec.json',
8+
},
9+
},
10+
transform: {
11+
'^.+\\.[tj]s$': 'ts-jest',
12+
},
13+
moduleFileExtensions: ['ts', 'js', 'html'],
14+
coverageDirectory: '../../coverage/apps/plugin-e2e',
15+
};

apps/plugin-e2e/project.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "angular-three-plugin-e2e",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/plugin-e2e/src",
6+
"targets": {
7+
"e2e": {
8+
"executor": "@nrwl/nx-plugin:e2e",
9+
"options": {
10+
"target": "plugin:build",
11+
"jestConfig": "apps/plugin-e2e/jest.config.ts"
12+
}
13+
}
14+
},
15+
"tags": [],
16+
"implicitDependencies": ["angular-three-plugin"]
17+
}

apps/plugin-e2e/tests/plugin.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ensureNxProject, runNxCommandAsync } from '@nrwl/nx-plugin/testing';
2+
3+
describe('plugin e2e', () => {
4+
// Setting up individual workspaces per
5+
// test can cause e2e runs to take a long time.
6+
// For this reason, we recommend each suite only
7+
// consumes 1 workspace. The tests should each operate
8+
// on a unique project in the workspace, such that they
9+
// are not dependant on one another.
10+
beforeAll(() => {
11+
ensureNxProject('@angular-three/plugin', 'dist/libs/plugin');
12+
});
13+
14+
afterAll(() => {
15+
// `nx reset` kills the daemon, and performs
16+
// some work which can help clean up e2e leftovers
17+
runNxCommandAsync('reset');
18+
});
19+
});

apps/plugin-e2e/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{
7+
"path": "./tsconfig.spec.json"
8+
}
9+
]
10+
}

apps/plugin-e2e/tsconfig.spec.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["jest", "node"]
7+
},
8+
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
9+
}

libs/angular-three/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@
3030
"@rx-angular/state": "^1.7.0",
3131
"tslib": "^2.3.0"
3232
},
33-
"sideEffects": false
33+
"sideEffects": false,
34+
"generators": "./plugin/generators.json",
35+
"schematics": "./plugin/generators.json"
3436
}

libs/angular-three/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
},
2222
"defaultConfiguration": "production"
2323
},
24+
"package": {
25+
"executor": "nx:run-commands",
26+
"options": {
27+
"commands": ["npx nx build angular-three", "npx nx build angular-three-plugin"],
28+
"parallel": false
29+
}
30+
},
2431
"test": {
2532
"executor": "@nrwl/jest:jest",
2633
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],

0 commit comments

Comments
 (0)