diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa7ec8b..a384ab35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p --- +## [0.1.15](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.15) - 2021-08-03 + +### Fixed + +- Skip parse.icon if the icon is imported directly from an icon package + +--- + ## [0.1.14](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.14) - 2020-12-22 ### Added diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 327578fe..85a5c060 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -19,7 +19,8 @@ The following commands are available through `npm run` 1. Add new contributors to the `contributors` section 1. Update the `CHANGELOG.md` 1. Update the `README.md` contributors section -1. `npm run build` and `npm test` +1. `npm run build` +1. `FONTAWESOME_NPM_AUTH_TOKEN=TOKEN npm run test` where `TOKEN` is a valid Pro registry token 1. `npm publish` 1. `npm publish --registry https://npm.fontawesome.com` (publish to Pro registry) 1. `git add . && git commit -m 'Release VERSION'` diff --git a/index.es.js b/index.es.js index 7b85e4d0..59a40c03 100644 --- a/index.es.js +++ b/index.es.js @@ -260,6 +260,12 @@ function log () { } function normalizeIconArgs(icon) { + // this has everything that it needs to be rendered which means it was probably imported + // directly from an icon svg package + if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { + return icon; + } + if (parse.icon) { return parse.icon(icon); } // if the icon is null, there's nothing to do @@ -270,7 +276,7 @@ function normalizeIconArgs(icon) { } // if the icon is an object and has a prefix and an icon name, return it - if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { + if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName) { return icon; } // if it's an array with length of two diff --git a/index.js b/index.js index d6aa7b07..00d3a3fe 100644 --- a/index.js +++ b/index.js @@ -265,6 +265,12 @@ } function normalizeIconArgs(icon) { + // this has everything that it needs to be rendered which means it was probably imported + // directly from an icon svg package + if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { + return icon; + } + if (fontawesomeSvgCore.parse.icon) { return fontawesomeSvgCore.parse.icon(icon); } // if the icon is null, there's nothing to do @@ -275,7 +281,7 @@ } // if the icon is an object and has a prefix and an icon name, return it - if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { + if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName) { return icon; } // if it's an array with length of two diff --git a/package.json b/package.json index e7187fec..4b998623 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@fortawesome/react-fontawesome", "description": "Official React component for Font Awesome 5", - "version": "0.1.14", + "version": "0.1.15", "main": "index.js", "module": "index.es.js", "jsnext:main": "index.es.js", @@ -35,9 +35,8 @@ "prettier": "pretty-quick --pattern src/** --staged", "precommit": "npm run lint && npm run prettier && lint-staged", "prepack": "npm run dist", - "test": "npm run test.latest && npm run test.next", + "test": "npm run test.latest && npm run test.next.proregistry", "test.latest": "npm --no-save install @fortawesome/fontawesome-svg-core@latest @fortawesome/free-solid-svg-icons@latest && jest --silent", - "test.next": "npm --no-save install @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent", "test.next.proregistry": "npm --userconfig .npmrc.proregistry --registry https://npm.fontawesome.com install --no-save @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent", "clean": "rm -f index.js && rm -f index.es.js" },