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"
|
} from "./config"
|
||||||
|
|
||||||
export default function clean() {
|
export default function clean() {
|
||||||
/**
|
deleteDirectory(contentDirectoryPath)
|
||||||
* Delete directories
|
deleteDirectory(iconsDirectoryPath)
|
||||||
*/
|
|
||||||
|
|
||||||
|
deleteFile(mapFilePath)
|
||||||
|
deleteFile(portfolioFilePath)
|
||||||
|
deleteFile(searchIndexFilePath)
|
||||||
|
|
||||||
|
deleteFile("./public/img/skills.svg")
|
||||||
|
deleteFile("./public/img/projects.svg")
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteDirectory(path: string) {
|
||||||
try {
|
try {
|
||||||
fs.rmSync(contentDirectoryPath, { recursive: true })
|
fs.rmSync(path, { recursive: true })
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
}
|
||||||
try {
|
|
||||||
fs.rmSync(iconsDirectoryPath, { recursive: true })
|
function deleteFile(path: string) {
|
||||||
// eslint-disable-next-line no-empty
|
try {
|
||||||
} catch (err) {}
|
fs.unlinkSync(path)
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue