1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00

Drop del-cli dependency (#10652)

This commit is contained in:
Álvaro Mondéjar 2024-03-19 13:35:59 +01:00 committed by GitHub
parent 33f7d01c38
commit 1350a52726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View File

@ -86,7 +86,6 @@
"devDependencies": {
"@inquirer/prompts": "4.3.0",
"chalk": "5.3.0",
"del-cli": "5.1.0",
"editorconfig-checker": "5.1.5",
"esbuild": "0.19.4",
"fake-diff": "1.0.0",
@ -108,7 +107,7 @@
},
"scripts": {
"build": "node scripts/build/package.js",
"clean": "del-cli index.js index.mjs index.d.ts sdk.js",
"clean": "node scripts/build/clean.js",
"format": "prettier --cache --write .",
"lint": "npm run ourlint && npm run jslint && npm run jsonlint && npm run svglint && npm run wslint",
"ourlint": "node scripts/lint/ourlint.js",

29
scripts/build/clean.js Normal file
View File

@ -0,0 +1,29 @@
/**
* @fileoverview
* Clean files built by the build process.
*/
import fs from 'node:fs';
import path from 'node:path';
import { getDirnameFromImportMeta } from '../../sdk.mjs';
const __dirname = getDirnameFromImportMeta(import.meta.url);
const rootDirectory = path.resolve(__dirname, '..', '..');
const files = ['index.js', 'index.mjs', 'index.d.ts', 'sdk.js'];
const fileExists = (fpath) =>
new Promise((r) => fs.access(fpath, fs.constants.F_OK, (e) => r(!e)));
Promise.all(
files.map(async (file) => {
const filepath = path.join(rootDirectory, file);
if (!(await fileExists(filepath))) {
console.error(`File ${file} does not exist, skipping...`);
return;
}
return fs.promises.unlink(filepath);
}),
).catch((error) => {
console.error(`Error cleaning files: ${error.message}`);
process.exit(1);
});