mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Fix: Use sync fs operations instead of fs/promises
fs/promises appears to hang on Vercel serverless functions. Switched to readdirSync/readFileSync which should work reliably. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
f7b42be23b
commit
13f4714b5d
+6
-4
@@ -1,4 +1,4 @@
|
||||
import { readdir, readFile } from "fs/promises";
|
||||
import { readdirSync, readFileSync } from "fs";
|
||||
import { join, dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
@@ -6,7 +6,7 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const PROJECT_ROOT = join(__dirname, "..");
|
||||
|
||||
export default async function handler(request) {
|
||||
export default function handler(request) {
|
||||
try {
|
||||
const sourceDir = join(PROJECT_ROOT, "source");
|
||||
const commandsDir = join(sourceDir, "commands");
|
||||
@@ -14,12 +14,14 @@ export default async function handler(request) {
|
||||
console.log("PROJECT_ROOT:", PROJECT_ROOT);
|
||||
console.log("commandsDir:", commandsDir);
|
||||
|
||||
const files = await readdir(commandsDir);
|
||||
const files = readdirSync(commandsDir);
|
||||
console.log("Files found:", files.length);
|
||||
|
||||
const commands = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (file.endsWith(".md")) {
|
||||
const content = await readFile(join(commandsDir, file), "utf-8");
|
||||
const content = readFileSync(join(commandsDir, file), "utf-8");
|
||||
const frontmatterMatch = content.match(/^---\n([\s\S]+?)\n---/);
|
||||
|
||||
if (frontmatterMatch) {
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
import { readFile } from "fs/promises";
|
||||
import { readFileSync } from "fs";
|
||||
import { join, dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
@@ -6,14 +6,15 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const PROJECT_ROOT = join(__dirname, "..");
|
||||
|
||||
export default async function handler(request) {
|
||||
export default function handler(request) {
|
||||
try {
|
||||
const sourceDir = join(PROJECT_ROOT, "source");
|
||||
const filePath = join(sourceDir, "patterns.md");
|
||||
|
||||
console.log("Reading patterns from:", filePath);
|
||||
|
||||
const content = await readFile(filePath, "utf-8");
|
||||
const content = readFileSync(filePath, "utf-8");
|
||||
console.log("File read, length:", content.length);
|
||||
const frontmatterMatch = content.match(/^---\n([\s\S]+?)\n---/);
|
||||
|
||||
if (!frontmatterMatch) {
|
||||
|
||||
Reference in New Issue
Block a user