-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
33 lines (26 loc) · 734 Bytes
/
Copy pathbuild.js
File metadata and controls
33 lines (26 loc) · 734 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
const fs = require('fs');
const path = require('path');
const projectRoot = __dirname;
const outputDir = path.join(projectRoot, 'docs');
const filesToCopy = [
'index.html',
'style.css',
'app.js',
'calculator.js',
'visualizer.js',
'.nojekyll'
];
if (fs.existsSync(outputDir)) {
fs.rmSync(outputDir, { recursive: true, force: true });
}
fs.mkdirSync(outputDir, { recursive: true });
for (const fileName of filesToCopy) {
const src = path.join(projectRoot, fileName);
const dest = path.join(outputDir, fileName);
if (!fs.existsSync(src)) {
console.warn(`Warning: skipping missing file ${fileName}`);
continue;
}
fs.copyFileSync(src, dest);
}
console.log(`Built GitHub Pages site to ${outputDir}`);