mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
feat: tests
This commit is contained in:
@@ -17,7 +17,6 @@ import {Command} from 'commander';
|
||||
import {existsSync, readFileSync, writeFileSync} from 'fs';
|
||||
import {copy} from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {mkdirPromisified, readFilePromisified} from './common.js';
|
||||
import {lightweightDefinitionsFromPath, lightweightProjectFromPath} from '@openstapps/easy-ast';
|
||||
import {openapi3Template} from './resources/openapi-303-template.js';
|
||||
import {gatherRouteInformation, generateOpenAPIForRoute} from './routes.js';
|
||||
@@ -27,6 +26,7 @@ import {UMLConfig} from './uml/uml-config.js';
|
||||
import {capitalize} from './util/string.js';
|
||||
import {validateFiles, writeReport} from './validate.js';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {mkdir, readFile} from 'fs/promises';
|
||||
|
||||
// handle unhandled promise rejections
|
||||
process.on('unhandledRejection', async (reason: unknown) => {
|
||||
@@ -42,7 +42,7 @@ const commander = new Command('openstapps-core-tools');
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
commander.version(
|
||||
JSON.parse(
|
||||
readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString(),
|
||||
readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString(),
|
||||
).version,
|
||||
);
|
||||
|
||||
@@ -100,7 +100,7 @@ commander
|
||||
// copy schema json schema files
|
||||
try {
|
||||
if (!existsSync(outDirectorySchemasPath)) {
|
||||
await mkdirPromisified(outDirectorySchemasPath, {
|
||||
await mkdir(outDirectorySchemasPath, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ commander.command('schema <srcPath> <schemaPath>').action(async (relativeSourceP
|
||||
|
||||
Logger.info(`Found ${validatableTypes.length} type(s) to generate schemas for.`);
|
||||
|
||||
await mkdirPromisified(schemaPath, {
|
||||
await mkdir(schemaPath, {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ commander.command('schema <srcPath> <schemaPath>').action(async (relativeSourceP
|
||||
|
||||
Logger.info(`Using ${corePackageJsonPath} to determine version for schemas.`);
|
||||
|
||||
const buffer = await readFilePromisified(corePackageJsonPath);
|
||||
const buffer = await readFile(corePackageJsonPath);
|
||||
const corePackageJson = JSON.parse(buffer.toString());
|
||||
const coreVersion = corePackageJson.version;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user