18 lines
597 B
JavaScript
18 lines
597 B
JavaScript
import { cp, mkdir, rm } from "node:fs/promises"
|
|
import { existsSync } from "node:fs"
|
|
import { dirname, resolve } from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
const webRoot = resolve(here, "..")
|
|
const source = resolve(webRoot, "canvas-app", "dist")
|
|
const target = resolve(webRoot, "public", "canvas")
|
|
|
|
if (!existsSync(source)) {
|
|
throw new Error(`Canvas build output missing: ${source}`)
|
|
}
|
|
|
|
await rm(target, { recursive: true, force: true })
|
|
await mkdir(target, { recursive: true })
|
|
await cp(source, target, { recursive: true })
|