-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
37 lines (32 loc) · 875 Bytes
/
build.js
File metadata and controls
37 lines (32 loc) · 875 Bytes
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");
const path = require("path");
const packageJson = require("./package.json");
const files = [
"src/core.js",
"src/render.js",
"src/sort.js",
"src/filters.js",
"src/pagination.js",
"src/exports.js",
"index.js",
];
const version = packageJson.version;
const outputDir = path.join(__dirname, "dist");
const outputFile = path.join(outputDir, `vanilla-table-${version}.js`);
// Ensure dist directory exists
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}
// Concatenate files
let content = "";
files.forEach((file) => {
const filePath = path.join(__dirname, file);
if (fs.existsSync(filePath)) {
content += fs.readFileSync(filePath, "utf8") + "\n\n";
} else {
console.error(`File not found: ${file}`);
process.exit(1);
}
});
fs.writeFileSync(outputFile, content);
console.log(`Created ${outputFile}`);