Files
clean-architecture-frontend…/scripts/lib/dist-permissions.ts
DongHyeonkaandClaude Opus 5.5 1a1cfe6605 fix(build): make every dist file readable by other users (13-02)
The validated JSON writer creates files 0600, so dist/config.json,
release-manifest.json and runtime-config.schema.json shipped unreadable to a
web server running as another user. The build now adds read bits to dist files;
evidence under artifacts/ stays private.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:52:33 +09:00

19 lines
800 B
TypeScript

import { chmod, readdir, stat } from "node:fs/promises";
import path from "node:path";
/**
* 13-02. dist is published as-is to a web server that may run as another OS
* user, so every file in it must be readable by others. The validated JSON
* writer creates files 0600 on purpose (evidence under artifacts/ stays
* private); the build adds read bits to what it publishes instead of loosening
* that writer.
*/
export async function makeDistFilesPublic(directory: string): Promise<void> {
for (const entry of await readdir(directory, { recursive: true, withFileTypes: true })) {
if (!entry.isFile()) continue;
const file = path.join(entry.parentPath, entry.name);
const { mode } = await stat(file);
if ((mode & 0o004) === 0) await chmod(file, (mode & 0o7777) | 0o444);
}
}