forked from Sunbird-inQuiry/player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-wc.js
31 lines (27 loc) · 1.02 KB
/
build-wc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const fs = require("fs-extra");
const concat = require("concat");
const path = require("path");
const build = async () => {
const files = [
"./dist/quml-player-wc/runtime.js",
"./dist/quml-player-wc/polyfills-es5.js",
"./dist/quml-player-wc/polyfills.js",
"./dist/quml-player-wc/scripts.js",
"./dist/quml-player-wc/vendor.js",
"./dist/quml-player-wc/main.js",
];
await fs.ensureDir("dist/quml-player-wc");
await fs.ensureDir("web-component");
await concat(files, "web-component/sunbird-quml-player.js");
await fs.copy("./dist/quml-player-wc/assets", "web-component/assets");
await fs.copy("./dist/quml-player-wc/styles.css", "web-component/styles.css");
const filesNames = fs.readdirSync("dist/quml-player-wc");
const allowedFiles = [".ttf", ".woff", ".woff2"];
filesNames.forEach((file) => {
if (allowedFiles.includes(path.extname(file))) {
fs.copySync(`dist/quml-player-wc/${file}`, `web-component/${file}`);
}
});
console.log("Files concatenated successfully!!!");
};
build();