Skip to content

Commit c6626f9

Browse files
committed
use rename instead of read/write
1 parent af99265 commit c6626f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/@apphosting/adapter-nextjs/src/overrides.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
writeFile,
88
} from "./utils.js";
99
import { join } from "path";
10-
import { readFileSync } from "fs";
10+
import { rename as renamePromise } from "fs/promises";
1111

1212
export async function overrideNextConfig(projectRoot: string, nextConfigFileName: string) {
1313
// Check if the file exists in the current working directory
@@ -25,8 +25,8 @@ export async function overrideNextConfig(projectRoot: string, nextConfigFileName
2525

2626
// Rename the original config file
2727
try {
28-
const originalContent = readFileSync(configPath, "utf-8");
29-
await writeFile(join(projectRoot, originalConfigName), originalContent);
28+
const originalPath = join(projectRoot, originalConfigName);
29+
await renamePromise(configPath, originalPath);
3030

3131
// Create a new config file with the appropriate import
3232
let importStatement;

0 commit comments

Comments
 (0)