Fixes and adjustments to demo
This commit is contained in:
11
libs/shared-dto/README.md
Normal file
11
libs/shared-dto/README.md
Normal 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).
|
||||
19
libs/shared-dto/eslint.config.mjs
Normal file
19
libs/shared-dto/eslint.config.mjs
Normal 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'),
|
||||
},
|
||||
},
|
||||
];
|
||||
10
libs/shared-dto/jest.config.cts
Normal file
10
libs/shared-dto/jest.config.cts
Normal 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',
|
||||
};
|
||||
9
libs/shared-dto/project.json
Normal file
9
libs/shared-dto/project.json
Normal 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": {
|
||||
}
|
||||
}
|
||||
1
libs/shared-dto/src/index.ts
Normal file
1
libs/shared-dto/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/shared-dto';
|
||||
7
libs/shared-dto/src/lib/shared-dto.spec.ts
Normal file
7
libs/shared-dto/src/lib/shared-dto.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { sharedDto } from './shared-dto';
|
||||
|
||||
describe('sharedDto', () => {
|
||||
it('should work', () => {
|
||||
expect(sharedDto()).toEqual('shared-dto');
|
||||
});
|
||||
});
|
||||
9
libs/shared-dto/src/lib/shared-dto.ts
Normal file
9
libs/shared-dto/src/lib/shared-dto.ts
Normal 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>;
|
||||
23
libs/shared-dto/tsconfig.json
Normal file
23
libs/shared-dto/tsconfig.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
15
libs/shared-dto/tsconfig.lib.json
Normal file
15
libs/shared-dto/tsconfig.lib.json
Normal 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"
|
||||
]
|
||||
}
|
||||
16
libs/shared-dto/tsconfig.spec.json
Normal file
16
libs/shared-dto/tsconfig.spec.json
Normal 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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user