mirror of
https://github.com/iconify/iconify.git
synced 2024-12-12 13:47:49 +00:00
Format updated files with Prettier
This commit is contained in:
parent
2a0dbf8fa9
commit
5d6885369f
@ -48,11 +48,13 @@ export async function buildFiles(params: BuildParams) {
|
||||
|
||||
// Build files with TypeScript compiler first to make sure there are no errors and to generate .d.ts files
|
||||
if (typeof buildScript === 'string') {
|
||||
console.log(`Executing npm script ${buildScript}...`)
|
||||
console.log(`Executing npm script ${buildScript}...`);
|
||||
await exec(root, 'npm', ['run', buildScript]);
|
||||
} else {
|
||||
console.log('Executing tsc...')
|
||||
await exec(root, process.platform === 'win32' ? 'tsc.cmd' : 'tsc', ['-b']);
|
||||
console.log('Executing tsc...');
|
||||
await exec(root, process.platform === 'win32' ? 'tsc.cmd' : 'tsc', [
|
||||
'-b',
|
||||
]);
|
||||
}
|
||||
|
||||
// Build ES modules
|
||||
|
@ -16,18 +16,17 @@ export async function getCustomIcon(
|
||||
|
||||
if (typeof custom === 'function') {
|
||||
result = await custom(icon);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
const inline = custom[icon];
|
||||
result = typeof inline === 'function'
|
||||
? await inline()
|
||||
: inline;
|
||||
result = typeof inline === 'function' ? await inline() : inline;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
if (!result.startsWith('<svg ')) {
|
||||
console.warn(`Custom icon "${icon}" in "${collection}" is not a valid SVG`);
|
||||
console.warn(
|
||||
`Custom icon "${icon}" in "${collection}" is not a valid SVG`
|
||||
);
|
||||
}
|
||||
return transform ? await transform(result) : result
|
||||
return transform ? await transform(result) : result;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
import type { Awaitable } from '@antfu/utils';
|
||||
|
||||
export type CustomIconLoader = (name: string) => Awaitable<string | undefined>;
|
||||
export type InlineCollection = Record<string, string | (() => Awaitable<string | undefined>)>;
|
||||
export type CustomCollections = Record<string, CustomIconLoader | InlineCollection>;
|
||||
export type InlineCollection = Record<
|
||||
string,
|
||||
string | (() => Awaitable<string | undefined>)
|
||||
>;
|
||||
export type CustomCollections = Record<
|
||||
string,
|
||||
CustomIconLoader | InlineCollection
|
||||
>;
|
||||
|
Loading…
Reference in New Issue
Block a user