Chore: minor changes

This commit is contained in:
SukkaW
2024-12-16 22:39:39 +08:00
parent f706b8fdc4
commit 730eec003e
3 changed files with 23 additions and 27 deletions

View File

@@ -63,7 +63,18 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
const extract = tarExtract(
publicDir,
{
ignore: tarOnIgnore,
ignore(_: string, header?: TarEntryHeaders) {
if (header) {
if (header.type !== 'file' && header.type !== 'directory') {
return true;
}
if (header.type === 'file' && path.extname(header.name) === '.ts') {
return true;
}
}
return false;
},
map(header) {
header.name = header.name.replace(pathPrefix, '');
return header;
@@ -78,18 +89,3 @@ export const downloadPreviousBuild = task(require.main === module, __filename)(a
);
});
});
function tarOnIgnore(_: string, header?: TarEntryHeaders) {
if (header) {
if (header.type !== 'file' && header.type !== 'directory') {
return true;
}
const extname = path.extname(header.name);
if (extname === '.ts') {
return true;
}
}
return false;
}