Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and general improvements in packages #1773

Merged
merged 6 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/lucide-figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react": "^1.0.0",
"typescript": "^4.3.2",
"vite": "^4.4.12",
"vitest": "^0.32.2",
"vite": "5.0.10",
"vite-plugin-singlefile": "^0.5.1"
}
}
17 changes: 9 additions & 8 deletions packages/lucide-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"keywords": [
"Lucide",
"Angular",
"Preact",
"Feather",
"Icons",
"Icon",
Expand All @@ -33,11 +33,10 @@
],
"sideEffects": false,
"scripts": {
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundles && pnpm build:types",
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundles",
"copy:license": "cp ../../LICENSE ./LICENSE",
"clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.js",
"build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey --withAliases --aliasesFileExtension=.ts --iconFileExtension=.ts --exportFileName=index.ts",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "vitest run",
"version": "pnpm version --git-tag-version=false"
Expand All @@ -47,12 +46,14 @@
"@lucide/rollup-plugins": "workspace:*",
"@preact/preset-vite": "^2.7.0",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/preact": "^2.0.1",
"@testing-library/preact": "^3.2.3",
"jest-serializer-html": "^7.1.0",
"preact": "^10.19.2",
"rollup": "^3.29.4",
"typescript": "^4.9.5",
"vite": "^4.4.12",
"vitest": "^0.32.4"
"rollup": "^4.9.2",
"rollup-plugin-dts": "^6.1.0",
"typescript": "^5.3.3",
"vite": "5.0.10",
"vitest": "^1.1.1"
},
"peerDependencies": {
"preact": "^10.5.13"
Expand Down
16 changes: 13 additions & 3 deletions packages/lucide-preact/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import plugins, { replace } from '@lucide/rollup-plugins';
import dts from "rollup-plugin-dts";
import pkg from './package.json' assert { type: "json" };

const packageName = 'LucidePreact';
Expand Down Expand Up @@ -49,7 +50,7 @@ const configs = bundles
),
...plugins(pkg, minify)
],
external: ['preact', 'prop-types'],
external: ['preact'],
output: {
name: packageName,
...(preserveModules
Expand All @@ -64,11 +65,20 @@ const configs = bundles
sourcemap: true,
globals: {
preact: 'preact',
'prop-types': 'PropTypes',
},
},
})),
)
.flat();

export default configs;
export default [
{
input: inputs[0],
output: [{
file: `dist/${outputFileName}.d.ts`, format: "es"
}],
plugins: [dts()],
},
...configs
];

92 changes: 0 additions & 92 deletions packages/lucide-preact/scripts/buildTypes.mjs

This file was deleted.

10 changes: 6 additions & 4 deletions packages/lucide-preact/src/createLucideIcon.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { ComponentType, FunctionComponent, h, JSX, RefObject, toChildArray } from 'preact';
import { type FunctionComponent, h, type JSX, toChildArray } from 'preact';
import defaultAttributes from './defaultAttributes';

type IconNode = [elementName: keyof JSX.IntrinsicElements, attrs: Record<string, string>][]
export type IconNode = [elementName: keyof JSX.IntrinsicElements, attrs: Record<string, string>][]

