19 lines
636 B
JavaScript
19 lines
636 B
JavaScript
import { execSync } from 'node:child_process'
|
|||
|
|
import { existsSync } from 'node:fs'
|
||
|
|
import path from 'node:path'
|
||
|
|
import { fileURLToPath } from 'node:url'
|
||
|
|
|
||
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||
|
|
process.chdir(root)
|
||
|
|
|
||
|
|
execSync('node scripts/write-docker-vite-env.mjs', { stdio: 'inherit' })
|
||
|
|
execSync('npm run build-only', { stdio: 'inherit' })
|
||
|
|
|
||
|
|
if (!existsSync(path.join(root, 'dist', 'index.html'))) {
|
||
|
|
throw new Error('dist/index.html ساخته نشد')
|
||
|
|
}
|
||
|
|
|
||
|
|
const out = 'deploy-dist.tar.gz'
|
||
|
|
execSync(`tar -czf ${out} dist scripts/serve-user.mjs`, { stdio: 'inherit' })
|
||
|
|
console.log(`packed ${out}`)
|