Skip to content

Commit

Permalink
Merge pull request #115 from srleecode/16.10
Browse files Browse the repository at this point in the history
16.10
  • Loading branch information
srleecode authored Oct 18, 2023
2 parents e0c0229 + ff8eb63 commit 86cf639
Show file tree
Hide file tree
Showing 40 changed files with 1,420 additions and 1,018 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Angular domain libraries

Other:

- domainTest - creates a project in a grouping folder for E2E tests related to that grouping folder. By default, E2E projects are created as applications. This generator moves the created E2E cypress project into the grouping folder. For example, if you run this generator in the shared/table domain grouping folder it will create a folder \_e2e. This will create a project called: e2e-shared-table which would have the default e2e tas and hold the cypress specifc config including test specs.
- domainTest - creates a project in a grouping folder for E2E tests related to that grouping folder. By default, E2E projects are created as applications. This generator moves the created E2E cypress project into the grouping folder. For example, if you run this generator in the shared/table domain grouping folder it will create a folder \.e2e. This will create a project called: e2e-shared-table which would have the default e2e tas and hold the cypress specifc config including test specs.
- mockFile - the naive approach of using mock files in your tests involves exporting them in the index.ts. This will cause the mock files to be included in the build output. As mock files are only used in the tests, this makes the build output larger than neccessary. This generator creates a seperate tsconfig path for the mock files which allows them to be imported into other libraies and not be included in the build output

## tags
Expand Down
1 change: 0 additions & 1 deletion e2e/domain/cypress/domain-test/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
testEnvironment: 'node',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
preset: '../../../../jest.preset.js',
testSequencer: './test-sequencer.js',
setupFilesAfterEnv: ['./jest.setup.ts'],
maxWorkers: 1,
};
29 changes: 17 additions & 12 deletions e2e/domain/cypress/domain-test/src/domain-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@ describe('domainTest e2e', () => {
createProject();
await runNxCommandAsync(`generate @srleecode/domain:ng-add`);
await runNxCommandAsync(
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`
);
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`,
{ silenceError: true }
).then((rsp) => console.log(rsp));

await runNxCommandAsync(
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`
);
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
}, 240000);

it('should create e2e project for domain', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:domainTest --groupingFolder ${groupingFolder}`
);
checkFilesExist(`${groupingFolder}/_e2e/cypress.config.ts`);
checkFilesExist(`${groupingFolder}/_e2e/project.json`);
`generate @srleecode/domain:domainTest --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/.e2e/cypress.config.ts`);
checkFilesExist(`${groupingFolder}/.e2e/project.json`);
});
it('should create ct project for domain', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:domainTest --groupingFolder ${groupingFolder} --type ct`
);
checkFilesExist(`${groupingFolder}/_ct/cypress.config.ts`);
checkFilesExist(`${groupingFolder}/_ct/project.json`);
`generate @srleecode/domain:domainTest --groupingFolder ${groupingFolder} --type ct`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/.ct/cypress.config.ts`);
checkFilesExist(`${groupingFolder}/.ct/project.json`);
});
});
18 changes: 0 additions & 18 deletions e2e/domain/cypress/domain-test/test-sequencer.js

This file was deleted.

20 changes: 9 additions & 11 deletions e2e/domain/front-end/angular/src/application-layer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { logger } from '@nx/devkit';
import { createProject } from '../../../utils/util';
import { checkFilesExist, runNxCommandAsync } from '@nx/plugin/testing';

Expand All @@ -8,21 +7,20 @@ describe('application-layer', () => {
createProject();
await runNxCommandAsync(`generate @srleecode/domain:ng-add`);
await runNxCommandAsync(
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`
);
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
await runNxCommandAsync(
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`
);
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
}, 240000);

