Skip to content

Commit

Permalink
fix: improve existing icon matching with regex
Browse files Browse the repository at this point in the history
  • Loading branch information
snickbit committed Jun 4, 2022
1 parent 1336acc commit 091590d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"watch": "concurrently -n lib,cli \"pnpm run watch:lib\" \"pnpm run watch:cli\"",
"watch:cli": "pnpm run dev:cli --watch",
"watch:lib": "pnpm run dev:lib --watch"
"watch:lib": "pnpm run dev:lib --watch",
"schema": "pnpx get-graphql-schema https://api.fontawesome.com > schema.graphql"
},
"jest": {
"preset": "ts-jest",
Expand Down
5 changes: 3 additions & 2 deletions src/actions/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export default async argv => cli(argv)
for (let item of args.icons) {
let [icon, ...aliases] = item.split(',')

let iconName = normalizeIconName(icon.replace(/(fa[a-z]?)-/, `$1:`))
if (!config.icons.includes(iconName)) {
let iconName = cleanIconName(icon)
const reg = new RegExp(`^fa[a-z]?:(${iconName})$`)
if (!config.icons.find(i => reg.test(i))) {
const iconQuery = gql`
query ($query: String) {
search(version: "6.1.1", query: $query, first: 15) {id}
Expand Down

0 comments on commit 091590d

Please sign in to comment.