interface LucideProps extends Partial<Omit<JSX.SVGAttributes, "ref" | "size">> {
export interface LucideProps extends Partial<Omit<JSX.SVGAttributes, "ref" | "size">> {
color?: string
size?: string | number
strokeWidth?: string | number
absoluteStrokeWidth?: boolean
}

export type LucideIcon = FunctionComponent<LucideProps>

/**
* Converts string to KebabCase
* Copied from scripts/helper. If anyone knows how to properly import it here
Expand All @@ -20,7 +22,7 @@ interface LucideProps extends Partial<Omit<JSX.SVGAttributes, "ref" | "size">> {
*/
export const toKebabCase = (string: string) => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();

const createLucideIcon = (iconName: string, iconNode: IconNode): FunctionComponent<LucideProps> => {
const createLucideIcon = (iconName: string, iconNode: IconNode): LucideIcon => {
const Component = (
{ color = 'currentColor', size = 24, strokeWidth = 2, absoluteStrokeWidth, children, class: classes = '', ...rest }: LucideProps
) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,93 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Using lucide icon components > should adjust the size, stroke color and stroke width 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"48\\" height=\\"48\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" stroke=\\"red\\" stroke-width=\\"4\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" class=\\"lucide lucide-grid3x3 \\" data-testid=\\"grid-icon\\"><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\"></rect><path d=\\"M3 9h18\\"></path><path d=\\"M3 15h18\\"></path><path d=\\"M9 3v18\\"></path><path d=\\"M15 3v18\\"></path></svg>"`;
exports[`Using lucide icon components > should adjust the size, stroke color and stroke width 1`] = `
<svg xmlns="http://www.w3.org/2000/svg"
width="48"
height="48"
viewbox="0 0 24 24"
fill="none"
stroke="red"
stroke-width="4"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-grid3x3 "
data-testid="grid-icon"
>
<rect width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path d="M3 9h18">
</path>
<path d="M3 15h18">
</path>
<path d="M9 3v18">
</path>
<path d="M15 3v18">
</path>
</svg>
`;

exports[`Using lucide icon components > should not scale the strokeWidth when absoluteStrokeWidth is set 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"48\\" height=\\"48\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" stroke=\\"red\\" stroke-width=\\"1\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" class=\\"lucide lucide-grid3x3 \\" data-testid=\\"grid-icon\\"><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\"></rect><path d=\\"M3 9h18\\"></path><path d=\\"M3 15h18\\"></path><path d=\\"M9 3v18\\"></path><path d=\\"M15 3v18\\"></path></svg>"`;
exports[`Using lucide icon components > should not scale the strokeWidth when absoluteStrokeWidth is set 1`] = `
<svg xmlns="http://www.w3.org/2000/svg"
width="48"
height="48"
viewbox="0 0 24 24"
fill="none"
stroke="red"
stroke-width="1"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-grid3x3 "
data-testid="grid-icon"
>
<rect width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path d="M3 9h18">
</path>
<path d="M3 15h18">
</path>
<path d="M9 3v18">
</path>
<path d="M15 3v18">
</path>
</svg>
`;

exports[`Using lucide icon components > should render an component 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" stroke=\\"currentColor\\" stroke-width=\\"2\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" class=\\"lucide lucide-grid3x3 \\"><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\"></rect><path d=\\"M3 9h18\\"></path><path d=\\"M3 15h18\\"></path><path d=\\"M9 3v18\\"></path><path d=\\"M15 3v18\\"></path></svg>"`;
exports[`Using lucide icon components > should render an component 1`] = `
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-grid3x3 "
>
<rect width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path d="M3 9h18">
</path>
<path d="M3 15h18">
</path>
<path d="M9 3v18">
</path>
<path d="M15 3v18">
</path>
</svg>
`;
4 changes: 4 additions & 0 deletions packages/lucide-preact/tests/setupVitest.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
import { expect } from 'vitest'
import '@testing-library/jest-dom';
import htmlSerializer from 'jest-serializer-html'

expect.addSnapshotSerializer(htmlSerializer)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
transformMode: {
web: [/\.jsx?$/],
},
setupFiles: './tests/setupVitest.js',
threads: false,
isolate: false,
},
resolve: {
mainFields: ['module'],
Expand Down
25 changes: 12 additions & 13 deletions packages/lucide-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"keywords": [
"Lucide",
"Angular",
"React Native",
"Feather",
"Icons",
"Icon",
Expand All @@ -34,35 +34,34 @@
"dist"
],
"scripts": {
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundles && pnpm build:types",
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundles",
"copy:license": "cp ../../LICENSE ./LICENSE",
"clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.js",
"build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mjs --renderUniqueKey --iconFileExtension=.ts --exportFileName=index.ts --withAliases --aliasesFileExtension=.ts",
"build:types": "node ./scripts/buildTypes.mjs",
"build:bundles": "rollup -c ./rollup.config.mjs",
"test": "vitest run",
"version": "pnpm version --git-tag-version=false"
},
"devDependencies": {
"@lucide/rollup-plugins": "workspace:*",
"@lucide/build-icons": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/jest-dom": "^6.1.6",
"@testing-library/react": "^14.1.2",
"@types/prop-types": "^15.7.5",
"@types/react": "^18.0.21",
"@vitejs/plugin-react": "^2.1.0",
"prop-types": "^15.7.2",
"@vitejs/plugin-react": "^4.2.1",
"jest-serializer-html": "^7.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-native": "^0.69.0",
"react-native-svg": "^14.0.0",
"rollup": "^3.5.1",
"react-native": "^0.73.1",
"react-native-svg": "^14.1.0",
"rollup": "^4.9.2",
"rollup-plugin-dts": "^6.1.0",
"typescript": "^4.8.4",
"vite": "^4.4.12",
"vitest": "^0.32.2"
"vite": "5.0.10",
"vitest": "^1.1.1"
},
"peerDependencies": {
"prop-types": "^15.7.2",
"react": "^16.5.1 || ^17.0.0 || ^18.0.0",
"react-native": "*",
"react-native-svg": "^12.0.0 || ^13.0.0 || ^14.0.0"
Expand Down
Loading