it('should create application layer library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngApplicationLayer --groupingFolder ${groupingFolder}`
).catch((e) => {
logger.error(e.message);
logger.error(e.stack);
throw e;
});
`generate @srleecode/domain:ngApplicationLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/application/src/index.ts`);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ describe('component', () => {

it('should create ui component library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngComponent --groupingFolder ${groupingFolder} --type ui --name test-example`
);
`generate @srleecode/domain:ngComponent --groupingFolder ${groupingFolder} --type ui --name test-example`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(
`${groupingFolder}/presentation/src/lib/ui/test-example/test-example.component.ts`
);
Expand Down
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/data-access-layer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('data-access-layer', () => {

it('should create data access layer library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngDataAccessLayer --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:ngDataAccessLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/data-access/src/index.ts`);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('directive', () => {

it('should create directive library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngDirective --groupingFolder ${groupingFolder} --name test-example`
);
`generate @srleecode/domain:ngDirective --groupingFolder ${groupingFolder} --name test-example`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(
`${groupingFolder}/presentation/src/lib/directive/test-example/test-example.directive.ts`
);
Expand Down
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/domain-layer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('domain-layer', () => {

it('should create domain layer library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngDomainLayer --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:ngDomainLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/domain/src/index.ts`);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/infrastructure-layer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('infrastructure-layer', () => {

it('should create infrastructure layer library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngInfrastructureLayer --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:ngInfrastructureLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/infrastructure/src/index.ts`);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/remove-library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('remove-library', () => {

it('should remove domain library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngRemoveLibrary --libraryFolder ${libraryFolder}`
);
`generate @srleecode/domain:ngRemoveLibrary --libraryFolder ${libraryFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
expect(fileExists(`${libraryFolder}/src/index.ts`)).toBe(false);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/front-end/angular/src/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ describe('util', () => {

it('should create util library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:ngUtilLayer --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:ngUtilLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/util/src/index.ts`);
});
});
5 changes: 3 additions & 2 deletions e2e/domain/grouping-folder/src/app-grouping-folder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ describe('app grouping folder', () => {

it('should create directory with language prefixed to name', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`
);
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist('libs/ng-test-app');
});
});
5 changes: 3 additions & 2 deletions e2e/domain/grouping-folder/src/domain-grouping-folder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { checkFilesExist, runNxCommandAsync } from '@nx/plugin/testing';
describe('domain grouping folder', () => {
it('should create directory', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`
);
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist('libs/ng-test-app/test-domain');
});
});
10 changes: 6 additions & 4 deletions e2e/domain/grouping-folder/src/move.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ describe('move', () => {
`generate @srleecode/domain:ngUtilLayer --groupingFolder ${groupingFolder}`
);
await runNxCommandAsync(
`generate @srleecode/domain:mockFile --projectName ng-test-app-test-domain-util --mockFileName test-example`
);
`generate @srleecode/domain:mockFile --projectName ng-test-app-test-domain-util --mockFileName test-example`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
await runNxCommandAsync(
`generate @srleecode/domain:moveGroupingFolder --groupingFolder ${groupingFolder} --destination ${movedDomainGroupingFolder}`
);
`generate @srleecode/domain:moveGroupingFolder --groupingFolder ${groupingFolder} --destination ${movedDomainGroupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
}, 240000);

it('should move domain grouping folder', async () => {
Expand Down
5 changes: 3 additions & 2 deletions e2e/domain/grouping-folder/src/remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ describe('remove', () => {
const groupingFolder = 'libs/ng-test-app/new-domain';
beforeAll(async () => {
await runNxCommandAsync(
`generate @srleecode/domain:removeGroupingFolder --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:removeGroupingFolder --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
}, 240000);

it('should remove domain grouping folder', async () => {
Expand Down
20 changes: 12 additions & 8 deletions e2e/domain/mock-file/src/mock-file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ describe('mockFile e2e', () => {
createProject();
await runNxCommandAsync(`generate @srleecode/domain:ng-add`);
await runNxCommandAsync(
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`
);
`generate @srleecode/domain:appGroupingFolder --name test-app --applicationType ng`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
await runNxCommandAsync(
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`
);
`generate @srleecode/domain:domainGroupingFolder --name test-domain --groupingFolder libs/ng-test-app`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
await runNxCommandAsync(
`generate @srleecode/domain:ngUtilLayer --groupingFolder ${groupingFolder}`
);
`generate @srleecode/domain:ngUtilLayer --groupingFolder ${groupingFolder}`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
}, 240000);

it('should add mock file to domain library', async () => {
await runNxCommandAsync(
`generate @srleecode/domain:mockFile --projectName ng-test-app-test-domain-util --mockFileName test-example`
);
`generate @srleecode/domain:mockFile --projectName ng-test-app-test-domain-util --mockFileName test-example`,
{ silenceError: true }
).then((rsp) => console.log(rsp));
checkFilesExist(`${groupingFolder}/util/src/testing.ts`);
});
});
21 changes: 13 additions & 8 deletions migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
"migrations": [
{
"cli": "nx",
"version": "16.7.0-beta.6",
"requires": {
"@angular/core": ">=16.2.0"
},
"description": "Update the @angular/cli package version to ~16.2.0.",
"factory": "./src/migrations/update-16-7-0/update-angular-cli",
"package": "@nx/angular",
"name": "update-angular-cli-version-16-2-0"
"version": "16.9.0-beta.1",
"description": "Replace imports of Module Federation utils frm @nx/devkit to @nx/webpack",
"implementation": "./src/migrations/update-16-9-0/migrate-mf-util-usage",
"package": "@nx/devkit",
"name": "update-16-9-0-migrate-mf-usage-to-webpack"
},
{
"cli": "nx",
"version": "16.8.2-beta.0",
"description": "Remove invalid options (strict, noInterop) for ES6 type modules.",
"factory": "./src/migrations/update-16-8-2/update-swcrc",
"package": "@nx/js",
"name": "16-8-2-update-swcrc"
}
]
}
Loading

0 comments on commit 86cf639

Please sign in to comment.