mirror of
https://github.com/tabler/tabler-icons.git
synced 2025-08-19 04:11:36 +02:00
Change the way of exporting icons in Svelte package (#1169)
+ Updated imports in test-svelte project. Co-authored-by: Bartłomiej Gawęda <bgaweda@abis.krakow.pl>
This commit is contained in:
@@ -1,36 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { buildJsIcons, buildIconsList } from '../../.build/build-icons.mjs'
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import { getAllIcons, toPascalCase } from '../../.build/helpers.mjs'
|
||||
|
||||
const updatePackageJson = () => {
|
||||
let packageJson = JSON.parse(readFileSync('package.json', 'utf-8'))
|
||||
|
||||
if (packageJson.exports) {
|
||||
for (const key in packageJson.exports) {
|
||||
if (key.match(/^\.\/[^\.]+\.svelte$/)) {
|
||||
delete packageJson.exports[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const allIcons = getAllIcons(false, false)
|
||||
|
||||
Object.entries(allIcons).forEach(([type, icons]) => {
|
||||
icons.forEach((icon, i) => {
|
||||
const iconName = `${icon.name}${type !== 'outline' ? `-${type}` : ''}`,
|
||||
iconNamePascal = `${icon.namePascal}${type !== 'outline' ? toPascalCase(type) : ''}`
|
||||
|
||||
packageJson.exports[`./${iconNamePascal}.svelte`] = {
|
||||
types: `./dist/icons/${iconName}.svelte.d.ts`,
|
||||
svelte: `./dist/icons/${iconName}.svelte`
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
writeFileSync('package.json', JSON.stringify(packageJson, null, 2))
|
||||
}
|
||||
|
||||
const componentTemplate = ({
|
||||
type,
|
||||
@@ -71,5 +41,4 @@ buildJsIcons({
|
||||
pascalName: false,
|
||||
})
|
||||
|
||||
updatePackageJson()
|
||||
buildIconsList('icons-svelte')
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import IconAd from "@tabler/icons-svelte/IconAd.svelte";
|
||||
import IconAdOff from "@tabler/icons-svelte/IconAdOff.svelte";
|
||||
import IconAdFilled from "@tabler/icons-svelte/IconAdFilled.svelte";
|
||||
import IconAd from "@tabler/icons-svelte/icons/ad";
|
||||
import IconAdOff from "@tabler/icons-svelte/icons/ad-off";
|
||||
import { IconAdFilled } from "@tabler/icons-svelte";
|
||||
let active = false;
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user