forked from bangbang93/openbmclapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_dev.cjs
More file actions
39 lines (31 loc) · 951 Bytes
/
build_dev.cjs
File metadata and controls
39 lines (31 loc) · 951 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
38
39
const fs = require('fs');
const path = require('path');
const ncp = require('ncp').ncp;
function updatePackageJson() {
try {
const packageJsonPath = path.join(process.cwd(), 'package.json');
if (!fs.existsSync(packageJsonPath)) {
console.error('> 找不到 package.json');
process.exit(1);
}
const packageJson = require(packageJsonPath);
packageJson.dev = true;
// 更新
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJson, null, 2) + '\n', // 保持格式化和换行
'utf8'
);
console.log('> 写入 Dev 版标记符成功');
} catch (error) {
console.error('> 写入 Dev 版标记符失败: ', error.message);
process.exit(1);
}
}
ncp(path.join(__dirname, 'src/dashboard'), path.join(__dirname, 'dist/dashboard'), function (err) {
if (err) {
return console.error(err);
}
console.log('> 构建完成');
});
updatePackageJson();