1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2025-07-02 22:16:54 +02:00
Files
simple-icons/scripts/build/clean.js
2025-06-25 22:55:30 +08:00

38 lines
719 B
JavaScript

#!/usr/bin/env node
// @ts-check
/**
* @file
* Clean files built by the build process.
*/
import fs from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
import {fileExists} from '../utils.js';
const files = [
'index.js',
'index-icons.js',
'index.mjs',
'index-icons.mjs',
'index.d.ts',
'sdk.js',
];
try {
Promise.all(
files.map(async (file) => {
const filepath = path.resolve(import.meta.dirname, '..', '..', file);
if (!(await fileExists(filepath))) {
console.error(`File ${file} does not exist, skipping...`);
return;
}
return fs.unlink(filepath);
}),
);
} catch (error) {
console.error('Error cleaning files:', error);
process.exit(1);
}