mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 16:17:42 +01:00
refactor: Adds repo shared package @lucide/shared (#1904)
* Fixed import of toKebabCase helper function * Added utils package * utils * Make utils package work in build * Add lucide-shared * Transpile solid with esbuild * Fix resolve modules * Cleanup * Format files * Fix properties plugins function * Fix properties plugins in lucide package * Revert remove resolve plugin and cleanup * Update snapshots * Revert icon changes --------- Co-authored-by: Rohan <rohancrrm@gmail.com>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
"devDependencies": {
|
||||
"@lucide/build-icons": "workspace:*",
|
||||
"@lucide/rollup-plugins": "workspace:*",
|
||||
"@lucide/shared": "workspace:*",
|
||||
"@testing-library/jest-dom": "^6.1.6",
|
||||
"@testing-library/vue": "^8.0.1",
|
||||
"@vitejs/plugin-vue": "^4.6.2",
|
||||
|
||||
@@ -35,7 +35,7 @@ const configs = bundles
|
||||
.map(({ inputs, outputDir, format, minify, preserveModules }) =>
|
||||
inputs.map((input) => ({
|
||||
input,
|
||||
plugins: plugins(pkg, minify),
|
||||
plugins: plugins({ pkg, minify }),
|
||||
external: ['vue'],
|
||||
output: {
|
||||
name: packageName,
|
||||
@@ -48,6 +48,7 @@ const configs = bundles
|
||||
}),
|
||||
format,
|
||||
preserveModules,
|
||||
preserveModulesRoot: 'src',
|
||||
sourcemap: true,
|
||||
globals: {
|
||||
vue: 'vue',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { h } from 'vue';
|
||||
import type { SVGAttributes, FunctionalComponent, DefineComponent } from 'vue';
|
||||
import type { SVGAttributes, FunctionalComponent } from 'vue';
|
||||
import defaultAttributes from './defaultAttributes';
|
||||
import { toKebabCase } from '@lucide/shared';
|
||||
|
||||
// Create interface extending SVGAttributes
|
||||
export interface SVGProps extends Partial<SVGAttributes> {
|
||||
@@ -11,17 +12,13 @@ export interface SVGProps extends Partial<SVGAttributes> {
|
||||
|
||||
export type IconNode = [elementName: string, attrs: Record<string, string>][];
|
||||
export type Icon = FunctionalComponent<SVGProps>;
|
||||
/**
|
||||
* Converts string to KebabCase
|
||||
* Copied from scripts/helper. If anyone knows how to properly import it here
|
||||
* then please fix it.
|
||||
*
|
||||
* @param {string} string
|
||||
* @returns {string} A kebabized string
|
||||
*/
|
||||
export const toKebabCase = (string: string) =>
|
||||
string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
|
||||
/**
|
||||
* Create a Lucide icon component
|
||||
* @param {string} iconName
|
||||
* @param {array} iconNode
|
||||
* @returns {FunctionalComponent} LucideIcon
|
||||
*/
|
||||
const createLucideIcon =
|
||||
(iconName: string, iconNode: IconNode): Icon =>
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user