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

38 lines
719 B
JavaScript
Raw Permalink Normal View History

2024-03-25 01:38:18 +08:00
#!/usr/bin/env node
// @ts-check
2024-03-19 13:35:59 +01:00
/**
2024-06-06 14:40:35 +02:00
* @file
2024-03-19 13:35:59 +01:00
* Clean files built by the build process.
*/
2024-03-25 01:38:18 +08:00
import fs from 'node:fs/promises';
2024-03-19 13:35:59 +01:00
import path from 'node:path';
2024-03-25 01:38:18 +08:00
import process from 'node:process';
import {fileExists} from '../utils.js';
2024-03-19 13:35:59 +01:00
const files = [
'index.js',
'index-icons.js',
'index.mjs',
'index-icons.mjs',
'index.d.ts',
'sdk.js',
];
2024-03-19 13:35:59 +01:00
2024-03-25 01:38:18 +08:00
try {
2024-12-21 22:49:25 +08:00
Promise.all(
files.map(async (file) => {
const filepath = path.resolve(import.meta.dirname, '..', '..', file);
2024-12-21 22:49:25 +08:00
if (!(await fileExists(filepath))) {
console.error(`File ${file} does not exist, skipping...`);
return;
}
2024-03-25 01:38:18 +08:00
2024-12-21 22:49:25 +08:00
return fs.unlink(filepath);
}),
);
2024-03-25 01:38:18 +08:00
} catch (error) {
2024-12-21 22:49:25 +08:00
console.error('Error cleaning files:', error);
process.exit(1);
2024-03-25 01:38:18 +08:00
}