Skip to content

Commit

Permalink
chore: correctly clean relative to version path
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 27, 2023
1 parent a26d304 commit 140a118
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,24 @@ const tests = [

function deleteAllHtmlFiles() {
try {
fs.unlinkSync('./index.html');
console.log('Delete', path.join(versionObj.versionedPath, 'index.html'));
fs.unlinkSync(path.join(versionObj.versionedPath, 'index.html'));
} catch (err) {
if (err.code !== 'ENOENT') {
throw err;
}
}
const foldersToClean = [
'./docs',
'./docs/tutorials',
'./docs/typescript',
'./docs/api',
'./docs/source/_docs',
path.join('.', versionObj.versionedPath, 'docs'),
path.join('.', versionObj.versionedPath, 'docs', 'tutorials'),
path.join('.', versionObj.versionedPath, 'docs', 'typescript'),
path.join('.', versionObj.versionedPath, 'docs', 'api'),
path.join('.', versionObj.versionedPath, 'docs', 'source', '_docs'),
'./tmp'
];
for (const folder of foldersToClean) {
let files = [];

try {
files = fs.readdirSync(folder);
} catch (err) {
Expand All @@ -104,7 +106,8 @@ function deleteAllHtmlFiles() {
}
for (const file of files) {
if (file.endsWith('.html')) {
fs.unlinkSync(`${folder}/${file}`);
console.log('Delete', path.join(folder, file));
fs.unlinkSync(path.join(folder, file));
}
}
}
Expand Down

0 comments on commit 140a118

Please sign in to comment.