Skip to content

Commit

Permalink
Tweak build script to run on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mririgoyen committed Jan 30, 2023
1 parent e1ddda1 commit 85a3d22
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/getIconLibraries.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import os from 'node:os';
import fs from 'node:fs/promises';
import slugify from 'slugify';

import config from '../config.js';

const isWin = os.platform() === 'win32';

const createJsName = (name, library) => {
const iconPascal = name.split('-').map((name) => name.charAt(0).toUpperCase() + name.slice(1)).join('');
return `${library}${iconPascal}`;
Expand Down Expand Up @@ -77,7 +80,7 @@ const getIconLibraries = async (contributors = []) => {

// Add path data
const iconSvgPath = await import.meta.resolve(`${library.package}/svg/${icon.name}.svg`);
const svg = await fs.readFile(iconSvgPath.split('file://')[1], { encoding: 'utf8' });
const svg = await fs.readFile(iconSvgPath.split(`file://${isWin ? '/' : ''}`)[1], { encoding: 'utf8' });
thisIcon.p = svg.match(/ d="([^"]+)"/)[1];

// Add search tokens
Expand Down

0 comments on commit 85a3d22

Please sign in to comment.