mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-15 21:37:43 +01:00
* Adjust typescript types * adjust types * fix types in all helper files * Fix types * Migrate js files to ts files * Refactor to TS files * Rename extentions * Adjust imports * Fix builds * Update lockfile * Fix last typescript migration * Fix entry path @lucide/outline-svg * Fix types * add checkout step * format files * Format files
33 lines
962 B
TypeScript
33 lines
962 B
TypeScript
import path from 'path';
|
|
import { getCurrentDirPath } from '../../tools/build-helpers/helpers.ts';
|
|
import { renameIcon } from './renameIcon.function.mts';
|
|
|
|
async function main() {
|
|
const oldName = path.basename(process.argv[2]).replace(/\.[^/.]+$/, '');
|
|
const newName = path.basename(process.argv[3]).replace(/\.[^/.]+$/, '');
|
|
|
|
if (!newName || !oldName) {
|
|
console.error('Usage: node ./scripts/renameIcon.mjs <oldIcon> <newIcon>');
|
|
process.exit(1);
|
|
}
|
|
if (oldName === newName) {
|
|
console.error('ERROR: Old name and new name are the same');
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
const currentDir = getCurrentDirPath(import.meta.url);
|
|
const ICONS_DIR = path.resolve(currentDir, '../../icons');
|
|
await renameIcon(ICONS_DIR, oldName, newName);
|
|
} catch (err) {
|
|
if(err instanceof Error) {
|
|
console.error(err.message);
|
|
} else {
|
|
console.error('An unexpected error occurred:', err);
|
|
}
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
main();
|