-
Notifications
You must be signed in to change notification settings - Fork 272
Rewrite library with TypeScript, update to modern React & Jest conventions #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
charles4221
merged 28 commits into
FortAwesome:main
from
charles4221:feat/typescript-rewrite
Aug 22, 2025
Merged
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5a04f57
feat: rewrite library with typescript, update to modern React and Jes…
charles4221 152d0dc
feat: optimise classList function removing runtime semver checks and …
charles4221 08a87fd
feat: avoid template literals for dynamic classes with size/pull/rota…
charles4221 7b5e00c
feat: move remaining inline class strings from getClassListFromProps …
charles4221 d6ed578
refactor: tidy up normalizeIconArgs by using switch statement
charles4221 67ff91c
feat: optimise FontAwesomeIcon by reducing per-render function calls …
charles4221 03b4ca5
chore(jest): add coverage ignore patterns
charles4221 9c64ea1
chore: use Set for checking defaultProps keys for small perf gain ove…
charles4221 5352564
test: additional unit tests for improved coverage
charles4221 d018335
test: fix ESM issues when running jest by adding ts-jest
charles4221 dcc0fe3
chore(deps): typescript 5.9.2
charles4221 aa5e00b
chore: include readme, license etc in npm distro
charles4221 97de571
feat: better prop definitions, fix accessibility ids for React SSR
charles4221 b6a0c57
feat: drop support for FA5, svg core 1.x
charles4221 3a9d641
chore: move version checks to constants
charles4221 f6bad43
docs: readme updates RE v3.0.0
charles4221 cb8187b
ci: fix npm install in ci
charles4221 8fc78ae
fix(ci): try previous secret
charles4221 a0d1683
chore: add npmrc to (hopefully) fix ci
charles4221 e9aee7a
ci: remove explicit env setting in ci.yml
charles4221 b3c14d0
ci: remove duplicated build scripts
charles4221 d6d4553
feat: add types for FA CSS vars in style prop
charles4221 26ee89a
fix(#126): set aria-hidden=false if aria-label is present
charles4221 ca4e913
test: remove tests for deprecated listItem prop
charles4221 fce9a20
feat: rewrite converter for significant perf increase
charles4221 6f57fc7
fix: wrap process.env calls in guards
charles4221 4bd7b57
chore: build as bundle instead of split modules
charles4221 7786a8f
chore: implement final PR feedback
charles4221 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # EditorConfig is awesome: https://EditorConfig.org | ||
|
|
||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| [*] | ||
| indent_style = space | ||
| indent_size = 2 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,51 @@ | ||
| name: CI | ||
|
|
||
| on: [push, pull_request] | ||
| on: [push, pull_request_target] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| free-solid-svg-icons: [7.x, 6.x, 5.x] | ||
| fontawesome-svg-core: [7.x, 6.x, 1.2.x] | ||
| node-version: [20.x, 18.x] | ||
| react: [19.x, 18.x, 17.x, 16.x] | ||
| free-solid-svg-icons: [7.x, 6.x] | ||
| fontawesome-svg-core: [7.x, 6.x] | ||
| node-version: [24.x, 22.x, 20.x] | ||
| react: [19.x, 18.x] | ||
| exclude: | ||
| # For v7.x core, allow all icon versions | ||
| # For v6.x and v1.2.x core, exclude v7.x icons | ||
| # For v6.x exclude v7.x icons | ||
| - free-solid-svg-icons: '7.x' | ||
| fontawesome-svg-core: '6.x' | ||
| - free-solid-svg-icons: '7.x' | ||
| fontawesome-svg-core: '1.2.x' | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v1 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| registry-url: https://npm.fontawesome.com/ | ||
| scope: '@fortawesome' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install base dependencies | ||
| run: npm install --no-audit --no-save | ||
| run: npm ci --no-audit --no-save | ||
|
|
||
| - name: Install React dependencies | ||
| run: npm install --no-save react@${{ matrix.react }} react-dom@${{ matrix.react }} react-test-renderer@${{ matrix.react }} | ||
| run: npm ci --no-save react@${{ matrix.react }} react-dom@${{ matrix.react }} | ||
|
|
||
| - name: Install FontAwesome dependencies | ||
| run: npm install --no-save @fortawesome/fontawesome-svg-core@${{ matrix.fontawesome-svg-core }} @fortawesome/free-solid-svg-icons@${{ matrix.free-solid-svg-icons }} | ||
| run: npm ci --no-save @fortawesome/fontawesome-svg-core@${{ matrix.fontawesome-svg-core }} @fortawesome/free-solid-svg-icons@${{ matrix.free-solid-svg-icons }} | ||
|
|
||
| - name: Verify React version | ||
| run: npm list react react-dom react-test-renderer | ||
| run: npm list react react-dom | ||
|
|
||
| - name: Build and test | ||
| - name: Lint and test | ||
| run: | | ||
| npm run build | ||
| npm run lint | ||
| npm run format:check | ||
| npm run test | ||
|
|
||
| - name: Build distribution | ||
| run: npm run dist | ||
| - name: Build | ||
| run: npm run build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,5 @@ node_modules | |
| .DS_Store | ||
| bin/act | ||
| fortawesome-react-fontawesome-*.tgz | ||
| dist/ | ||
| coverage/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @fortawesome:registry=https://npm.fontawesome.com/ | ||
| @awesome.me:registry=https://npm.fontawesome.com/ | ||
| //npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| /index.* | ||
| /dist |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "arrowParens": "always", | ||
| "bracketSameLine": true, | ||
| "bracketSpacing": true, | ||
| "endOfLine": "lf", | ||
| "quoteProps": "as-needed", | ||
| "singleQuote": true, | ||
| "semi": false, | ||
| "tabWidth": 2, | ||
| "trailingComma": "all", | ||
| "useTabs": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| nodejs 22.11.0 | ||
| nodejs 22.17.1 | ||
| python 3.9.19 2.7.18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "recommendations": [ | ||
| "dbaeumer.vscode-eslint", | ||
| "esbenp.prettier-vscode", | ||
| "Orta.vscode-jest" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| // VSCode Core Settings | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "editor.formatOnSave": true, | ||
| "editor.codeActionsOnSave": { | ||
| "source.fixAll.eslint": "explicit" | ||
| }, | ||
| "javascript.format.enable": false, // formatting is handled by prettier | ||
| "javascript.validate.enable": false, // validation is handled by typescript and eslint | ||
| "typescript.tsdk": "node_modules/typescript/lib", // ensure VSCode uses the local TypeScript version | ||
| // Language-specific Overrides | ||
| "[javascript]": { | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode" | ||
| }, | ||
| "[javascriptreact]": { | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode" | ||
| }, | ||
| "[svg]": { | ||
| "editor.defaultFormatter": "jock.svg" | ||
| }, | ||
| "[typescript]": { | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode" | ||
| }, | ||
| "[typescriptreact]": { | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode" | ||
| }, | ||
| // Extension Settings | ||
| "eslint.enable": true, | ||
| "eslint.format.enable": false, // formatting is handled by prettier | ||
| "prettier.enable": true, | ||
| "jest.shell": "zsh" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.