mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
* fix(media-use): tests never write into the person's media library * fix(media-use): guard the media home only in this repo's test runs * test(media-use): probe the media home from a plain child process * fix(media-use): keep miss logging best-effort when home is unresolvable * test(media-use): miss logging survives an unresolvable media home * docs(media-use): describe the media library without naming an app * chore(media-use): refresh the skills manifest hash
21 lines
730 B
JavaScript
21 lines
730 B
JavaScript
import { homedir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
// The one owner of where the person's media library lives. This repo's test runs set
|
|
// HYPERFRAMES_MEDIA_HOME_REQUIRED, so a test that forgot HYPERFRAMES_MEDIA_HOME fails instead
|
|
// of writing fixtures into the media library apps list as the person's own files.
|
|
export function mediaHome() {
|
|
const override = process.env.HYPERFRAMES_MEDIA_HOME;
|
|
if (override) return override;
|
|
if (process.env.HYPERFRAMES_MEDIA_HOME_REQUIRED) {
|
|
throw new Error(
|
|
"media-use: a test reached the real ~/.media; set HYPERFRAMES_MEDIA_HOME to a temp dir",
|
|
);
|
|
}
|
|
return homedir();
|
|
}
|
|
|
|
export function globalMediaDir() {
|
|
return join(mediaHome(), ".media");
|
|
}
|