@naseej/blox 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/run.js +34 -5
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -31,7 +31,7 @@ var option = (flags, description) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
|
-
var version = "1.3.
|
|
34
|
+
var version = "1.3.4";
|
|
35
35
|
|
|
36
36
|
// src/commands/add/index.ts
|
|
37
37
|
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
@@ -621,13 +621,42 @@ var import_node_path8 = __toESM(require("path"));
|
|
|
621
621
|
var import_ejs = __toESM(require("ejs"));
|
|
622
622
|
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
623
623
|
var import_klaw3 = __toESM(require("klaw"));
|
|
624
|
+
var NON_RENDERABLE_FILES = [
|
|
625
|
+
".png",
|
|
626
|
+
".jpg",
|
|
627
|
+
".jpeg",
|
|
628
|
+
".gif",
|
|
629
|
+
".svg",
|
|
630
|
+
".ico",
|
|
631
|
+
".ttf",
|
|
632
|
+
".woff",
|
|
633
|
+
".woff2",
|
|
634
|
+
".otf",
|
|
635
|
+
".mp4",
|
|
636
|
+
".mp3",
|
|
637
|
+
".zip",
|
|
638
|
+
".plist",
|
|
639
|
+
".DS_Store",
|
|
640
|
+
".bin"
|
|
641
|
+
];
|
|
624
642
|
async function replacePlaceholders(dir, context) {
|
|
625
643
|
debug("Replace placeholders");
|
|
626
644
|
for await (const file of (0, import_klaw3.default)(dir)) {
|
|
627
|
-
if (file.stats.isFile())
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
645
|
+
if (!file.stats.isFile()) continue;
|
|
646
|
+
const ext = import_node_path8.default.extname(file.path).toLowerCase();
|
|
647
|
+
if (NON_RENDERABLE_FILES.includes(ext)) {
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
const templateContent = import_fs_extra7.default.readFileSync(file.path, "utf8");
|
|
651
|
+
if (!templateContent.includes("<%")) {
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
try {
|
|
655
|
+
const rendered = import_ejs.default.render(templateContent, context);
|
|
656
|
+
import_fs_extra7.default.writeFileSync(file.path, rendered, "utf8");
|
|
657
|
+
} catch (err) {
|
|
658
|
+
console.error("\u274C Error rendering EJS for file:", file.path);
|
|
659
|
+
throw err;
|
|
631
660
|
}
|
|
632
661
|
}
|
|
633
662
|
}
|