From 227696e83b6328564fb722d05e6d7679c1d0dfd9 Mon Sep 17 00:00:00 2001 From: Stephan <57194608+stephan418@users.noreply.github.com> Date: Thu, 29 Sep 2022 20:32:27 +0200 Subject: [PATCH] Initialize React app using create-vite --- index.html | 13 +++++++++++++ package.json | 22 ++++++++++++++++++++++ src/App.css | 6 ++++++ src/App.tsx | 10 ++++++++++ src/index.css | 7 +++++++ src/main.tsx | 10 ++++++++++ src/vite-env.d.ts | 1 + tsconfig.json | 21 +++++++++++++++++++++ tsconfig.node.json | 9 +++++++++ vite.config.ts | 7 +++++++ 10 files changed, 106 insertions(+) create mode 100644 index.html create mode 100644 package.json create mode 100644 src/App.css create mode 100644 src/App.tsx create mode 100644 src/index.css create mode 100644 src/main.tsx create mode 100644 src/vite-env.d.ts create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts diff --git a/index.html b/index.html new file mode 100644 index 0000000..f3501ad --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Detleph Components - Vite config + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..88f505a --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "detleph-components", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", + "@vitejs/plugin-react": "^2.1.0", + "typescript": "^4.6.4", + "vite": "^3.1.0" + } +} \ No newline at end of file diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..902778b --- /dev/null +++ b/src/App.css @@ -0,0 +1,6 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..3334f3a --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,10 @@ +import { useState } from "react"; +import "./App.css"; + +function App() { + const [count, setCount] = useState(0); + + return
Cool, now please start the storybook instead.
; +} + +export default App; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..a727a88 --- /dev/null +++ b/src/index.css @@ -0,0 +1,7 @@ +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..611e848 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( + + + +) diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..3d0a51a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "allowJs": false, + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "ESNext", + "moduleResolution": "Node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..9d31e2a --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..b1b5f91 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()] +})