Fixes and adjustments to demo

This commit is contained in:
Toni Koskinen
2026-03-27 10:37:42 +02:00
parent 51a4b84476
commit 4de890ba77
44 changed files with 1076 additions and 104 deletions

11
libs/shared-dto/README.md Normal file
View File

@@ -0,0 +1,11 @@
# shared-dto
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build shared-dto` to build the library.
## Running unit tests
Run `nx test shared-dto` to execute the unit tests via [Jest](https://jestjs.io).

View File

@@ -0,0 +1,19 @@
import baseConfig from '../../eslint.config.mjs';
export default [
...baseConfig,
{
files: ['**/*.json'],
rules: {
'@nx/dependency-checks': [
'error',
{
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
},
],
},
languageOptions: {
parser: await import('jsonc-eslint-parser'),
},
},
];

View File

@@ -0,0 +1,10 @@
module.exports = {
displayName: 'shared-dto',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/shared-dto',
};

View File

@@ -0,0 +1,9 @@
{
"name": "shared-dto",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared-dto/src",
"projectType": "library",
"tags": [],
"targets": {
}
}

View File

@@ -0,0 +1 @@
export * from './lib/shared-dto';

View File

@@ -0,0 +1,7 @@
import { sharedDto } from './shared-dto';
describe('sharedDto', () => {
it('should work', () => {
expect(sharedDto()).toEqual('shared-dto');
});
});

View File

@@ -0,0 +1,9 @@
import { Post } from '@shared/prisma-generated/src/types';
export function sharedDto(): string {
return 'shared-dto';
}
export type PostDto = Omit<Post, 'id' | 'createdAt' | 'updatedAt'>;
export type UpdatePostDto = Partial<PostDto>;

View File

@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"importHelpers": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": [
"jest.config.ts",
"jest.config.cts",
"src/**/*.spec.ts",
"src/**/*.test.ts"
]
}

View File

@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"moduleResolution": "node10",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"jest.config.cts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}