mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-09-29 13:32:28 +08:00
同时打包go和前端
This commit is contained in:
@@ -9,14 +9,14 @@ const distPath = path.resolve(cwd, 'dist')
|
|||||||
const releasePath = path.resolve(cwd, releaseRelativePath)
|
const releasePath = path.resolve(cwd, releaseRelativePath)
|
||||||
|
|
||||||
const goProjectPath = path.resolve(cwd, '../server')
|
const goProjectPath = path.resolve(cwd, '../server')
|
||||||
|
async function build_go() {
|
||||||
async function build() {
|
|
||||||
await execaCommand('goreleaser release --snapshot --clean', {
|
await execaCommand('goreleaser release --snapshot --clean', {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
cwd: goProjectPath
|
cwd: goProjectPath
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
async function build_frontend() {
|
||||||
await execaCommand('vite build', { stdio: 'inherit', encoding: 'utf-8', cwd })
|
await execaCommand('vite build', { stdio: 'inherit', encoding: 'utf-8', cwd })
|
||||||
if (existsSync(releasePath)) {
|
if (existsSync(releasePath)) {
|
||||||
await remove(releasePath)
|
await remove(releasePath)
|
||||||
@@ -29,7 +29,9 @@ async function build() {
|
|||||||
}
|
}
|
||||||
console.log(`文件已复制 ==> ${releaseRelativePath}`)
|
console.log(`文件已复制 ==> ${releaseRelativePath}`)
|
||||||
}
|
}
|
||||||
|
async function build() {
|
||||||
|
await Promise.allSettled([build_go(), build_frontend()])
|
||||||
|
}
|
||||||
function copyFile(sourceDir, targetDir) {
|
function copyFile(sourceDir, targetDir) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
copy(sourceDir, targetDir, (err) => {
|
copy(sourceDir, targetDir, (err) => {
|
||||||
|
Reference in New Issue
Block a user