Remove lucide & replace by octicons
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
export function normalizeSvgIconName(iconName?: string): string | undefined {
|
||||
if (!iconName || iconName.startsWith("octicon")) {
|
||||
return iconName;
|
||||
}
|
||||
|
||||
if (iconName.startsWith("lucide ")) {
|
||||
const lucideName = iconName.slice("lucide ".length).split(".")[0].trim();
|
||||
return lucideName ? `lucide-${lucideName}` : undefined;
|
||||
}
|
||||
|
||||
return iconName;
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import { promises as fs } from "fs";
|
||||
import { safeLoad } from "js-yaml";
|
||||
import { basename, extname, join } from "path";
|
||||
import { exec } from "./exec";
|
||||
import { normalizeSvgIconName } from "../shared/icon-utils";
|
||||
|
||||
interface WorkflowDesc {
|
||||
folder: string;
|
||||
@@ -59,10 +58,6 @@ async function checkWorkflows(
|
||||
`${workflowId}.properties.json`
|
||||
));
|
||||
const iconName: string | undefined = workflowProperties["iconName"];
|
||||
const normalizedSvgIconName = normalizeSvgIconName(iconName);
|
||||
if (iconName && !normalizedSvgIconName) {
|
||||
console.warn(`Warning: could not normalize icon "${iconName}" for workflow ${workflowId}, skipping icon sync`);
|
||||
}
|
||||
|
||||
const isPartnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false;
|
||||
|
||||
@@ -75,9 +70,9 @@ async function checkWorkflows(
|
||||
folder,
|
||||
id: workflowId,
|
||||
fileExtension,
|
||||
iconName: normalizedSvgIconName,
|
||||
iconName,
|
||||
iconType:
|
||||
normalizedSvgIconName && normalizedSvgIconName.startsWith("octicon") ? "octicon" : "svg",
|
||||
iconName && iconName.startsWith("octicon") ? "octicon" : "svg",
|
||||
};
|
||||
|
||||
if (!enabled) {
|
||||
@@ -196,13 +191,8 @@ async function checkWorkflow(
|
||||
r.push(join(x.folder, "properties", `${x.id}.properties.json`));
|
||||
};
|
||||
|
||||
if (x.iconType === "svg" && x.iconName) {
|
||||
r.push(
|
||||
join(
|
||||
"../../icons",
|
||||
`${x.iconName}.svg`
|
||||
)
|
||||
);
|
||||
if (x.iconType === "svg") {
|
||||
r.push(join("../../icons", `${x.iconName}.svg`));
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
@@ -4,7 +4,6 @@ import { safeLoad } from "js-yaml";
|
||||
import { basename, extname, join, dirname } from "path";
|
||||
import { Validator as validator } from "jsonschema";
|
||||
import { endGroup, error, info, setFailed, startGroup } from '@actions/core';
|
||||
import { normalizeSvgIconName } from '../shared/icon-utils';
|
||||
|
||||
interface WorkflowWithErrors {
|
||||
id: string;
|
||||
@@ -129,16 +128,10 @@ async function checkWorkflow(workflowPath: string, propertiesPath: string, allow
|
||||
|
||||
if (properties.iconName) {
|
||||
if(! /^octicon\s+/.test(properties.iconName)) {
|
||||
const svgIconName = normalizeSvgIconName(properties.iconName);
|
||||
|
||||
if(!svgIconName) {
|
||||
try {
|
||||
await fs.access(`../../icons/${properties.iconName}.svg`)
|
||||
} catch (e) {
|
||||
workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
|
||||
} else {
|
||||
try {
|
||||
await fs.access(`../../icons/${svgIconName}.svg`)
|
||||
} catch (e) {
|
||||
workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user