-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Clean public dir on force instead of deleting
Deleting the public dir recursively (previous approach) is not possible in Docker where the public dir is mounted. This changes the behavior to clean the directory instead, i.e. to delete each file/folder inside the public dir.
- Loading branch information
Showing
2 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,8 @@ or email [email protected] <mailto:[email protected]> | |
import { path } from "../deps.ts"; | ||
import type { | ||
FileReader, | ||
OutputFileWriterCreator, | ||
Location, | ||
OutputFileWriterCreator, | ||
StaticFileWriterCreator, | ||
} from "../domain.ts"; | ||
import { ContentType } from "../domain.ts"; | ||
|
@@ -35,7 +35,7 @@ export const readContentFile: FileReader = () => | |
async (location) => { | ||
if (location.type === ContentType.Page) { | ||
const content = await Deno.readTextFile(location.inputPath); | ||
location | ||
location; | ||
return { | ||
type: ContentType.Page, | ||
location: location as Location<ContentType.Page>, | ||
|
@@ -64,3 +64,9 @@ export const createStaticFileWriter: StaticFileWriterCreator = ({ log }) => | |
await Deno.copyFile(location.inputPath, location.outputPath); | ||
log?.info(`Copied static file to ${location.outputPath}`); | ||
}; | ||
|
||
export const cleanDirectory = async (dirpath: DirectoryPath): Promise<void> => { | ||
for await (const dirEntry of Deno.readDir(dirpath)) { | ||
await Deno.remove(path.join(dirpath, dirEntry.name), { recursive: true }); | ||
} | ||
}; |