Skip to content

Commit a8a291a

Browse files
committed
(chore) fix CDN build
1 parent 4bed963 commit a8a291a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/build_cdn.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const fs = require("fs").promises;
2+
const fss = require("fs");
23
const glob = require("glob");
34
const zlib = require('zlib');
45
const { getLanguages } = require("./lib/language");
@@ -11,8 +12,8 @@ const { buildPackageJSON } = require("./build_node");
1112
const path = require("path");
1213
const bundling = require('./lib/bundling.js');
1314

14-
async function installPackageJSON() {
15-
await buildPackageJSON();
15+
async function installPackageJSON(options) {
16+
await buildPackageJSON(options);
1617
const json = require(`${process.env.BUILD_DIR}/package`);
1718
json.name = "@highlightjs/cdn-assets";
1819
json.description = json.description.concat(" (pre-compiled CDN assets)");
@@ -24,7 +25,7 @@ let shas = {};
2425
async function buildCDN(options) {
2526
install("./LICENSE", "LICENSE");
2627
install("./README.CDN.md", "README.md");
27-
installPackageJSON();
28+
installPackageJSON(options);
2829

2930
installStyles();
3031

@@ -104,9 +105,12 @@ async function installLanguages(languages) {
104105

105106
function installStyles() {
106107
log("Writing style files.");
107-
mkdir("styles");
108+
mkdir("styles/base16");
109+
110+
glob.sync("**", { cwd: "./src/styles" }).forEach((file) => {
111+
const stat = fss.statSync(`./src/styles/${file}`);
112+
if (stat.isDirectory()) return;
108113

109-
glob.sync("*", { cwd: "./src/styles" }).forEach((file) => {
110114
if (file.endsWith(".css")) {
111115
installCleanCSS(`./src/styles/${file}`, `styles/${file.replace(".css", ".min.css")}`);
112116
} else {

0 commit comments

Comments
 (0)