Skip to content

Commit

Permalink
refactor: ♻️ move config to shared/config
Browse files Browse the repository at this point in the history
  • Loading branch information
zhumeisongsong committed Nov 18, 2024
1 parent 348753e commit c13db02
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 18 deletions.
3 changes: 0 additions & 3 deletions libs/config/eslint.config.js

This file was deleted.

9 changes: 0 additions & 9 deletions libs/config/project.json

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions libs/shared/config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const baseConfig = require('../../../eslint.config.js');

module.exports = [...baseConfig];
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default {
displayName: 'config',
preset: '../../jest.preset.js',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/config',
coverageDirectory: '../../../coverage/libs/shared/config',
};
9 changes: 9 additions & 0 deletions libs/shared/config/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "shared-config",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared/config/src",
"projectType": "library",
"tags": [],
"// targets": "to see all targets run: nx show project config --web",
"targets": {}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export type DatabaseConfig = z.infer<typeof databaseSchema>;

export const databaseConfig = registerAs('database', () => {
const config = {
host: process.env['DATABASE_HOST'],
port: process.env['DATABASE_PORT'] || 5432,
host: process.env['DATABASE_HOST'] || 'localhost',
port: process.env['DATABASE_PORT'] || 27017,
name: process.env['DATABASE_NAME'] || '',
};

return databaseSchema.parse(config);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
Expand Down

0 comments on commit c13db02

Please sign in to comment.