Files
zyt/admin/live-native/build.mjs
T

16 lines
970 B
JavaScript

// Build the actual admin entry/router/permission store, not a projected preview.
// Output remains in the worktree; do not run scripts/release.mjs.
import {build} from 'vite'
import path from 'node:path'
import {fileURLToPath} from 'node:url'
const here=path.dirname(fileURLToPath(import.meta.url)), root=path.dirname(here)
process.chdir(root)
const name=process.argv[2]
if(name && !/^[a-z][a-z0-9-]{1,48}$/.test(name))throw Error('Use a short lowercase candidate name')
const target=path.join(root,'node_modules/.zyt-live-native',...(name?['candidates',name]:['dist']))
await build({root,mode:'live-native',configFile:path.join(root,'vite.config.ts'),envFile:false,
define:{'import.meta.env.VITE_APP_BASE_URL':JSON.stringify('https://admin.zhenyangtang.com.cn')},
cacheDir:path.join(root,'node_modules/.zyt-live-native/cache'),
build:{outDir:target,emptyOutDir:true,sourcemap:false,reportCompressedSize:false,
rollupOptions:{input:path.join(here,'index.html')}}})