2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-08 14:20:57 +00:00

Web component: fix build script, allow simple icon names

This commit is contained in:
Vjacheslav Trushkin 2022-05-14 08:35:53 +03:00
parent 9e87cca3da
commit 6911d07b55
2 changed files with 12 additions and 6 deletions

View File

@ -3,7 +3,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const child_process = require('child_process'); const child_process = require('child_process');
const packagesDir = path.dirname(__dirname); const coreDir = path.dirname(require.resolve('@iconify/core/package.json'));
// List of commands to run // List of commands to run
const commands = []; const commands = [];
@ -57,15 +57,15 @@ const fileExists = (file) => {
return true; return true;
}; };
if (compile.dist && !fileExists(packagesDir + '/icon/lib/index.js')) { if (compile.dist && !fileExists('./lib/index.js')) {
compile.lib = true; compile.lib = true;
} }
if (compile.api && !fileExists(packagesDir + '/icon/lib/index.d.ts')) { if (compile.api && !fileExists('./lib/index.d.ts')) {
compile.lib = true; compile.lib = true;
} }
if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) {
compile.core = true; compile.core = true;
} }
@ -74,7 +74,7 @@ if (compile.core) {
commands.push({ commands.push({
cmd: 'npm', cmd: 'npm',
args: ['run', 'build'], args: ['run', 'build'],
cwd: packagesDir + '/core', cwd: coreDir,
}); });
} }

View File

@ -1,7 +1,10 @@
import type { IconifyJSON } from '@iconify/types'; import type { IconifyJSON } from '@iconify/types';
// Core // Core
import type { IconifyStorageFunctions } from '@iconify/core/lib/storage/functions'; import {
allowSimpleNames,
IconifyStorageFunctions,
} from '@iconify/core/lib/storage/functions';
import { import {
iconExists, iconExists,
getIcon, getIcon,
@ -63,6 +66,9 @@ export function exportFunctions(): IconifyExportedFunctions {
// Set API module // Set API module
setAPIModule('', fetchAPIModule); setAPIModule('', fetchAPIModule);
// Allow simple icon names
allowSimpleNames(true);
/** /**
* Browser stuff * Browser stuff
*/ */