diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 96b093c..c01529f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,4 +30,4 @@ jobs: # run: npx nx affected --target=test --configuration=ci --parallel --base=remotes/origin/${{ inputs.base }} --head=${{ inputs.head }} - name: E2E Test - run: npm nx run nx-angular-mf-e2e:e2e + run: npx nx run nx-angular-mf-e2e:e2e diff --git a/.gitignore b/.gitignore index 36efcdd..ba461d1 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ Thumbs.db .nx/workspace-data .angular +.cursor/rules/nx-rules.mdc +.github/instructions/nx.instructions.md diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 6a302fe..cbbc2f7 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,6 @@ "nrwl.angular-console", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", - "firsttris.vscode-jest-runner" + "vitest.explorer" ] } diff --git a/README.md b/README.md index 922aad7..2947538 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # @klerick/nx-angular-mf - [Readme about lib](./libs/nx-angular-mf/README.md) +- [Article about this project](https://dev.to/klerick/custom-builder-for-angular-my-way-12hd) ## Local Development diff --git a/apps/host-application/jest.config.ts b/apps/host-application/jest.config.ts deleted file mode 100644 index 96fec8f..0000000 --- a/apps/host-application/jest.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -export default { - displayName: 'host-application', - preset: '../../jest.preset.js', - setupFilesAfterEnv: ['/src/test-setup.ts'], - coverageDirectory: '../../coverage/apps/host-application', - transform: { - '^.+\\.(ts|mjs|js|html)$': [ - 'jest-preset-angular', - { - tsconfig: '/tsconfig.spec.json', - stringifyContentPathRegex: '\\.(html|svg)$', - }, - ], - }, - transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], - snapshotSerializers: [ - 'jest-preset-angular/build/serializers/no-ng-attributes', - 'jest-preset-angular/build/serializers/ng-snapshot', - 'jest-preset-angular/build/serializers/html-comment', - ], -}; diff --git a/apps/host-application/project.json b/apps/host-application/project.json index 4280b89..7da5032 100644 --- a/apps/host-application/project.json +++ b/apps/host-application/project.json @@ -68,6 +68,9 @@ "serve": { "dependsOn": ["^build"], "executor": "./dist/libs/nx-angular-mf:serve", + "options": { + "port": 4200 + }, "configurations": { "production": { "buildTarget": "host-application:build:production" @@ -88,10 +91,10 @@ "executor": "@nx/eslint:lint" }, "test": { - "executor": "@nx/jest:jest", + "executor": "nx:run-commands", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/host-application/jest.config.ts" + "command": "vitest run --config apps/host-application/vitest.config.ts" } }, "build-static": { diff --git a/apps/host-application/src/app/app.config.server.ts b/apps/host-application/src/app/app.config.server.ts index d5c4490..608887d 100644 --- a/apps/host-application/src/app/app.config.server.ts +++ b/apps/host-application/src/app/app.config.server.ts @@ -1,14 +1,10 @@ import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; -import { provideServerRendering } from '@angular/platform-server'; -import { provideServerRoutesConfig } from '@angular/ssr'; +import { provideServerRendering, withRoutes } from '@angular/ssr'; import { appConfig } from './app.config'; import { serverRoutes } from './app.routes.server'; const serverConfig: ApplicationConfig = { - providers: [ - provideServerRendering(), - provideServerRoutesConfig(serverRoutes), - ], + providers: [provideServerRendering(withRoutes(serverRoutes))], }; export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/apps/host-application/src/app/nx-welcome.component.ts b/apps/host-application/src/app/nx-welcome.component.ts index b37a99d..c92ed59 100644 --- a/apps/host-application/src/app/nx-welcome.component.ts +++ b/apps/host-application/src/app/nx-welcome.component.ts @@ -1,9 +1,9 @@ import { Component, ViewEncapsulation } from '@angular/core'; -import { CommonModule } from '@angular/common'; + @Component({ selector: 'app-nx-welcome', - imports: [CommonModule], + imports: [], template: `