Skip to content

Commit

Permalink
imp: prevent running documentation task if no new icons have been added
Browse files Browse the repository at this point in the history
  • Loading branch information
NOMADE55 committed Dec 13, 2024
1 parent 65073fc commit 09ba212
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/icons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { dirname, fromFileUrl, join } from '@std/path';
import { getFiles, replaceBetween, writeFile } from './utils.ts';
import { iconNames as icons } from '../icons/index.ts';

const SUPPORTED_ICONS_FLAG_START = '<!-- SUPPORTED:ICONS:START -->';
const SUPPORTED_ICONS_FLAG_END = '<!-- SUPPORTED:ICONS:END -->';
Expand All @@ -12,6 +13,12 @@ const files = await getFiles(iconsDir);

const iconNames = files.filter(({ name }) => name.split('.').pop() === 'svg')
.map(({ name }) => name.split('.').shift()).sort();
const diff = iconNames.length - icons.length;

if (diff === 0) {
console.log('Nothing to update!');
Deno.exit(2);
}

// Update Index File
writeFile(
Expand Down Expand Up @@ -46,3 +53,4 @@ writeFile(
);

console.log('%cReadme file updated!', 'color: green');
console.log(`%cAdded new ${diff} icons!`, 'color: green');

0 comments on commit 09ba212

Please sign in to comment.