mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
script build update, peers file watching/updating/validating fixes, peers schema improvements
This commit is contained in:
parent
1e4f45a76c
commit
0d1abc7d4f
4 changed files with 33 additions and 35 deletions
|
@ -51,6 +51,20 @@ export const validateFiles = (): boolean => {
|
|||
return everythingValid
|
||||
}
|
||||
|
||||
export const readAndValidateFile = <T>(file: FileDescriptor): T => {
|
||||
if (!file.schema) return null
|
||||
const fileExists = utils.FileExists(file.path)
|
||||
if (!fileExists) return null
|
||||
|
||||
const content = utils.ReadFile(file.path)
|
||||
const parsedContent: T = JSON.parse(content)
|
||||
|
||||
if (!isJsonValidAndLogError(parsedContent, file.schema, file.path))
|
||||
return null
|
||||
|
||||
return parsedContent
|
||||
}
|
||||
|
||||
export const files = {
|
||||
// --------------------------------------------------------------------------------
|
||||
// server / modules files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue