-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f2b477
commit ae4842d
Showing
7 changed files
with
139 additions
and
25 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
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,59 @@ | ||
import plugins from '@lucide/rollup-plugins'; | ||
import dts from 'rollup-plugin-dts'; | ||
import pkg from './package.json' assert { type: 'json' }; | ||
|
||
const outputFileName = pkg.name; | ||
const outputDir = 'dist'; | ||
const inputs = ['src/lucide-static.ts']; | ||
const bundles = [ | ||
{ | ||
format: 'cjs', | ||
inputs, | ||
outputDir, | ||
}, | ||
{ | ||
format: 'esm', | ||
inputs, | ||
outputDir, | ||
preserveModules: true, | ||
}, | ||
]; | ||
|
||
const configs = bundles | ||
.map(({ inputs, outputDir, format, minify, preserveModules }) => | ||
inputs.map(input => ({ | ||
input, | ||
plugins: plugins(pkg, minify), | ||
output: { | ||
name: outputFileName, | ||
...(preserveModules | ||
? { | ||
dir: `${outputDir}/${format}`, | ||
} | ||
: { | ||
file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`, | ||
}), | ||
format, | ||
sourcemap: true, | ||
preserveModules, | ||
}, | ||
})), | ||
) | ||
.flat(); | ||
|
||
const typesFileConfig = { | ||
input: inputs[0], | ||
output: [ | ||
{ | ||
file: `${outputDir}/${outputFileName}.d.ts`, | ||
format: 'esm', | ||
}, | ||
], | ||
plugins: [ | ||
dts({ | ||
include: ['src'], | ||
}), | ||
], | ||
}; | ||
|
||
export default [...configs, typesFileConfig]; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import base64SVG from '@lucide/build-icons/utils/base64SVG.mjs'; | ||
|
||
export default ({ componentName, iconName, children, getSvg, deprecated }) => { | ||
let svgContents = getSvg(); | ||
const svgBase64 = base64SVG(svgContents); | ||
|
||
svgContents = svgContents.replace( | ||
'<svg', | ||
` | ||
<svg | ||
class="lucide lucide-${iconName}"`, | ||
); | ||
|
||
return ` | ||
/** | ||
* @name ${iconName} | ||
* @description Lucide SVG string. | ||
* | ||
* @preview ![img](data:image/svg+xml;base64,${svgBase64}) - https://lucide.dev/icons/${iconName} | ||
* @see https://lucide.dev/guide/packages/lucide-static - Documentation | ||
* | ||
* @returns {String} | ||
* ${deprecated ? '@deprecated' : ''} | ||
*/ | ||
const ${componentName}: string = \`\ | ||
${svgContents}\ | ||
\` | ||
export default ${componentName}; | ||
`; | ||
}; |
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,2 @@ | ||
export * from './icons' | ||
export * from './aliases'; |
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,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"declaration": true, | ||
"noEmitOnError": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"esModuleInterop": true, | ||
"allowJs": true, | ||
"lib": ["esnext", "dom"], | ||
"resolveJsonModule": true, | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.