forked from TurboWarp/scratch-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoDesktop.js
More file actions
36 lines (31 loc) · 1.2 KB
/
toDesktop.js
File metadata and controls
36 lines (31 loc) · 1.2 KB
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
const fs = require('fs-extra');
for (const p of ["./build/addons.html", "./build/editor.html"]) {
for (const l of [
"https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/crypto-js/4.1.1/",
"https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-y/dompurify/2.3.6/",
"https://lib.baomitu.com/mdui/2.1.2/",
"https://lib.baomitu.com/jquery/3.6.0/jquery.min.js",
"https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-y/marked/4.0.2/",
'https://lib.baomitu.com/mdui/2.1.2/'
])
fs.writeFileSync(
p,
(fs.readFileSync(p) + "").replaceAll(l, "../other/")
);
}
const path = require("path");
const sourceDir = path.resolve(__dirname, "build");
const targetDir = path.resolve(__dirname, "../40code-desktop/static");
async function updateStatic() {
try {
// 删除目标目录中的所有文件
await fs.emptyDir(targetDir);
console.log(`已清空目录: ${targetDir}`);
// 复制源目录中的所有文件到目标目录
await fs.copy(sourceDir, targetDir);
console.log(`已复制目录: ${sourceDir} 到 ${targetDir}`);
} catch (err) {
console.error("操作失败:", err);
}
}
updateStatic();