mirror of
https://github.com/iconoir-icons/iconoir
synced 2024-05-29 03:52:34 +02:00
Calculate IconoirContext path
This commit is contained in:
parent
4a49bb6e9e
commit
1b58f4b357
|
@ -50,7 +50,6 @@ const defaultTsOptions = {
|
|||
export default async (ctx, target) => {
|
||||
const localJsTargets = jsTargets.map((jsTarget) => ({
|
||||
...jsTarget,
|
||||
iconTemplate: getIconTemplate(target.native, jsTarget.ext),
|
||||
}));
|
||||
|
||||
const promises = [];
|
||||
|
@ -121,6 +120,18 @@ export default async (ctx, target) => {
|
|||
mainIndex.add(mainIndexComponentName, jsPath);
|
||||
variantIndex.add(icon.pascalName, jsPath);
|
||||
|
||||
if (!jsTarget.iconTemplate) {
|
||||
jsTarget.iconTemplate = getIconTemplate(
|
||||
target.native,
|
||||
toImportPath(
|
||||
path.relative(
|
||||
path.join(jsTarget.path, variant),
|
||||
jsTarget.iconoirContextPath,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const reactComponent = getReactComponent(
|
||||
icon.path,
|
||||
target.native,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { generateImport } from '../../../lib/import-export.js';
|
||||
|
||||
export function getTemplate(native, ext) {
|
||||
export function getTemplate(native, iconoirContextPath) {
|
||||
return (variables, { tpl }) => {
|
||||
variables.props[0].name = 'passedProps';
|
||||
|
||||
|
@ -13,7 +13,7 @@ export function getTemplate(native, ext) {
|
|||
const useClientDirective = native ? '' : '"use client";';
|
||||
const iconoirContextImport = generateImport(
|
||||
['IconoirContext'],
|
||||
`../IconoirContext.${ext}`,
|
||||
iconoirContextPath,
|
||||
);
|
||||
|
||||
return tpl`
|
||||
|
|
Loading…
Reference in a new issue