diff --git a/mobile/scripts/sync-web.mjs b/mobile/scripts/sync-web.mjs index e7788e590..d626294bd 100644 --- a/mobile/scripts/sync-web.mjs +++ b/mobile/scripts/sync-web.mjs @@ -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) }) -