Skip to content

Commit 140a118

Browse files
committed
chore: correctly clean relative to version path
1 parent a26d304 commit 140a118

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/website.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,24 @@ const tests = [
7979

8080
function deleteAllHtmlFiles() {
8181
try {
82-
fs.unlinkSync('./index.html');
82+
console.log('Delete', path.join(versionObj.versionedPath, 'index.html'));
83+
fs.unlinkSync(path.join(versionObj.versionedPath, 'index.html'));
8384
} catch (err) {
8485
if (err.code !== 'ENOENT') {
8586
throw err;
8687
}
8788
}
8889
const foldersToClean = [
89-
'./docs',
90-
'./docs/tutorials',
91-
'./docs/typescript',
92-
'./docs/api',
93-
'./docs/source/_docs',
90+
path.join('.', versionObj.versionedPath, 'docs'),
91+
path.join('.', versionObj.versionedPath, 'docs', 'tutorials'),
92+
path.join('.', versionObj.versionedPath, 'docs', 'typescript'),
93+
path.join('.', versionObj.versionedPath, 'docs', 'api'),
94+
path.join('.', versionObj.versionedPath, 'docs', 'source', '_docs'),
9495
'./tmp'
9596
];
9697
for (const folder of foldersToClean) {
9798
let files = [];
99+
98100
try {
99101
files = fs.readdirSync(folder);
100102
} catch (err) {
@@ -104,7 +106,8 @@ function deleteAllHtmlFiles() {
104106
}
105107
for (const file of files) {
106108
if (file.endsWith('.html')) {
107-
fs.unlinkSync(`${folder}/${file}`);
109+
console.log('Delete', path.join(folder, file));
110+
fs.unlinkSync(path.join(folder, file));
108111
}
109112
}
110113
}

0 commit comments

Comments
 (0)