2022-01-25 15:25:29 +08:00
|
|
|
import chalk from 'chalk'
|
|
|
|
import { writeFileSync } from 'fs-extra'
|
|
|
|
import { OUTPUT_DIR } from '../constant'
|
|
|
|
import { getEnvConfig, getRootPath } from '../utils'
|
|
|
|
|
|
|
|
export function runBuildCNAME() {
|
2022-06-25 14:45:23 +08:00
|
|
|
const { VITE_APP_CNAME } = getEnvConfig()
|
|
|
|
if (!VITE_APP_CNAME) return
|
2022-01-25 15:25:29 +08:00
|
|
|
try {
|
2022-06-25 14:45:23 +08:00
|
|
|
writeFileSync(getRootPath(`${OUTPUT_DIR}/CNAME`), VITE_APP_CNAME)
|
2022-01-25 15:25:29 +08:00
|
|
|
} catch (error) {
|
|
|
|
console.log(chalk.red('CNAME file failed to package:\n' + error))
|
|
|
|
}
|
|
|
|
}
|