Skip to content

Commit

Permalink
[Setup] Setup the repository (#1)
Browse files Browse the repository at this point in the history
* Remove web vitals check

* Add github workflows file for unit test

* Add babel dev dependencies to resolve the warning

* update node packages

* Add tsconfig file

* Add eslintignore file

* Import necessary packages for converting javascript to typescript

* Convert to typescript files

* Add overrides to resolve typescript 5.x version based on facebook/create-react-app#13080

* Sync the package lock file with "npm config set legacy-peer-deps false" and "npm i"
  • Loading branch information
yuhueilee committed Feb 22, 2024
1 parent 87483c8 commit 92cf042
Show file tree
Hide file tree
Showing 13 changed files with 7,674 additions and 5,621 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
22 changes: 22 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Tests

on: [pull_request]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm ci
- name: tests
run: npm test
13,134 changes: 7,577 additions & 5,557 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^5.3.3",
"web-vitals": "^2.1.4"
},
"overrides": {
"react-scripts": {
"typescript": "^5"
}
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
Expand All @@ -34,5 +44,9 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-private-property-in-object": "^7.23.4"
}
}
25 changes: 0 additions & 25 deletions src/App.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

import { render, screen } from "@testing-library/react";

import App from "./App";

test("renders learn react link", () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
9 changes: 9 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./App.css";

import React from "react";

function App() {
return <div className="App">learn react</div>;
}

export default App;
17 changes: 0 additions & 17 deletions src/index.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './index.css';

import React from 'react';
import ReactDOM from 'react-dom/client';

import App from './App';

const root = ReactDOM.createRoot(document.getElementById("root")!);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
1 change: 0 additions & 1 deletion src/logo.svg

This file was deleted.

13 changes: 0 additions & 13 deletions src/reportWebVitals.js

This file was deleted.

27 changes: 27 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}

0 comments on commit 92cf042

Please sign in to comment.