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:
parent
33f7d01c38
commit
1350a52726
@ -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
29
scripts/build/clean.js
Normal 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);
|
||||
});
|
Loading…
Reference in New Issue
Block a user