const { exec } = require('child_process');
const path = require('path');

// 获取当前工作目录并生成 dist 路径
const distPath = path.join(process.cwd(), 'dist');
const targetPath = '\\\\192.168.0.152\\web\\shop\\nsadmin';

// 构建 xcopy 命令
const command = `xcopy "${distPath}" "${targetPath}" /E /H /Y`;

// 执行 xcopy 命令
exec(command, (error, stdout, stderr) => {
    if (error) {
        console.error(`执行错误: ${error.message}`);
        return;
    }
    if (stderr) {
        console.error(`错误输出: ${stderr}`);
        return;
    }
    console.log(`输出: ${stdout}`);
});
