-
-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed export maps, types, and packaging for
lucide-svelte
(#1707)
* add extensions for `NodeNext` support * fixed exports map and replaced the packaging system for `@sveltejs/pacakge` * lockfile * ignore generated `.svelte-kit` dir * no longer needed * fixed main export * fixed IconNode and IconProps types * have icon props extend svg attributes * build script for prepending the license to each `dist` file * Update packages/lucide-svelte/scripts/addLicense.mjs --------- Co-authored-by: Eric Fennis <[email protected]>
- Loading branch information
1 parent
0a69fb9
commit e71a776
Showing
8 changed files
with
138 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
src/icons/*.svelte | ||
.svelte-kit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { getCurrentDirPath } from '../../../scripts/helpers.mjs'; | ||
import { lstatSync } from 'fs'; | ||
import { readdir, readFile, writeFile } from 'fs/promises'; | ||
import path from 'path'; | ||
import pkg from '../package.json' assert { type: 'json' }; | ||
|
||
const BANNER = `@license ${pkg.name} v${pkg.version} - ${pkg.license} | ||
This source code is licensed under the ${pkg.license} license. | ||
See the LICENSE file in the root directory of this source tree.`; | ||
|
||
const currentDir = getCurrentDirPath(import.meta.url); | ||
const targetDirectory = path.join(currentDir, '../dist'); | ||
|
||
const files = await readdir(targetDirectory, { | ||
recursive: true, | ||
encoding: 'utf-8', | ||
}); | ||
|
||
for (const file of files) { | ||
const filepath = path.join(targetDirectory, file); | ||
const filestat = lstatSync(filepath); | ||
|
||
if (filestat.isFile() === false || filestat.isDirectory()) continue; | ||
|
||
const contents = await readFile(filepath, { encoding: 'utf-8' }); | ||
const ext = path.extname(filepath); | ||
let license; | ||
|
||
if (/\.(js|mjs|cjs|ts)/.test(ext)) { | ||
license = getJSBanner(); | ||
} | ||
|
||
if (/\.svelte/.test(ext)) { | ||
license = getSvelteBanner(); | ||
} | ||
|
||
if (license) { | ||
await writeFile(filepath, license + contents, { encoding: 'utf-8' }); | ||
} | ||
} | ||
|
||
function getJSBanner() { | ||
return `/** | ||
* ${BANNER} | ||
*/ | ||
\n`; | ||
} | ||
|
||
function getSvelteBanner() { | ||
return `<!-- | ||
${BANNER} | ||
--> | ||
\n`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export * from './icons'; | ||
export * as icons from './icons'; | ||
export * from './aliases'; | ||
export { default as defaultAttributes } from './defaultAttributes' | ||
export * from './icons/index.js'; | ||
export * as icons from './icons/index.js'; | ||
export * from './aliases.js'; | ||
export { default as defaultAttributes } from './defaultAttributes.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
/// <reference types="svelte" /> | ||
/// <reference types="svelte2tsx/svelte-jsx" /> | ||
import type { SVGAttributes, SvelteHTMLElements } from 'svelte/elements'; | ||
|
||
export type Attrs = svelte.JSX.SVGProps<SVGSVGElement> | ||
export type IconNode = [elementName: keyof svelte.JSX.IntrinsicElements, attrs: Attrs][] | ||
type SVGAttrs = SVGAttributes<SVGSVGElement>; | ||
|
||
export type IconNode = [elementName: keyof SvelteHTMLElements, attrs: SVGAttrs][]; | ||
|
||
export interface IconProps extends SVGAttrs { | ||
color?: string; | ||
size?: number | string; | ||
strokeWidth?: number | string; | ||
absoluteStrokeWidth?: boolean; | ||
class?: string; | ||
} |
Oops, something went wrong.