mirror of
https://github.com/expo/explore.git
synced 2026-11-13 20:38:07 -10:00
Co-authored-by: Brent Vatne <[email protected]> Co-authored-by: Szymon Dziedzic <[email protected]>
16 lines
607 B
JavaScript
16 lines
607 B
JavaScript
import { readdir, rm } from "node:fs/promises";
|
|
import { dirname, resolve } from "node:path";
|
|
|
|
const workspace = process.cwd();
|
|
const output = resolve(workspace, "dist");
|
|
|
|
if (dirname(output) !== workspace) {
|
|
throw new Error(`Refusing to clean unexpected output path: ${output}`);
|
|
}
|
|
|
|
// The hosted Viewer export is built separately (npm run build:hosting:preview) and takes minutes; a CLI rebuild keeps it.
|
|
const keep = new Set(["hosting-preview"]);
|
|
for (const entry of await readdir(output).catch(() => [])) {
|
|
if (!keep.has(entry)) await rm(resolve(output, entry), { recursive: true, force: true });
|
|
}
|