blob: ad897eab296e4c2342597f8cb8ec5eb787e85c90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { ERROR } from 'bunyan';
import { getProblems, logger } from '../lib/logger';
import { generateSchema } from './docs/schema';
process.on('unhandledRejection', (err) => {
// Will print "unhandledRejection err is not defined"
logger.error({ err }, 'unhandledRejection');
process.exit(-1);
});
// eslint-disable-next-line @typescript-eslint/no-floating-promises
(async () => {
try {
const dist = '.';
// json-schema
logger.info('Generating json-schema');
await generateSchema(dist);
} catch (err) {
logger.error({ err }, 'Unexpected error');
} finally {
const loggerErrors = getProblems().filter((p) => p.level >= ERROR);
if (loggerErrors.length) {
process.exit(1);
}
}
})();
|