-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
3,323 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{yaml,yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
lba1.json | ||
lba2.json | ||
dist/ | ||
node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import path from "node:path"; | ||
import fs from "node:fs/promises"; | ||
import glob from "glob-promise"; | ||
import jq from "node-jq"; | ||
|
||
async function merge_json(filePattern, destination) { | ||
await fs.mkdir(path.dirname(destination), { recursive: true }); | ||
let files = await glob(filePattern); | ||
let merged = await jq.run("[ .[] | .[] ]", files, { | ||
output: "string", | ||
slurp: true, | ||
}); | ||
await fs.writeFile(destination, merged); | ||
console.log(`Merged ${filePattern} into ${destination}`); | ||
} | ||
|
||
await merge_json("lba1/*.json", "dist/lba1.json"); | ||
await merge_json("lba2/*.json", "dist/lba2.json"); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import glob from "glob-promise"; | ||
import jq from "node-jq"; | ||
|
||
async function validate_json(filePattern) { | ||
let files = await glob(filePattern); | ||
let allValid = true; | ||
for (let file of files) { | ||
try { | ||
await jq.run(".", file); | ||
} catch (e) { | ||
console.error('Invalid JSON file "%s": %s', file, e.message); | ||
allValid = false; | ||
} | ||
} | ||
return allValid; | ||
} | ||
|
||
let allValid = true; | ||
for (let i = 0; i < process.argv.length; i++) { | ||
allValid &= await validate_json(process.argv[i]); | ||
} | ||
|
||
if (!allValid) { | ||
console.info("❌ JSON validation FAILED"); | ||
process.exit(1); | ||
} else { | ||
console.info("✅ JSON validation passed"); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.