Skip to content

Commit 9b9c2db

Browse files
committed
feat(modular): adding new plugin modular
1 parent 35b6b8e commit 9b9c2db

Some content is hidden

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

56 files changed

+1491
-48
lines changed

DEVELOPMENT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ lerna init --independent
1111
yarn config set workspaces-experimental true
1212
# adding new plugin
1313
nx g @nrwl/nx-plugin:plugin [pluginName]
14+
# example:
15+
nx g @nrwl/nx-plugin:plugin ddd -d
16+
nx g @nrwl/nx-plugin:plugin modular -d
1417
```
1518

1619
When you change any schematics's `schema.json`, run the following command to generate `schema.d.ts`

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Plugins for [Nx](https://nx.dev) Workspace.
1515

1616
## Projects
1717

18-
| Status | Project | Description |
19-
| :----: | -------------------------- | ------------------------------------------------------------- |
20-
| 🗄 | [DDD](./libs/ddd/) | Nx plugin for structuring a monorepo with domains and layers. |
21-
| 📦 | [Modular](./libs/modular/) | Nx plugin for for structuring a monorepo into grouped Modules |
18+
| Status | Project | Description |
19+
| :----: | -------------------------- | -------------------------------------------------------------- |
20+
| 🗄 | [DDD](./libs/ddd/) | Nx plugin for structuring a monorepo with domains and layers. |
21+
| 📦 | [Modular](./libs/modular/) | Nx plugin for for structuring a monorepo into grouped Modules. |
2222

2323
## Documentation
2424

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

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {
2-
checkFilesExist,
3-
ensureNxProject,
4-
readJson,
5-
runNxCommandAsync,
6-
uniq
7-
} from '@nrwl/nx-plugin/testing';
1+
import { checkFilesExist, ensureNxProject, readJson, runNxCommandAsync, uniq } from '@nrwl/nx-plugin/testing';
82
describe('ddd e2e', () => {
9-
it('should create ddd', async done => {
3+
it('should create ddd', async (done) => {
104
const plugin = uniq('ddd');
115
ensureNxProject('@xmlking/nxp-ddd', 'dist/libs/ddd');
126
await runNxCommandAsync(`generate @xmlking/nxp-ddd:domain ${plugin}`);
@@ -18,26 +12,20 @@ describe('ddd e2e', () => {
1812
});
1913

2014
describe('--directory', () => {
21-
it('should create src in the specified directory', async done => {
15+
it('should create src in the specified directory', async (done) => {
2216
const plugin = uniq('ddd');
2317
ensureNxProject('@xmlking/nxp-ddd', 'dist/libs/ddd');
24-
await runNxCommandAsync(
25-
`generate @xmlking/nxp-ddd:domain ${plugin} --platform web`
26-
);
27-
expect(() =>
28-
checkFilesExist(`libs/${plugin}/domain/src/index.ts`)
29-
).not.toThrow();
18+
await runNxCommandAsync(`generate @xmlking/nxp-ddd:domain ${plugin} --platform web`);
19+
expect(() => checkFilesExist(`libs/${plugin}/domain/src/index.ts`)).not.toThrow();
3020
done();
3121
});
3222
});
3323

3424
describe('--lazy', () => {
35-
it('should add tags to nx.json', async done => {
25+
it('should add tags to nx.json', async (done) => {
3626
const plugin = uniq('ddd');
3727
ensureNxProject('@xmlking/nxp-ddd', 'dist/libs/ddd');
38-
await runNxCommandAsync(
39-
`generate @xmlking/nxp-ddd:domain ${plugin} --lazy`
40-
);
28+
await runNxCommandAsync(`generate @xmlking/nxp-ddd:domain ${plugin} --lazy`);
4129
const nxJson = readJson('nx.json');
4230
expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']);
4331
done();

apps/modular-e2e/jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
name: 'modular-e2e',
3+
preset: '../../jest.config.js',
4+
coverageDirectory: '../../coverage/apps/modular-e2e',
5+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { checkFilesExist, ensureNxProject, readJson, runNxCommandAsync, uniq } from '@nrwl/nx-plugin/testing';
2+
describe('modular e2e', () => {
3+
it('should create modular', async (done) => {
4+
const plugin = uniq('modular');
5+
ensureNxProject('@xmlking/nxp-modular', 'dist/libs/modular');
6+
await runNxCommandAsync(`generate @xmlking/nxp-modular:domain ${plugin}`);
7+
8+
const result = await runNxCommandAsync(`build ${plugin}`);
9+
expect(result.stdout).toContain('Builder ran');
10+
11+
done();
12+
});
13+
14+
describe('--directory', () => {
15+
it('should create src in the specified directory', async (done) => {
16+
const plugin = uniq('modular');
17+
ensureNxProject('@xmlking/nxp-modular', 'dist/libs/modular');
18+
await runNxCommandAsync(`generate @xmlking/nxp-modular:domain ${plugin} --platform web`);
19+
expect(() => checkFilesExist(`libs/${plugin}/domain/src/index.ts`)).not.toThrow();
20+
done();
21+
});
22+
});
23+
24+
describe('--lazy', () => {
25+
it('should add tags to nx.json', async (done) => {
26+
const plugin = uniq('modular');
27+
ensureNxProject('@xmlking/nxp-modular', 'dist/libs/modular');
28+
await runNxCommandAsync(`generate @xmlking/nxp-modular:domain ${plugin} --lazy`);
29+
const nxJson = readJson('nx.json');
30+
expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']);
31+
done();
32+
});
33+
});
34+
});

apps/modular-e2e/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"types": ["node", "jest"]
5+
},
6+
"include": ["**/*.ts"]
7+
}
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": ["**/*.spec.ts", "**/*.d.ts"]
9+
}

libs/ddd/.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
// { "extends": "../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] }
2-
{ "extends": "../../.eslintrc", "rules": {} }
2+
{
3+
"extends": "../../.eslintrc",
4+
"rules": {}
5+
}

libs/ddd/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module.exports = {
22
name: 'ddd',
33
preset: '../../jest.config.js',
44
transform: {
5-
'^.+\\.[tj]sx?$': 'ts-jest'
5+
'^.+\\.[tj]sx?$': 'ts-jest',
66
},
77
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
8-
coverageDirectory: '../../coverage/libs/ddd'
8+
coverageDirectory: '../../coverage/libs/ddd',
99
};

libs/ddd/src/builders/ddd/builder.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ describe('Command Runner Builder', () => {
2424

2525
it('can run', async () => {
2626
// A "run" can have multiple outputs, and contains progress information.
27-
const run = await architect.scheduleBuilder(
28-
'@xmlking/nxp-ddd:build',
29-
options
30-
);
27+
const run = await architect.scheduleBuilder('@xmlking/nxp-ddd:build', options);
3128
// The "result" member (of type BuilderOutput) is the next output.
3229
const output = await run.result;
3330

0 commit comments

Comments
 (0)