Skip to content

Commit 869f95f

Browse files
committed
feat(domain): support standalone components
1 parent 0d145cd commit 869f95f

File tree

97 files changed

+3344
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3344
-290
lines changed

.eslintrc.json

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,46 @@
1313
"allow": [],
1414
"depConstraints": [
1515
{
16-
"sourceTag": "*",
17-
"onlyDependOnLibsWithTags": ["*"]
16+
"sourceTag": "type:app",
17+
"onlyDependOnLibsWithTags": [
18+
"type:api",
19+
"type:feature",
20+
"type:ui",
21+
"type:domain-logic",
22+
"type:util"
23+
]
24+
},
25+
{
26+
"sourceTag": "type:api",
27+
"onlyDependOnLibsWithTags": [
28+
"type:ui",
29+
"type:domain-logic",
30+
"type:util"
31+
]
32+
},
33+
{
34+
"sourceTag": "type:feature",
35+
"onlyDependOnLibsWithTags": [
36+
"type:ui",
37+
"type:domain-logic",
38+
"type:util"
39+
]
40+
},
41+
{
42+
"sourceTag": "type:ui",
43+
"onlyDependOnLibsWithTags": ["type:domain-logic", "type:util"]
44+
},
45+
{
46+
"sourceTag": "type:domain-logic",
47+
"onlyDependOnLibsWithTags": ["type:util"]
48+
},
49+
{
50+
"sourceTag": "domain:shared",
51+
"onlyDependOnLibsWithTags": ["domain:shared"]
52+
},
53+
{
54+
"sourceTag": "domain:luggage",
55+
"onlyDependOnLibsWithTags": ["domain:luggage", "domain:shared"]
1856
}
1957
]
2058
}
@@ -30,6 +68,11 @@
3068
"files": ["*.js", "*.jsx"],
3169
"extends": ["plugin:@nrwl/nx/javascript"],
3270
"rules": {}
71+
},
72+
{
73+
"files": "*.json",
74+
"parser": "jsonc-eslint-parser",
75+
"rules": {}
3376
}
3477
]
3578
}

.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+
}

angular.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"$schema": "./node_modules/nx/schemas/workspace-schema.json",
33
"version": 2,
44
"projects": {
5+
"ddd": "libs/ddd",
6+
"ddd-e2e": "apps/ddd-e2e",
57
"demo-app": "apps/demo-app",
68
"demo-app-e2e": "apps/demo-app-e2e"
79
}

apps/ddd-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: 'ddd-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/ddd-e2e',
15+
};

apps/ddd-e2e/project.json

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

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {
2+
checkFilesExist,
3+
ensureNxProject,
4+
readJson,
5+
runNxCommandAsync,
6+
uniq,
7+
} from '@nrwl/nx-plugin/testing';
8+
9+
describe('ddd e2e', () => {
10+
// Setting up individual workspaces per
11+
// test can cause e2e runs to take a long time.
12+
// For this reason, we recommend each suite only
13+
// consumes 1 workspace. The tests should each operate
14+
// on a unique project in the workspace, such that they
15+
// are not dependant on one another.
16+
beforeAll(() => {
17+
ensureNxProject('@ddd-plugin/ddd', 'dist/libs/ddd');
18+
});
19+
20+
afterAll(() => {
21+
// `nx reset` kills the daemon, and performs
22+
// some work which can help clean up e2e leftovers
23+
runNxCommandAsync('reset');
24+
});
25+
26+
it('should create ddd', async () => {
27+
const project = uniq('ddd');
28+
await runNxCommandAsync(`generate @ddd-plugin/ddd:ddd ${project}`);
29+
const result = await runNxCommandAsync(`build ${project}`);
30+
expect(result.stdout).toContain('Executor ran');
31+
}, 120000);
32+
33+
describe('--directory', () => {
34+
it('should create src in the specified directory', async () => {
35+
const project = uniq('ddd');
36+
await runNxCommandAsync(
37+
`generate @ddd-plugin/ddd:ddd ${project} --directory subdir`
38+
);
39+
expect(() =>
40+
checkFilesExist(`libs/subdir/${project}/src/index.ts`)
41+
).not.toThrow();
42+
}, 120000);
43+
});
44+
45+
describe('--tags', () => {
46+
it('should add tags to the project', async () => {
47+
const projectName = uniq('ddd');
48+
ensureNxProject('@ddd-plugin/ddd', 'dist/libs/ddd');
49+
await runNxCommandAsync(
50+
`generate @ddd-plugin/ddd:ddd ${projectName} --tags e2etag,e2ePackage`
51+
);
52+
const project = readJson(`libs/${projectName}/project.json`);
53+
expect(project.tags).toEqual(['e2etag', 'e2ePackage']);
54+
}, 120000);
55+
});
56+
});

apps/ddd-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/ddd-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", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
9+
}

libs/ddd/.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
},
17+
{
18+
"files": ["./package.json", "./generators.json", "./executors.json"],
19+
"parser": "jsonc-eslint-parser",
20+
"rules": {
21+
"@nrwl/nx/nx-plugin-checks": "error"
22+
}
23+
}
24+
]
25+
}

libs/ddd/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ddd
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Building
6+
7+
Run `nx build ddd` to build the library.
8+
9+
## Running unit tests
10+
11+
Run `nx test ddd` to execute the unit tests via [Jest](https://jestjs.io).

0 commit comments

Comments
 (0)