fix(mobile): make web sync path-independent
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { mkdir, readdir, rm, copyFile, stat } from 'node:fs/promises'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
async function copyDir(srcDir, dstDir) {
|
||||
await mkdir(dstDir, { recursive: true })
|
||||
@@ -18,9 +19,11 @@ async function copyDir(srcDir, dstDir) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const repoRoot = resolve(process.cwd(), '..')
|
||||
const scriptDir = fileURLToPath(new URL('.', import.meta.url))
|
||||
const mobileRoot = resolve(scriptDir, '..')
|
||||
const repoRoot = resolve(mobileRoot, '..')
|
||||
const fromDir = join(repoRoot, 'dist')
|
||||
const toDir = resolve(process.cwd(), 'www')
|
||||
const toDir = join(mobileRoot, 'www')
|
||||
|
||||
const st = await stat(fromDir).catch(() => null)
|
||||
if (!st || !st.isDirectory()) {
|
||||
@@ -35,4 +38,3 @@ main().catch((err) => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user