commit d620ee6c4807c21089bfbb85c48d6362bf0ea59c Author: sup39 Date: Tue Nov 8 01:46:45 2022 +0900 init diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c85a4d5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 sup39 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE-3rd-party.txt b/LICENSE-3rd-party.txt new file mode 100644 index 0000000..2d855d2 --- /dev/null +++ b/LICENSE-3rd-party.txt @@ -0,0 +1,28 @@ +This template is based on cra-template-typescript by facebook + https://www.npmjs.com/package/cra-template-typescript + +############################################################################## +LICENSE TEXT +############################################################################## + +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f197adc --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# @sup39/plain React Template +A plain React template for sup39 + +## Usage +```bash +yarn create react-app ${PROJECT_NAME} --template @sup39/plain +``` diff --git a/package.json b/package.json new file mode 100644 index 0000000..675a80d --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "@sup39/cra-template-plain", + "version": "0.1.0", + "license": "MIT", + "description": "A plain React template for sup39", + "repository": "https://github.com/sup39/cra-template-plain", + "files": [ + "template", + "template.json" + ] +} diff --git a/template.json b/template.json new file mode 100644 index 0000000..bb7d6b7 --- /dev/null +++ b/template.json @@ -0,0 +1,26 @@ +{ + "package": { + "scripts": { + "lint": "eslint src" + }, + "dependencies": { + "@sup39/eslint-config-typescript": "^0.1.2", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^13.0.0", + "@testing-library/user-event": "^13.2.1", + "@types/jest": "^27.0.1", + "@types/node": "^16.7.13", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", + "typescript": "^4.4.2", + "web-vitals": "^2.1.0" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest", + "@sup39/typescript" + ] + } + } +} diff --git a/template/gitignore b/template/gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/template/gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/template/public/favicon.ico b/template/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/template/public/favicon.ico differ diff --git a/template/public/index.html b/template/public/index.html new file mode 100644 index 0000000..bf61628 --- /dev/null +++ b/template/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/template/public/logo192.png b/template/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/template/public/logo192.png differ diff --git a/template/public/logo512.png b/template/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/template/public/logo512.png differ diff --git a/template/public/manifest.json b/template/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/template/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/template/public/robots.txt b/template/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/template/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/template/src/App.css b/template/src/App.css new file mode 100644 index 0000000..74b5e05 --- /dev/null +++ b/template/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/template/src/App.test.tsx b/template/src/App.test.tsx new file mode 100644 index 0000000..14b0140 --- /dev/null +++ b/template/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import {render, screen} from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/template/src/App.tsx b/template/src/App.tsx new file mode 100644 index 0000000..a53698a --- /dev/null +++ b/template/src/App.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import logo from './logo.svg'; +import './App.css'; + +function App() { + return ( +
+
+ logo +

+ Edit src/App.tsx and save to reload. +

+ + Learn React + +
+
+ ); +} + +export default App; diff --git a/template/src/index.css b/template/src/index.css new file mode 100644 index 0000000..ec2585e --- /dev/null +++ b/template/src/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} diff --git a/template/src/index.tsx b/template/src/index.tsx new file mode 100644 index 0000000..07924fc --- /dev/null +++ b/template/src/index.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import './index.css'; +import App from './App'; +import reportWebVitals from './reportWebVitals'; + +const root = ReactDOM.createRoot( + document.getElementById('root') as HTMLElement, +); +root.render( + + + , +); + +// If you want to start measuring performance in your app, pass a function +// to log results (for example: reportWebVitals(console.log)) +// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals +reportWebVitals(); diff --git a/template/src/logo.svg b/template/src/logo.svg new file mode 100644 index 0000000..9dfc1c0 --- /dev/null +++ b/template/src/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/template/src/react-app-env.d.ts b/template/src/react-app-env.d.ts new file mode 100644 index 0000000..6431bc5 --- /dev/null +++ b/template/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/template/src/reportWebVitals.ts b/template/src/reportWebVitals.ts new file mode 100644 index 0000000..b7876a4 --- /dev/null +++ b/template/src/reportWebVitals.ts @@ -0,0 +1,15 @@ +import {ReportHandler} from 'web-vitals'; + +const reportWebVitals = (onPerfEntry?: ReportHandler) => { + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then(({getCLS, getFID, getFCP, getLCP, getTTFB}) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } +}; + +export default reportWebVitals; diff --git a/template/src/setupTests.ts b/template/src/setupTests.ts new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/template/src/setupTests.ts @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom'; diff --git a/template/tsconfig.json b/template/tsconfig.json new file mode 100644 index 0000000..a273b0c --- /dev/null +++ b/template/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": [ + "src" + ] +}