Fix glob sync after updating to version 9

This commit is contained in:
Ole Eskild Steensen 2023-03-17 08:23:47 +01:00
parent 9b9e4b9ac9
commit be33faaba3
2 changed files with 4 additions and 4 deletions

View File

@ -2,14 +2,14 @@ require("dotenv").config();
const axios = require("axios"); const axios = require("axios");
const fs = require("fs"); const fs = require("fs");
const crypto = require("crypto"); const crypto = require("crypto");
const glob = require("glob"); const {globSync} = require("glob");
module.exports = async () => { module.exports = async () => {
let baseUrl = process.env.SITE_BASE_URL || ""; let baseUrl = process.env.SITE_BASE_URL || "";
if (baseUrl && !baseUrl.startsWith("http")) { if (baseUrl && !baseUrl.startsWith("http")) {
baseUrl = "https://" + baseUrl; baseUrl = "https://" + baseUrl;
} }
let themeStyle = glob.sync("src/site/styles/_theme.*.css")[0] || ""; let themeStyle = globSync("src/site/styles/_theme.*.css")[0] || "";
if (themeStyle) { if (themeStyle) {
themeStyle = themeStyle.split("site")[1]; themeStyle = themeStyle.split("site")[1];
} }

View File

@ -2,7 +2,7 @@ require("dotenv").config();
const axios = require("axios"); const axios = require("axios");
const fs = require("fs"); const fs = require("fs");
const crypto = require("crypto"); const crypto = require("crypto");
const glob = require("glob"); const {globSync} = require("glob");
const themeCommentRegex = /\/\*[\s\S]*?\*\//g; const themeCommentRegex = /\/\*[\s\S]*?\*\//g;
@ -23,7 +23,7 @@ async function getTheme() {
const res = await axios.get(themeUrl); const res = await axios.get(themeUrl);
try { try {
const existing = glob.sync("src/site/styles/_theme.*.css"); const existing = globSync("src/site/styles/_theme.*.css");
existing.forEach((file) => { existing.forEach((file) => {
fs.rmSync(file); fs.rmSync(file);
}); });