simplified cleaning logic
This commit is contained in:
parent
5e3418b8e3
commit
3306c1e3a8
1 changed files with 19 additions and 28 deletions
|
@ -9,36 +9,27 @@ import {
|
|||
} from "./config"
|
||||
|
||||
export default function clean() {
|
||||
/**
|
||||
* Delete directories
|
||||
*/
|
||||
deleteDirectory(contentDirectoryPath)
|
||||
deleteDirectory(iconsDirectoryPath)
|
||||
|
||||
deleteFile(mapFilePath)
|
||||
deleteFile(portfolioFilePath)
|
||||
deleteFile(searchIndexFilePath)
|
||||
|
||||
deleteFile("./public/img/skills.svg")
|
||||
deleteFile("./public/img/projects.svg")
|
||||
}
|
||||
|
||||
function deleteDirectory(path: string) {
|
||||
try {
|
||||
fs.rmSync(contentDirectoryPath, { recursive: true })
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
fs.rmSync(iconsDirectoryPath, { recursive: true })
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
|
||||
/**
|
||||
* Delete folders
|
||||
*/
|
||||
|
||||
try {
|
||||
fs.unlinkSync(mapFilePath)
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
fs.unlinkSync(portfolioFilePath)
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
fs.unlinkSync(searchIndexFilePath)
|
||||
fs.rmSync(path, { recursive: true })
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
function deleteFile(path: string) {
|
||||
try {
|
||||
fs.unlinkSync(path)
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (err) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue