Skip to content

Commit 0571402

Browse files
authored
Merge pull request #24 from lad-tech/23-fix-import-schema
fix: исправить импорт схемы
2 parents f186bd2 + 6fec327 commit 0571402

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/cli/service-cli.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env node
22

3-
import Ajv from 'ajv';
3+
import { Ajv } from 'ajv';
44
import { Command } from 'commander';
55
import { readFileSync } from 'fs';
66
import { fileURLToPath } from 'url';
77
import { dirname, join, resolve } from 'path';
8-
import { ServiceSchema } from '../interfaces.js';
98
import { MicroService } from '../MicroService.js';
109
import ValidateSchema from '../serviceSchemaValidator.json' with { type: 'json' };
1110
import { logger } from '../logger/index.js';
@@ -54,7 +53,7 @@ Examples:
5453

5554
logger.info('Starting generation in:', directoryPath);
5655

57-
const schema: ServiceSchema = (await import(pathToSchema)).default;
56+
const schema = JSON.parse(readFileSync(pathToSchema, 'utf-8'));
5857
validateSchema(schema);
5958

6059
const validate = new Ajv().compile(ValidateSchema);

tsconfig.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
{
22
"compilerOptions": {
3-
"sourceMap": true,
3+
"outDir": "./dist",
4+
"rootDir": "./src",
45
"declaration": true,
6+
"sourceMap": true,
57
"strictNullChecks": true,
6-
"module": "ESNext",
7-
"moduleResolution": "bundler",
8-
"target": "ES2022",
8+
"removeComments": true,
9+
"strict": true,
10+
"target": "esnext",
11+
"module": "nodenext",
12+
"moduleResolution": "nodenext",
13+
"skipLibCheck": true,
914
"allowJs": false,
1015
"resolveJsonModule": true,
11-
"skipLibCheck": true,
1216
"experimentalDecorators": true,
1317
"emitDecoratorMetadata": true,
14-
"outDir": "./dist",
15-
"declarationDir": "./dist/types/",
16-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
17-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
18+
"strictPropertyInitialization": false,
19+
"lib": ["ESNext"],
20+
"esModuleInterop": true,
21+
"allowSyntheticDefaultImports": true,
22+
"forceConsistentCasingInFileNames": true
1823
},
19-
"include": ["src","src/*.json"],
24+
"include": ["./src"],
2025
"exclude": ["node_modules","test"]
2126
}

0 commit comments

Comments
 (0)