From 180fee4a02a49a101ae117567f016f8ef93e2a29 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 28 Jan 2024 12:55:02 +0100 Subject: [PATCH] vendor_{build,license}.js: use js-yaml (instead of yaml.js) --- vendor_build.js | 8 +++++--- vendor_license.js | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/vendor_build.js b/vendor_build.js index 2c3d515f..f051ded9 100644 --- a/vendor_build.js +++ b/vendor_build.js @@ -1,5 +1,5 @@ -const YAML = require("yamljs"); -const { copyFileSync, readdirSync, statSync, mkdirSync } = require("fs"); +const jsyaml = require("js-yaml"); +const { readFileSync, copyFileSync, readdirSync, statSync, mkdirSync } = require("fs"); const { join, basename, dirname } = require("path"); const firstBy = require("thenby"); @@ -28,7 +28,9 @@ function copyOverwrite(src, dst) { } function main() { - const vendor = YAML.load("vendor.yaml"); + const filename = "vendor.yaml"; + const vendorYaml = readFileSync(filename, "utf8"); + const vendor = jsyaml.load(vendorYaml, { schema: jsyaml.CORE_SCHEMA, filename }); const sortedLibs = Object.entries(vendor["libs"]).sort( firstBy(([, lib]) => lib["priority"]) ); diff --git a/vendor_license.js b/vendor_license.js index 42b1c96b..0f9421a5 100644 --- a/vendor_license.js +++ b/vendor_license.js @@ -1,4 +1,4 @@ -const YAML = require("yamljs"); +const jsyaml = require("js-yaml"); const { readdirSync, readFileSync, writeFileSync, statSync } = require("fs"); const { join, basename } = require("path"); const firstBy = require("thenby"); @@ -15,7 +15,9 @@ function findLicenses(dst) { } function main() { - const vendor = YAML.load("vendor.yaml"); + const filename = "vendor.yaml"; + const vendorYaml = readFileSync(filename, "utf8"); + const vendor = jsyaml.load(vendorYaml, { schema: jsyaml.CORE_SCHEMA, filename }); let licResult = ""; let wikiResult = "# 3rd-party libraries\n\n"; const sortedLibs = Object.entries(vendor["libs"]).sort(