refactor: refactor

This commit is contained in:
张传龙
2022-08-27 14:09:32 +08:00
parent 230e3a72d9
commit 220a7800f7
36 changed files with 201 additions and 192 deletions

View File

@@ -1,13 +1,14 @@
import { resolve } from 'path'
import chalk from 'chalk'
import { writeFileSync } from 'fs-extra'
import { OUTPUT_DIR } from '../constant'
import { getEnvConfig, getRootPath } from '../utils'
export function runBuildCNAME() {
const { VITE_APP_CNAME } = getEnvConfig()
if (!VITE_APP_CNAME) return
const { VITE_CNAME } = getEnvConfig()
if (!VITE_CNAME) return
try {
writeFileSync(getRootPath(`${OUTPUT_DIR}/CNAME`), VITE_APP_CNAME)
writeFileSync(resolve(getRootPath(), `${OUTPUT_DIR}/CNAME`), VITE_CNAME)
} catch (error) {
console.log(chalk.red('CNAME file failed to package:\n' + error))
}