Compare commits

...
Author SHA1 Message Date
Eric Fennis 6d1fc51b9a Prepare @lucide/lab 0.2.0 release 2026-07-31 14:09:41 +02:00
Eric FennisandCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> 1502285072 fix(@lucide/lab): Fix lab build (#4618)
* chore(lab): Adjust build scripts

* add check workflow

* Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* update gitignore

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-07-31 09:11:20 +02:00
Karsa 240118e521 feat(icons): improve calendar icons centre of gravity (#4614)
* feat(icons): improve calendar icons centre of gravity

* fix(icons): reoptimize everything using Lucide Studio
2026-07-30 09:50:10 +02:00
39 changed files with 238 additions and 198 deletions
+30
View File
@@ -0,0 +1,30 @@
name: Lucide Lab checks
on:
pull_request:
paths:
- packages/lab/**
- packages/shared/**
- tools/build-icons/**
- tools/rollup-plugins/**
- pnpm-lock.yaml
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm --filter @lucide/lab build
-1
View File
@@ -61,4 +61,3 @@ docs/.vercel
docs/.nitro
docs/public/og/**
!docs/public/og/general.png
.gitignore
+5 -5
View File
@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M11 14h1v4" />
<path d="M16 2v4" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<rect x="3" y="4" width="18" height="18" rx="2" />
<path d="M11 13h1v4" />
<path d="M16 2v3" />
<path d="M3 9h18" />
<path d="M8 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
</svg>

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 355 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m14 18 4 4 4-4" />
<path d="M16 2v4" />
<path d="M18 14v8" />
<path d="M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="m14 17 4 4 4-4" />
<path d="M16 2v3" />
<path d="M18 13v8" />
<path d="M21 10.354V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h7.343" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 407 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m14 18 4-4 4 4" />
<path d="M16 2v4" />
<path d="M18 22v-8" />
<path d="M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="m14 17 4-4 4 4" />
<path d="M16 2v3" />
<path d="M18 21v-8" />
<path d="M21 10.343V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h9" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 404 B

+11 -5
View File
@@ -9,9 +9,15 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<path d="M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8" />
<path d="M3 10h18" />
<path d="m16 20 2 2 4-4" />
<path d="M 19 3 L 5 3" />
<path d="M 21 13 L 21 5" />
<path d="M 21 5 A2 2 0 0 0 19 3" />
<path d="M 3 19 A2 2 0 0 0 5 21" />
<path d="M 3 5 L 3 19" />
<path d="M 5 3 A2 2 0 0 0 3 5" />
<path d="m16 19 2 2 4-4" />
<path d="M16 2v3" />
<path d="M3 9h18" />
<path d="M5 21 L12.5 21" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 534 B

+5 -5
View File
@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="m9 16 2 2 4-4" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
<path d="m9 15 2 2 4-4" />
</svg>

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 358 B

+4 -4
View File
@@ -10,9 +10,9 @@
stroke-linejoin="round"
>
<path d="M16 14v2.2l1.6 1" />
<path d="M16 2v4" />
<path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" />
<path d="M3 10h5" />
<path d="M8 2v4" />
<path d="M16 2v3" />
<path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338" />
<path d="M3 9h5.859" />
<path d="M8 2v3" />
<circle cx="16" cy="16" r="6" />
</svg>

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 422 B

+6 -6
View File
@@ -11,15 +11,15 @@
>
<path d="m15.228 16.852-.923-.383" />
<path d="m15.228 19.148-.923.383" />
<path d="M16 2v4" />
<path d="M16 2v3" />
<path d="m16.47 14.305.382.923" />
<path d="m16.852 20.772-.383.924" />
<path d="m19.148 15.228.383-.923" />
<path d="m19.53 21.696-.382-.924" />
<path d="m20.772 16.852.924-.383" />
<path d="m20.772 19.148.924.383" />
<path d="M21 10.592V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="m20.773 16.852.924-.383" />
<path d="m20.773 19.148.924.383" />
<path d="M21 10.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h5.5" />
<path d="M3 9h18" />
<path d="M8 2v3" />
<circle cx="18" cy="18" r="3" />
</svg>

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 694 B

+10 -10
View File
@@ -9,14 +9,14 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="M8 14h.01" />
<path d="M12 14h.01" />
<path d="M16 14h.01" />
<path d="M8 18h.01" />
<path d="M12 18h.01" />
<path d="M16 18h.01" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
<path d="M8 13h.01" />
<path d="M12 13h.01" />
<path d="M16 13h.01" />
<path d="M8 17h.01" />
<path d="M12 17h.01" />
<path d="M16 17h.01" />
</svg>

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 483 B

+4 -5
View File
@@ -9,9 +9,8 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M3 20a2 2 0 0 0 2 2h10a2.4 2.4 0 0 0 1.706-.706l3.588-3.588A2.4 2.4 0 0 0 21 16V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z" />
<path d="M15 22v-5a1 1 0 0 1 1-1h5" />
<path d="M8 2v4" />
<path d="M16 2v4" />
<path d="M3 10h18" />
<path d="M16 2v3" />
<path d="M21 15V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h10v-5a1 1 0 011-1za2.4 2.4 0 01-.706 1.706l-3.588 3.588A2.4 2.4 0 0115 21" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 417 B

+5 -5
View File
@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12.127 22H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.125" />
<path d="M14.62 18.8A2.25 2.25 0 1 1 18 15.836a2.25 2.25 0 1 1 3.38 2.966l-2.626 2.856a.998.998 0 0 1-1.507 0z" />
<path d="M16 2v4" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="M12.127 21H5a2 2 0 01-2-2V5a2 2 0 012-2h14a2 2 0 012 2v5.125" />
<path d="M14.62 17.8A2.25 2.25 0 1118 14.836a2.25 2.25 0 113.38 2.966l-2.626 2.856a.998.998 0 01-1.507 0z" />
<path d="M16 2v3" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 464 B

+5 -5
View File
@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="M10 16h4" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
<path d="M10 15h4" />
</svg>

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 353 B

+5 -5
View File
@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16 19h6" />
<path d="M16 2v4" />
<path d="M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="M16 18h6" />
<path d="M16 2v3" />
<path d="M21 14V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 371 B

+5 -5
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18" />
<path d="M21 15.5V6a2 2 0 0 0-2-2H9.5" />
<path d="M16 2v4" />
<path d="M3 10h7" />
<path d="M21 10h-5.5" />
<path d="M16 2v3" />
<path d="m2 2 20 20" />
<path d="M21 9h-5.5" />
<path d="M3 9h6" />
<path d="M3.586 3.586A2 2 0 003 5v14a2 2 0 002 2h14a2 2 0 001.414-.586" />
<path d="M8.656 3H19a2 2 0 012 2v10.344" />
</svg>

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 428 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="M10 16h4" />
<path d="M12 14v4" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
<path d="M10 15h4" />
<path d="M12 13v4" />
</svg>

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 377 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16 19h6" />
<path d="M16 2v4" />
<path d="M19 16v6" />
<path d="M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="M16 18h6" />
<path d="M16 2v3" />
<path d="M19 15v6" />
<path d="M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 397 B

+8 -8
View File
@@ -9,12 +9,12 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M16 2v4" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<path d="M17 14h-6" />
<path d="M13 18H7" />
<path d="M7 14h.01" />
<path d="M17 18h.01" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M16 2v3" />
<path d="M3 9h18" />
<path d="M8 2v3" />
<path d="M17 13h-6" />
<path d="M13 17H7" />
<path d="M7 13h.01" />
<path d="M17 17h.01" />
</svg>

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 429 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M16 2v4" />
<path d="M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25" />
<path d="m22 22-1.875-1.875" />
<path d="M3 10h18" />
<path d="M8 2v4" />
<circle cx="18" cy="18" r="3" />
<path d="M16 2v3" />
<path d="M21 10.69V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h7.25" />
<path d="m22 21-1.875-1.875" />
<path d="M3 9h18" />
<path d="M8 2v3" />
<circle cx="18" cy="17" r="3" />
</svg>

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 420 B

+6 -6
View File
@@ -10,11 +10,11 @@
stroke-linejoin="round"
>
<path d="M11 10v4h4" />
<path d="m11 14 1.535-1.605a5 5 0 0 1 8 1.5" />
<path d="M16 2v4" />
<path d="m21 18-1.535 1.605a5 5 0 0 1-8-1.5" />
<path d="m11 14 1.535-1.605a5 5 0 018 1.5" />
<path d="M16 2v3" />
<path d="m21 18-1.535 1.605a5 5 0 01-8-1.5" />
<path d="M21 22v-4h-4" />
<path d="M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3" />
<path d="M3 10h4" />
<path d="M8 2v4" />
<path d="M21 8.517V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h3.517" />
<path d="M3 9h4" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 502 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<path d="M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8" />
<path d="M3 10h18" />
<path d="m17 22 5-5" />
<path d="m17 17 5 5" />
<path d="M16 2v3" />
<path d="m17 16 5 5" />
<path d="m17 21 5-5" />
<path d="M21 12V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8" />
<path d="M3 9h18" />
<path d="M8 2v3" />
</svg>

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 397 B

+6 -6
View File
@@ -9,10 +9,10 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="m14 14-4 4" />
<path d="m10 14 4 4" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
<path d="m14 13-4 4" />
<path d="m10 13 4 4" />
</svg>

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 381 B

+4 -4
View File
@@ -9,8 +9,8 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 2v4" />
<path d="M16 2v4" />
<rect width="18" height="18" x="3" y="4" rx="2" />
<path d="M3 10h18" />
<path d="M8 2v3" />
<path d="M16 2v3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 9h18" />
</svg>

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 329 B

+3 -3
View File
@@ -10,8 +10,8 @@
stroke-linejoin="round"
>
<path d="M16 2v2" />
<path d="M17.915 22a6 6 0 0 0-12 0" />
<path d="M17.915 21a6 6 0 10-12 0" />
<path d="M8 2v2" />
<circle cx="12" cy="12" r="4" />
<rect x="3" y="4" width="18" height="18" rx="2" />
<circle cx="12" cy="11" r="4" />
<rect x="3" y="3" width="18" height="18" rx="2" />
</svg>

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 381 B

+3 -3
View File
@@ -10,8 +10,8 @@
stroke-linejoin="round"
>
<path d="M16 2v2" />
<path d="M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2" />
<path d="M7 21v-2a2 2 0 012-2h6a2 2 0 012 2v2" />
<path d="M8 2v2" />
<circle cx="12" cy="11" r="3" />
<rect x="3" y="4" width="18" height="18" rx="2" />
<circle cx="12" cy="10" r="3" />
<rect x="3" y="3" width="18" height="18" rx="2" />
</svg>

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 393 B

+2
View File
@@ -0,0 +1,2 @@
icons
icon-nodes.json
+2 -2
View File
@@ -39,7 +39,7 @@ function App() {
```vue
<script setup>
import { burger } from '@lucide/lab';
import { Icon } from 'lucide-vue-next';
import { Icon } from '@lucide/vue';
</script>
<template>
@@ -70,7 +70,7 @@ import { atSignCircle } from '@lucide/lab';
```svelte
<script>
import { Icon } from 'lucide-svelte';
import { Icon } from '@lucide/svelte';
import { burger, sausage } from '@lucide/lab';
</script>
+11 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@lucide/lab",
"description": "Lucide lab is a project with icons that are nicely designed but have unknown use cases.",
"version": "0.1.2",
"version": "0.2.0",
"license": "ISC",
"homepage": "https://lucide.dev",
"bugs": "https://github.com/lucide-icons/lucide/issues",
@@ -24,20 +24,26 @@
"module": "dist/esm/lucide-lab.js",
"typings": "dist/lucide-lab.d.ts",
"sideEffects": false,
"files": [
"dist",
"icons",
"src",
"icon-nodes.json"
],
"scripts": {
"copy:license": "cp ../../LICENSE ./LICENSE",
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundle && pnpm build:lib",
"build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mjs --iconFileExtension=.ts --withAliases --exportModuleNameCasing=camel --renderUniqueKey --aliasNamesOnly --aliasesFileExtension=.ts --exportFileName=index.ts",
"build:lib": "node ./scripts/buildLib.mjs",
"build:icons": "build-icons --input=../../lab --output=./src --templateSrc=./scripts/exportTemplate.mts --iconFileExtension=.ts --exportModuleNameCasing=camel --renderUniqueKey --exportFileName=index.ts",
"build:lib": "node ./scripts/buildLib.mts",
"build:bundle": "rollup -c rollup.config.mjs",
"clean": "rm -f src/icons/*.ts && rm -rf dist",
"clean": "rm -f src/icons/*.ts && rm -rf dist && rm -rf icons && rm -f icon-nodes.json",
"version": "pnpm version --git-tag-version=false"
},
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/helpers": "workspace:*",
"@lucide/rollup-plugins": "workspace:*",
"minimist": "^1.2.8",
"@types/node": "^22.20.1",
"prettier": "^2.3.2",
"rollup": "^4.9.2",
"rollup-plugin-dts": "^6.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
import plugins from '@lucide/rollup-plugins';
import dts from 'rollup-plugin-dts';
import pkg from './package.json' assert { type: 'json' };
import pkg from './package.json' with { type: 'json' };
const outputFileName = 'lucide-lab';
const outputDir = 'dist';
-40
View File
@@ -1,40 +0,0 @@
/* eslint-disable import/no-extraneous-dependencies */
import fs from 'fs';
import path from 'path';
import getArgumentOptions from 'minimist';
import { parseSync } from 'svgson';
import { readSvgDirectory, getCurrentDirPath } from '@lucide/helpers';
import readSvgs from './readSvgs.mjs';
import generateIconNodes from './generateIconNodes.mjs';
import copyIcons from './copyIcons.mjs';
import pkg from '../package.json' assert { type: 'json' };
const cliArguments = getArgumentOptions(process.argv.slice(2));
const createDirectory = (dir) => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
};
const currentDir = getCurrentDirPath(import.meta.url);
const PACKAGE_DIR = path.resolve(currentDir, '../');
const ICONS_DIR = path.join(PACKAGE_DIR, '../../icons');
const license = `@license ${pkg.name} v${pkg.version} - ${pkg.license}`;
const svgFiles = await readSvgDirectory(ICONS_DIR);
const svgs = await readSvgs(svgFiles, ICONS_DIR);
const parsedSvgs = svgs.map(({ name, contents }) => ({
name,
contents,
parsedSvg: parseSync(contents),
}));
await Promise.all([
generateIconNodes(parsedSvgs, PACKAGE_DIR),
copyIcons(parsedSvgs, PACKAGE_DIR, license),
]);
+20
View File
@@ -0,0 +1,20 @@
import path from 'path';
import { readSvgDirectory, getCurrentDirPath } from '@lucide/helpers';
import readSvgs from './readSvgs.mts';
import generateIconNodes from './generateIconNodes.mts';
import copyIcons from './copyIcons.mts';
import pkg from '../package.json' with { type: 'json' };
const currentDir = getCurrentDirPath(import.meta.url);
const PACKAGE_DIR = path.resolve(currentDir, '../');
const ICONS_DIR = path.join(PACKAGE_DIR, '../../lab');
const license = `@license ${pkg.name} v${pkg.version} - ${pkg.license}`;
const svgFiles = await readSvgDirectory(ICONS_DIR);
const svgs = await readSvgs(svgFiles, ICONS_DIR);
await Promise.all([generateIconNodes(svgs, PACKAGE_DIR), copyIcons(svgs, PACKAGE_DIR, license)]);
@@ -1,13 +1,16 @@
import { writeFile } from 'fs/promises';
import { existsSync, unlinkSync, mkdirSync } from 'fs';
import { type SVGFile } from './readSvgs.mts';
export default async function copyIcons(parsedSvgs, packageDir, license) {
export default async function copyIcons(
parsedSvgs: SVGFile[],
packageDir: string,
license: string,
) {
const iconsDirectory = `${packageDir}/icons`;
if (existsSync(iconsDirectory)) {
try {
unlinkSync(iconsDirectory);
} catch (error) {}
unlinkSync(iconsDirectory);
}
if (!existsSync(iconsDirectory)) {
@@ -1,12 +1,13 @@
/* eslint-disable import/no-extraneous-dependencies */
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs';
import base64SVG from '@lucide/build-icons/utils/base64SVG';
import defineExportTemplate from '@lucide/build-icons/utils/defineExportTemplate';
import { toCamelCase } from '@lucide/helpers';
export default ({ componentName, iconName, children, getSvg, deprecated }) => {
const svgContents = getSvg();
const svgBase64 = base64SVG(svgContents);
export default defineExportTemplate(
async ({ componentName, iconName, children, getSvg, deprecated, deprecationReason }) => {
const svgContents = await getSvg();
const svgBase64 = base64SVG(svgContents);
return `
return `
import type { IconNode } from '../types';
/**
@@ -17,10 +18,11 @@ import type { IconNode } from '../types';
* @see https://lucide.dev/guide/packages/lucide - Documentation
*
* @returns {Array}
* ${deprecated ? '@deprecated' : ''}
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
const ${toCamelCase(componentName)}: IconNode = ${JSON.stringify(children)};
export default ${toCamelCase(componentName)};
`;
};
},
);
@@ -1,11 +1,12 @@
import { writeFile } from '@lucide/helpers';
import { type SVGFile } from './readSvgs.mts';
export default async function generateIconNodes(parsedSvgs, packageDir) {
export default async function generateIconNodes(parsedSvgs: SVGFile[], packageDir: string) {
const iconNodes = parsedSvgs.reduce((acc, { name, parsedSvg }) => {
acc[name] = parsedSvg.children.map(({ name, attributes }) => [name, attributes]);
return acc;
}, {});
}, {} as Record<string, [string, Record<string, unknown> | undefined][]>);
const iconNodesStringified = JSON.stringify(iconNodes, null, 2);
@@ -1,6 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */
import { basename } from 'path';
import { readSvg } from '@lucide/helpers';
import { type INode, parseSync } from 'svgson';
/**
* Build an object in the format: `{ <name>: <contents> }`.
@@ -8,13 +9,23 @@ import { readSvg } from '@lucide/helpers';
* @param {Function} getSvg - A function that returns the contents of an SVG file given a filename.
* @returns {Object}
*/
export default async function readSVGs(svgFiles, iconsDirectory) {
const svgReadPromises = svgFiles.map(async (svgFile) => {
export default function readSVGs(svgFiles: string[], iconsDirectory: string) {
const SVGReadPromises = svgFiles.map(async (svgFile) => {
const name = basename(svgFile, '.svg');
const contents = await readSvg(svgFile, iconsDirectory);
return { name, contents };
return {
name,
contents,
parsedSvg: parseSync(contents),
};
});
return Promise.all(svgReadPromises);
return Promise.all(SVGReadPromises);
}
export type SVGFile = {
name: string;
contents: string;
parsedSvg: INode;
};
-1
View File
@@ -1,2 +1 @@
export * from './icons';
export * from './aliases';
+1
View File
@@ -11,6 +11,7 @@
"allowJs": true,
"lib": ["esnext", "dom"],
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"sourceMap": true,
"outDir": "./dist",
},
+3 -3
View File
@@ -406,9 +406,9 @@ importers:
'@lucide/rollup-plugins':
specifier: workspace:*
version: link:../../tools/rollup-plugins
minimist:
specifier: ^1.2.8
version: 1.2.8
'@types/node':
specifier: ^22.20.1
version: 22.20.1
prettier:
specifier: ^2.3.2
version: 2.8.8
+2 -1
View File
@@ -34,11 +34,12 @@ interface CliArguments {
useDefaultExports?: boolean;
pretty?: boolean;
output: string | undefined;
input: string | undefined;
}
const cliArguments = getArgumentOptions(process.argv.slice(2)) as unknown as CliArguments;
const ICONS_DIR = path.resolve(process.cwd(), '../../icons');
const ICONS_DIR = path.resolve(process.cwd(), cliArguments.input || '../../icons');
const OUTPUT_DIR = path.resolve(process.cwd(), cliArguments.output || '../build');
if (!fs.existsSync(OUTPUT_DIR)) {