Vokturz commited on
Commit
5a6fa7e
·
1 Parent(s): 6f48c62

move to typescript

Browse files
.gitattributes DELETED
@@ -1,35 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,14 +1,3 @@
1
- ---
2
- title: Transformers Js Playground
3
- emoji: 🐠
4
- colorFrom: indigo
5
- colorTo: red
6
- sdk: static
7
- pinned: false
8
- app_build_command: npm run build
9
- app_file: build/index.html
10
- ---
11
-
12
  # Getting Started with Create React App
13
 
14
  This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
@@ -20,10 +9,10 @@ In the project directory, you can run:
20
  ### `npm start`
21
 
22
  Runs the app in the development mode.\
23
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
24
 
25
- The page will reload when you make changes.\
26
- You may also see any lint errors in the console.
27
 
28
  ### `npm test`
29
 
@@ -42,40 +31,16 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
42
 
43
  ### `npm run eject`
44
 
45
- **Note: this is a one-way operation. Once you `eject`, you can't go back!**
46
 
47
- If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
48
 
49
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
50
 
51
- You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
52
 
53
  ## Learn More
54
 
55
  You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
56
 
57
  To learn React, check out the [React documentation](https://reactjs.org/).
58
-
59
- ### Code Splitting
60
-
61
- This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
62
-
63
- ### Analyzing the Bundle Size
64
-
65
- This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
66
-
67
- ### Making a Progressive Web App
68
-
69
- This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
70
-
71
- ### Advanced Configuration
72
-
73
- This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
74
-
75
- ### Deployment
76
-
77
- This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
78
-
79
- ### `npm run build` fails to minify
80
-
81
- This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Getting Started with Create React App
2
 
3
  This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
 
9
  ### `npm start`
10
 
11
  Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
 
14
+ The page will reload if you make edits.\
15
+ You will also see any lint errors in the console.
16
 
17
  ### `npm test`
18
 
 
31
 
32
  ### `npm run eject`
33
 
34
+ **Note: this is a one-way operation. Once you `eject`, you cant go back!**
35
 
36
+ If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
 
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
39
 
40
+ You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
41
 
42
  ## Learn More
43
 
44
  You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
 
46
  To learn React, check out the [React documentation](https://reactjs.org/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "name": "react-template",
3
  "version": "0.1.0",
4
  "private": true,
5
  "dependencies": {
@@ -7,9 +7,15 @@
7
  "@testing-library/jest-dom": "^6.6.3",
8
  "@testing-library/react": "^16.3.0",
9
  "@testing-library/user-event": "^13.5.0",
 
 
 
 
 
10
  "react": "^19.1.0",
11
  "react-dom": "^19.1.0",
12
  "react-scripts": "5.0.1",
 
13
  "web-vitals": "^2.1.4"
14
  },
15
  "scripts": {
 
1
  {
2
+ "name": "transformers-js-playground",
3
  "version": "0.1.0",
4
  "private": true,
5
  "dependencies": {
 
7
  "@testing-library/jest-dom": "^6.6.3",
8
  "@testing-library/react": "^16.3.0",
9
  "@testing-library/user-event": "^13.5.0",
10
+ "@types/jest": "^27.5.2",
11
+ "@types/node": "^16.18.126",
12
+ "@types/react": "^19.1.8",
13
+ "@types/react-dom": "^19.1.6",
14
+ "build": "^0.1.4",
15
  "react": "^19.1.0",
16
  "react-dom": "^19.1.0",
17
  "react-scripts": "5.0.1",
18
+ "typescript": "^4.9.5",
19
  "web-vitals": "^2.1.4"
20
  },
21
  "scripts": {
pnpm-lock.yaml ADDED
The diff for this file is too large to render. See raw diff
 
src/{App.test.js → App.test.tsx} RENAMED
@@ -1,3 +1,4 @@
 
1
  import { render, screen } from '@testing-library/react';
2
  import App from './App';
3
 
 
1
+ import React from 'react';
2
  import { render, screen } from '@testing-library/react';
3
  import App from './App';
4
 
src/{App.js → App.tsx} RENAMED
@@ -1,3 +1,4 @@
 
1
  import logo from './logo.svg';
2
  import './App.css';
3
 
@@ -7,7 +8,7 @@ function App() {
7
  <header className="App-header">
8
  <img src={logo} className="App-logo" alt="logo" />
9
  <p>
10
- Edit <code>src/App.js</code> and save to reload.
11
  </p>
12
  <a
13
  className="App-link"
 
1
+ import React from 'react';
2
  import logo from './logo.svg';
3
  import './App.css';
4
 
 
8
  <header className="App-header">
9
  <img src={logo} className="App-logo" alt="logo" />
10
  <p>
11
+ Edit <code>src/App.tsx</code> and save to reload.
12
  </p>
13
  <a
14
  className="App-link"
src/{index.js → index.tsx} RENAMED
@@ -4,7 +4,9 @@ import './index.css';
4
  import App from './App';
5
  import reportWebVitals from './reportWebVitals';
6
 
7
- const root = ReactDOM.createRoot(document.getElementById('root'));
 
 
8
  root.render(
9
  <React.StrictMode>
10
  <App />
 
4
  import App from './App';
5
  import reportWebVitals from './reportWebVitals';
6
 
7
+ const root = ReactDOM.createRoot(
8
+ document.getElementById('root') as HTMLElement
9
+ );
10
  root.render(
11
  <React.StrictMode>
12
  <App />
src/react-app-env.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ /// <reference types="react-scripts" />
src/{reportWebVitals.js → reportWebVitals.ts} RENAMED
@@ -1,4 +1,6 @@
1
- const reportWebVitals = onPerfEntry => {
 
 
2
  if (onPerfEntry && onPerfEntry instanceof Function) {
3
  import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
  getCLS(onPerfEntry);
 
1
+ import { ReportHandler } from 'web-vitals';
2
+
3
+ const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4
  if (onPerfEntry && onPerfEntry instanceof Function) {
5
  import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6
  getCLS(onPerfEntry);
src/{setupTests.js → setupTests.ts} RENAMED
File without changes
tsconfig.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable",
7
+ "esnext"
8
+ ],
9
+ "allowJs": true,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "strict": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "module": "esnext",
17
+ "moduleResolution": "node",
18
+ "resolveJsonModule": true,
19
+ "isolatedModules": true,
20
+ "noEmit": true,
21
+ "jsx": "react-jsx"
22
+ },
23
+ "include": [
24
+ "src"
25
+ ]
26
+ }