Skip to content

Commit

Permalink
Chore(deps-dev): bump the update-npm-dependencies group with 2 updates (
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Apr 23, 2024
1 parent af98434 commit b885f2e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 49 deletions.
61 changes: 39 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@types/lodash": "^4.17.0",
"@types/luxon": "^3.4.2",
"@types/qrcode": "^1.5.5",
"ts-json-schema-generator": "^2.0.1"
"ts-json-schema-generator": "^2.1.0"
},
"publishConfig": {
"access": "public",
Expand Down
51 changes: 26 additions & 25 deletions packages/runtime/scripts/buildSchemas.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
const tsj = require("ts-json-schema-generator");
const fs = require("fs");
const path = require("path");

const config = {
tsconfig: path.join(__dirname, "../tsconfig.json"),
type: "*",
extraTags: ["errorMessage"]
};
import("ts-json-schema-generator").then((tsj) => {
const config = {
tsconfig: path.join(__dirname, "../tsconfig.json"),
type: "*",
extraTags: ["errorMessage"]
};

const schemaGenerator = tsj.createGenerator(config);
const schemaGenerator = tsj.createGenerator(config);

const requestTypes = schemaGenerator
.getRootNodes()
.map((x) => x.symbol.escapedName)
.filter((x) => x.endsWith("Request"));
const requestTypes = schemaGenerator
.getRootNodes()
.map((x) => x.symbol.escapedName)
.filter((x) => x.endsWith("Request"));

const schemaDeclarations = requestTypes
.map((type) => {
try {
const schema = schemaGenerator.createSchema(type);
return `export const ${type}: any = ${JSON.stringify(schema, undefined, 4)}`;
} catch (e) {
if (!(e instanceof tsj.NoRootTypeError)) throw e;
}
})
.filter((s) => s)
.join("\n\n");
const schemaDeclarations = requestTypes
.map((type) => {
try {
const schema = schemaGenerator.createSchema(type);
return `export const ${type}: any = ${JSON.stringify(schema, undefined, 4)}`;
} catch (e) {
if (!(e instanceof tsj.NoRootTypeError)) throw e;
}
})
.filter((s) => s)
.join("\n\n");

const output_path = path.join(__dirname, "../src/useCases/common/Schemas.ts");
const output_path = path.join(__dirname, "../src/useCases/common/Schemas.ts");

fs.writeFile(output_path, schemaDeclarations, (err) => {
if (err) throw err;
fs.writeFile(output_path, schemaDeclarations, (err) => {
if (err) throw err;
});
});
2 changes: 1 addition & 1 deletion packages/transport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@types/json-stringify-safe": "^5.0.3",
"@types/lodash": "^4.17.0",
"@types/luxon": "^3.4.2",
"@types/qs": "^6.9.14",
"@types/qs": "^6.9.15",
"@types/uuid": "^9.0.8",
"expect": "^29.7.0",
"ts-mockito": "^2.6.1"
Expand Down

0 comments on commit b885f2e

Please sign in to comment.