-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove-files.js
More file actions
29 lines (24 loc) · 817 Bytes
/
Copy pathmove-files.js
File metadata and controls
29 lines (24 loc) · 817 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
import fs from "fs-extra";
import path from "node:path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function run() {
try {
const distPath = path.resolve(__dirname, "dist");
const theme1Path = path.join(distPath, "theme");
const theme2Path = path.join(theme1Path, "theme");
const theme1Exists = await fs.pathExists(theme1Path);
const theme2Exists = await fs.pathExists(theme2Path);
if (theme1Exists && theme2Exists) {
// Move files from theme2 to theme1
await fs.copy(theme2Path, theme1Path, { overwrite: false });
// Delete the empty theme2 folder
await fs.remove(theme2Path);
}
console.log("success!");
} catch (err) {
console.error(err);
}
}
run();