From 6911d07b557ff6c067851537a091c90610b08185 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 14 May 2022 08:35:53 +0300 Subject: [PATCH] Web component: fix build script, allow simple icon names --- iconify-icon/icon/build.js | 10 +++++----- iconify-icon/icon/src/functions.ts | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/iconify-icon/icon/build.js b/iconify-icon/icon/build.js index d58a066..649f287 100644 --- a/iconify-icon/icon/build.js +++ b/iconify-icon/icon/build.js @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); 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 const commands = []; @@ -57,15 +57,15 @@ const fileExists = (file) => { return true; }; -if (compile.dist && !fileExists(packagesDir + '/icon/lib/index.js')) { +if (compile.dist && !fileExists('./lib/index.js')) { compile.lib = true; } -if (compile.api && !fileExists(packagesDir + '/icon/lib/index.d.ts')) { +if (compile.api && !fileExists('./lib/index.d.ts')) { compile.lib = true; } -if (compile.lib && !fileExists(packagesDir + '/core/lib/cache.mjs')) { +if (compile.lib && !fileExists(coreDir + '/lib/cache.mjs')) { compile.core = true; } @@ -74,7 +74,7 @@ if (compile.core) { commands.push({ cmd: 'npm', args: ['run', 'build'], - cwd: packagesDir + '/core', + cwd: coreDir, }); } diff --git a/iconify-icon/icon/src/functions.ts b/iconify-icon/icon/src/functions.ts index 9eed366..7e3957d 100644 --- a/iconify-icon/icon/src/functions.ts +++ b/iconify-icon/icon/src/functions.ts @@ -1,7 +1,10 @@ import type { IconifyJSON } from '@iconify/types'; // Core -import type { IconifyStorageFunctions } from '@iconify/core/lib/storage/functions'; +import { + allowSimpleNames, + IconifyStorageFunctions, +} from '@iconify/core/lib/storage/functions'; import { iconExists, getIcon, @@ -63,6 +66,9 @@ export function exportFunctions(): IconifyExportedFunctions { // Set API module setAPIModule('', fetchAPIModule); + // Allow simple icon names + allowSimpleNames(true); + /** * Browser stuff */