|
| 1 | +## How this app was setup |
| 2 | + |
| 3 | +```bash |
| 4 | +# Create project directory |
| 5 | +mkdir sbanky |
| 6 | +cd sbanky |
| 7 | +``` |
| 8 | + |
| 9 | +### Initialize project with npm |
| 10 | + |
| 11 | +```bash |
| 12 | +npm init -y |
| 13 | +``` |
| 14 | + |
| 15 | +### Install core dependencies for React + TypeScript + Vite |
| 16 | +```bash |
| 17 | + |
| 18 | +npm install react react-dom |
| 19 | +npm install -D @vitejs/plugin-react vite typescript @types/react @types/react-dom |
| 20 | +``` |
| 21 | + |
| 22 | +### Install SB1/FFE design system components |
| 23 | +```bash |
| 24 | +npm install @sb1/ffe-core @sb1/ffe-core-react @sb1/ffe-buttons @sb1/ffe-buttons-react @sb1/ffe-form @sb1/ffe-form-react @sb1/ffe-grid @sb1/ffe-grid-react |
| 25 | +``` |
| 26 | + |
| 27 | +### Install LESS support |
| 28 | +```bash |
| 29 | +npm install -D less |
| 30 | +``` |
| 31 | + |
| 32 | +### Create basic project structure |
| 33 | +```bash |
| 34 | +mkdir -p src/components src/styles |
| 35 | +touch src/main.tsx src/App.tsx src/styles/main.less |
| 36 | +``` |
| 37 | + |
| 38 | +### Create TypeScript configuration |
| 39 | +```bash |
| 40 | +cat > tsconfig.json << EOF |
| 41 | +{ |
| 42 | + "compilerOptions": { |
| 43 | + "target": "ES2020", |
| 44 | + "useDefineForClassFields": true, |
| 45 | + "lib": ["ES2020", "DOM", "DOM.Iterable"], |
| 46 | + "module": "ESNext", |
| 47 | + "skipLibCheck": true, |
| 48 | + "moduleResolution": "bundler", |
| 49 | + "allowImportingTsExtensions": true, |
| 50 | + "resolveJsonModule": true, |
| 51 | + "isolatedModules": true, |
| 52 | + "noEmit": true, |
| 53 | + "jsx": "react-jsx", |
| 54 | + "strict": true, |
| 55 | + "baseUrl": ".", |
| 56 | + "paths": { |
| 57 | + "@/*": ["src/*"] |
| 58 | + } |
| 59 | + }, |
| 60 | + "include": ["src"], |
| 61 | + "references": [{ "path": "./tsconfig.node.json" }] |
| 62 | +} |
| 63 | +EOF |
| 64 | +``` |
| 65 | + |
| 66 | +### Create Vite configuration |
| 67 | +```bash |
| 68 | +cat > vite.config.ts << EOF |
| 69 | +import { defineConfig } from 'vite' |
| 70 | +import react from '@vitejs/plugin-react' |
| 71 | +
|
| 72 | +export default defineConfig({ |
| 73 | + plugins: [react()], |
| 74 | + server: { |
| 75 | + port: 3000, |
| 76 | + open: true |
| 77 | + }, |
| 78 | + css: { |
| 79 | + preprocessorOptions: { |
| 80 | + less: { |
| 81 | + javascriptEnabled: true, |
| 82 | + math: 'always', |
| 83 | + additionalData: '@import "@sb1/ffe-core/less/colors.less";' |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | +}) |
| 88 | +EOF |
| 89 | +``` |
| 90 | + |
| 91 | +### Create index.html |
| 92 | +```bash |
| 93 | + |
| 94 | +cat > index.html << EOF |
| 95 | +<!DOCTYPE html> |
| 96 | +<html lang="en"> |
| 97 | + <head> |
| 98 | + <meta charset="UTF-8" /> |
| 99 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 100 | + <title>SBanky</title> |
| 101 | + </head> |
| 102 | + <body> |
| 103 | + <div id="root"></div> |
| 104 | + <script type="module" src="/src/main.tsx"></script> |
| 105 | + </body> |
| 106 | +</html> |
| 107 | +EOF |
| 108 | +``` |
| 109 | + |
| 110 | +### Add scripts to package.json |
| 111 | +```bash |
| 112 | +npm pkg set scripts.dev="vite" |
| 113 | +npm pkg set scripts.build="tsc && vite build" |
| 114 | +npm pkg set scripts.preview="vite preview" |
| 115 | +``` |
| 116 | + |
| 117 | +### Start development server |
| 118 | +```bash |
| 119 | +npm run dev |
| 120 | +```bash |
0 commit comments