create-kda
Advanced tools
Comparing version 0.0.25 to 0.0.26
{ | ||
"name": "create-kda", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"main": "index.mjs", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/kdajs/create-kda.git", |
@@ -8,5 +8,6 @@ { | ||
{ | ||
"type": "node", | ||
"name": "debug", | ||
"type": "pwa-node", | ||
"sourceMaps": true, | ||
"request": "launch", | ||
"name": "debug", | ||
"skipFiles": [ | ||
@@ -20,5 +21,8 @@ "<node_internals>/**" | ||
], | ||
"port": 8080 | ||
"resolveSourceMapLocations": [ | ||
"${workspaceFolder}/src/**", | ||
"!**/node_modules/**" | ||
] | ||
} | ||
] | ||
} |
@@ -10,5 +10,4 @@ { | ||
"scripts": { | ||
"build:json.schema": "kda-build json.schema ./src/@types/json.schema.d.ts", | ||
"build:ts": "kda-build", | ||
"build": "run-s build:json.schema build:ts", | ||
"build": "run-s build:ts", | ||
"check:type": "tsc", | ||
@@ -21,4 +20,4 @@ "check:format": "eslint ./src/**/*.ts", | ||
"server:prod:debug": "kda server production --debug=8080", | ||
"start": "run-s build:ts server:test", | ||
"debug": "run-s build:ts server:test:debug", | ||
"start": "run-s build server:test", | ||
"debug": "run-s build server:test:debug", | ||
"debug:test": "run-s build server:test:debug", | ||
@@ -34,3 +33,2 @@ "debug:prod": "run-s build server:prod:debug", | ||
"dayjs": "^1.10.4", | ||
"jsonschema": "^1.4.0", | ||
"kda": "{{kdaVersion}}", | ||
@@ -37,0 +35,0 @@ "shortid": "^2.2.16" |
import day from 'dayjs' | ||
import shortid from 'shortid' | ||
import { Validator } from 'jsonschema' | ||
@@ -17,12 +16,2 @@ function today (): string { | ||
const validator = new Validator() | ||
function jsonSchemaValidator (data: any, schema: object): string | undefined { | ||
let errors: string | undefined | ||
const result = validator.validate(data, schema, { allowUnknownAttributes: true }) | ||
if (result.errors.length > 0) { | ||
errors = result.errors.map(v => v.message).join('\n') | ||
} | ||
return errors | ||
} | ||
async function sleep (time: number = 1000): Promise<void> { | ||
@@ -40,5 +29,4 @@ await new Promise(resolve => setTimeout(resolve, time)) | ||
uuid, | ||
jsonSchemaValidator, | ||
sleep, | ||
random | ||
} |
Sorry, the diff of this file is not supported yet
22867
26
240