forked from Sunbird-inQuiry/editor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-wc.js
37 lines (31 loc) · 1.29 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
32
33
34
35
36
37
const fs = require("fs-extra");
const concat = require("concat");
const build = async () => {
const files = [
"./dist/questionset-editor-library-wc/runtime.js",
"./dist/questionset-editor-library-wc/polyfills.js",
"./dist/questionset-editor-library-wc/scripts.js",
"./dist/questionset-editor-library-wc/main.js"
];
const filesToExclude = [
"dist/questionset-editor-library-wc/index.html",
"dist/questionset-editor-library-wc/runtime.js",
"dist/questionset-editor-library-wc/polyfills.js",
"dist/questionset-editor-library-wc/scripts.js",
"dist/questionset-editor-library-wc/main.js"
]
const filter = file => {
return !filesToExclude.includes(file);
}
await fs.ensureDir("dist/questionset-editor-library-wc");
if (!fs.existsSync('web-component')){
fs.mkdirSync('web-component');
}
await concat(files, "web-component/sunbird-questionset-editor.js");
await fs.copy("./dist/questionset-editor-library-wc/", "web-component/", {filter});
await concat(files, "web-component-examples/vanilla-js/sunbird-questionset-editor.js");
await fs.copy("./dist/questionset-editor-library-wc/", "web-component-examples/vanilla-js/", {filter});
await fs.copy("README.md", "web-component/README.md")
console.log("Files concatenated successfully!!!");
};
build();