Files
.github
docs
script
BootWay.03.ps1
NapCat.164.bat
checkVersion.cjs
copy-core.cjs
gen-version.ts
index.js
napcat-custom.bat
napcat-gc.ps1
napcat-log.ps1
napcat-utf8.bat
napcat-utf8.ps1
napcat.bat
napcat.ps1
napcat.sh
src
static
test
.editorconfig
.env.development
.env.production
.eslintrc.cjs
.gitignore
LICENSE
README.md
logo.png
package.json
tsconfig.json
vite.config.ts
NapCatQQ/script/copy-core.cjs
2024-05-03 09:59:25 +08:00

33 lines
1.0 KiB
JavaScript

let fs = require('fs');
let path = require('path');
const coreDistDir = path.join(path.resolve(__dirname, '../'), 'src/core/dist/core/src');
const coreLibDir = path.join(path.resolve(__dirname, '../'), 'src/core.lib/src');
function copyDir(currentPath, outputDir) {
fs.readdir(currentPath, { withFileTypes: true }, (err, entries) => {
if (err?.errno === -4058) return;
entries.forEach(entry => {
const localBasePath = path.join(currentPath, entry.name);
const outputLocalBasePath = path.join(outputDir, entry.name);
if (entry.isDirectory()) {
// 如果是目录,递归调用
if (!fs.existsSync(outputLocalBasePath)) {
fs.mkdirSync(outputLocalBasePath, { recursive: true });
}
copyDir(localBasePath, outputLocalBasePath);
}
else{
// 如果是文件,直接复制
fs.copyFile(localBasePath, outputLocalBasePath, (err) => {
if (err) throw err;
});
}
});
});
}
copyDir(coreDistDir, coreLibDir);