Skip to content

Commit

Permalink
vendor_{build,license}.js: use js-yaml (instead of yaml.js)
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Feb 4, 2024
1 parent a47b86e commit 180fee4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions vendor_build.js
Original file line number Diff line number Diff line change
@@ -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");

Expand Down Expand Up @@ -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"])
);
Expand Down
6 changes: 4 additions & 2 deletions vendor_license.js
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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(
Expand Down

0 comments on commit 180fee4

Please sign in to comment.