Skip to content

Commit 0ba37f2

Browse files
committed
perf: add typescript support (#26)
1 parent 4b7a7ec commit 0ba37f2

31 files changed

+6164
-19010
lines changed

.github/workflows/pull_requests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
id: coverage
2828
with:
2929
output: report-markdown
30+
test-script: npm test -- --ci --json --coverage --testLocationInResults --outputFile=report.json
3031
- name: Publish Coverage
3132
uses: marocchino/sticky-pull-request-comment@v2
3233
with:

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
node-version-file: '.nvmrc'
1717
- run: npm ci
1818
- run: npm run build --if-present
19-
- run: npm run test:coverage --if-present
2019
- run: npx semantic-release
2120
env:
2221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.15.0
1+
v20.11.0
File renamed without changes.

config/webpack.common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = {
4646
loader: 'file-loader',
4747
},
4848
],
49+
noParse: [require.resolve('typescript/lib/typescript.js')],
4950
},
5051
resolve: {
5152
modules: ['src', 'node_modules'],

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
coverageThreshold: {
1818
global: {
1919
statements: 63,
20-
branches: 60,
20+
branches: 50,
2121
functions: 63,
2222
lines: 61,
2323
},

package-lock.json

Lines changed: 6090 additions & 18712 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"start": "NODE_ENV=development webpack serve",
1010
"build": "NODE_ENV=production webpack",
1111
"test": "jest",
12-
"test:watch": "jest test --watch",
13-
"test:coverage": "jest test --coverage . --silent",
12+
"test:watch": "jest test --watch",
13+
"test:coverage": "jest test --coverage . --silent --watch",
1414
"prepare": "husky install",
1515
"pre-commit": "lint-staged",
1616
"lint": "eslint src/**/*.{ts,tsx} --fix"
@@ -42,9 +42,9 @@
4242
},
4343
"dependencies": {
4444
"@testing-library/jest-dom": "^5.16.5",
45-
"axios": "^0.21.4",
45+
"axios": "^1.7.2",
4646
"date-fns": "^2.29.3",
47-
"gh-pages": "^3.2.3",
47+
"gh-pages": "^6.1.1",
4848
"github-fork-ribbon-css": "^0.2.3",
4949
"lodash": "^4.17.21",
5050
"luxon": "^1.28.0",
@@ -95,7 +95,7 @@
9595
"lint-staged": "^13.0.2",
9696
"mini-css-extract-plugin": "^2.6.1",
9797
"prettier": "^2.3.2",
98-
"semantic-release": "^21.0.0",
98+
"semantic-release": "^24.0.0",
9999
"ts-jest": "^29.0.1",
100100
"ts-loader": "^9.3.1",
101101
"webpack": "^5.74.0",

src/components/ActionButton/ActionButton.spec.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,13 @@ const buttonTestId = 'actionbutton-button';
55
const iconTestId = 'actionbutton-icon';
66
describe('<ActionButton />', () => {
77
const onClick = jest.fn();
8-
it('render reset button when button type is reset', () => {
9-
render(<ActionButton onClick={onClick} type="reset" />);
10-
const button = screen.getByTestId(`${buttonTestId}-reset`);
11-
const icon = screen.getByTestId(iconTestId);
12-
13-
expect(button.textContent?.trim()).toEqual('Reset');
14-
expect(button).toHaveClass('btn-danger');
15-
expect(icon).toHaveClass('fa-redo');
16-
});
178

189
it('render clear button when button type is clear', () => {
1910
render(<ActionButton onClick={onClick} type="clear" />);
2011
const button = screen.getByTestId(`${buttonTestId}-clear`);
2112
const icon = screen.getByTestId(iconTestId);
2213

23-
expect(button.textContent?.trim()).toEqual('Clear');
14+
expect(button.textContent?.trim()).toEqual('Clear result');
2415
expect(button).toHaveClass('btn-info');
2516
expect(icon).toHaveClass('fa-trash');
2617
});

src/components/ActionButton/ActionButton.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
const ButtonProps: Record<ActionButtonType, ActionButtonTypeProps> = {
2-
reset: {
3-
title: 'Reset',
4-
className: 'btn btn-danger',
5-
icon: 'fas fa-redo',
6-
toolTip: 'Clear code in editor and result',
7-
},
82
clear: {
9-
title: 'Clear',
3+
title: 'Clear result',
104
icon: 'fas fa-trash',
115
className: 'btn btn-info',
126
toolTip: 'Clear result (CtrCmd + l)',

0 commit comments

Comments
 (0)