同时打包go和前端

This commit is contained in:
xiangheng
2023-11-29 00:44:04 +08:00
parent 006d09707c
commit 1ae107ab83

View File

@@ -9,14 +9,14 @@ const distPath = path.resolve(cwd, 'dist')
const releasePath = path.resolve(cwd, releaseRelativePath)
const goProjectPath = path.resolve(cwd, '../server')
async function build() {
async function build_go() {
await execaCommand('goreleaser release --snapshot --clean', {
stdio: 'inherit',
encoding: 'utf-8',
cwd: goProjectPath
})
}
async function build_frontend() {
await execaCommand('vite build', { stdio: 'inherit', encoding: 'utf-8', cwd })
if (existsSync(releasePath)) {
await remove(releasePath)
@@ -29,7 +29,9 @@ async function build() {
}
console.log(`文件已复制 ==> ${releaseRelativePath}`)
}
async function build() {
await Promise.allSettled([build_go(), build_frontend()])
}
function copyFile(sourceDir, targetDir) {
return new Promise((resolve, reject) => {
copy(sourceDir, targetDir, (err) => {