Skip to content

Commit

Permalink
fix rm
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslemammad committed Dec 5, 2023
1 parent 2f62b9d commit 368b20d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/waku/src/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
mkdir,
readFile,
writeFile,
rmdir,
rm,
} from './utils/node-fs.js';
import { encodeInput, generatePrefetchCode } from './middleware/rsc/utils.js';
import { renderRSC, getBuildConfigRSC } from './rsc/renderer.js';
Expand Down Expand Up @@ -297,7 +297,7 @@ const emitHtmlFiles = async (
});

// https://github.com/dai-shi/waku/pull/181#discussion_r1412744262
await rmdir(dirname(publicIndexHtmlFile));
await rm(dirname(publicIndexHtmlFile), { force: true, recursive: true });
clientBuildOutput.output.splice(
clientBuildOutput.output.findIndex(
(v) => v.fileName === joinPath(config.srcDir, config.indexHtml),
Expand Down
5 changes: 3 additions & 2 deletions packages/waku/src/lib/utils/node-fs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path';
import fs from 'node:fs';
import type { RmOptions } from 'node:fs';
import fsPromises from 'node:fs/promises';

const filePathToOsPath = (filePath: string) =>
Expand Down Expand Up @@ -31,5 +32,5 @@ export const writeFile = (filePath: string, content: string) =>
export const stat = (filePath: string) =>
fsPromises.stat(filePathToOsPath(filePath));

export const rmdir = (dirPath: string) =>
fsPromises.rmdir(filePathToOsPath(dirPath));
export const rm = (dirPath: string, options?: RmOptions) =>
fsPromises.rm(filePathToOsPath(dirPath), options);

0 comments on commit 368b20d

Please sign in to comment.