'use strict'; /** * 初始化后端部署配置:把 config/deploy.config.example.cjs 复制为 config/deploy.config.local.cjs。 * deploy.config.local.cjs 含服务器地址与 SSH 私钥路径,已被 .gitignore 排除,不要提交。 * * 用法:npm run deploy:init */ const fs = require('node:fs'); const { EXAMPLE_CONFIG_PATH, LOCAL_CONFIG_PATH } = require('./deploy-lib.cjs'); if (fs.existsSync(LOCAL_CONFIG_PATH)) { console.log('ℹ️ config/deploy.config.local.cjs 已存在,未覆盖。'); console.log(` 如需重新生成,请先删除该文件:${LOCAL_CONFIG_PATH}`); process.exit(0); } fs.copyFileSync(EXAMPLE_CONFIG_PATH, LOCAL_CONFIG_PATH); console.log('✅ 已生成 config/deploy.config.local.cjs'); console.log(' 请按实际服务器信息确认 host / username / privateKeyPath / deployRoot / ports,然后执行 npm run deploy。');