generated from template/vite-react-template
	Initial commit
This commit is contained in:
		
							
								
								
									
										30
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | # Logs | ||||||
|  | logs | ||||||
|  | *.log | ||||||
|  | .env | ||||||
|  | npm-debug.log* | ||||||
|  | yarn-debug.log* | ||||||
|  | yarn-error.log* | ||||||
|  | pnpm-debug.log* | ||||||
|  | lerna-debug.log* | ||||||
|  |  | ||||||
|  | node_modules | ||||||
|  | dist | ||||||
|  | dist-ssr | ||||||
|  | *.local | ||||||
|  |  | ||||||
|  | # Editor directories and files | ||||||
|  | .vscode/* | ||||||
|  | !.vscode/extensions.json | ||||||
|  | .idea | ||||||
|  | .DS_Store | ||||||
|  | *.suo | ||||||
|  | *.ntvs* | ||||||
|  | *.njsproj | ||||||
|  | *.sln | ||||||
|  | *.sw? | ||||||
|  |  | ||||||
|  | tsconfig.app.tsbuildinfo | ||||||
|  | tsconfig.node.tsbuildinfo | ||||||
|  |  | ||||||
|  | .turbo | ||||||
							
								
								
									
										3
									
								
								.npmrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.npmrc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | //npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN} | ||||||
|  | //registry.npmjs.org/:_authToken=${NPM_TOKEN} | ||||||
|  | ignore-workspace-root-check=true | ||||||
							
								
								
									
										33
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | <!doctype html> | ||||||
|  | <html lang="en"> | ||||||
|  |  | ||||||
|  | <head> | ||||||
|  |   <meta charset="UTF-8" /> | ||||||
|  |   <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||||||
|  |   <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
|  |   <title>Vite + React + TS</title> | ||||||
|  |   <link rel="stylesheet" href="/src/index.css" /> | ||||||
|  |   <style> | ||||||
|  |     html, | ||||||
|  |     body { | ||||||
|  |       height: 100%; | ||||||
|  |       margin: 0; | ||||||
|  |       padding: 0; | ||||||
|  |       overflow: hidden; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     #root { | ||||||
|  |       height: 100%; | ||||||
|  |       margin: 0; | ||||||
|  |       padding: 0; | ||||||
|  |       overflow: hidden; | ||||||
|  |     } | ||||||
|  |   </style> | ||||||
|  | </head> | ||||||
|  |  | ||||||
|  | <body> | ||||||
|  |   <div id="root"></div> | ||||||
|  |   <script type="module" src="/src/main.tsx"></script> | ||||||
|  | </body> | ||||||
|  |  | ||||||
|  | </html> | ||||||
							
								
								
									
										50
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | { | ||||||
|  |   "name": "vite-react", | ||||||
|  |   "private": true, | ||||||
|  |   "version": "0.0.1", | ||||||
|  |   "type": "module", | ||||||
|  |   "basename": "/", | ||||||
|  |   "scripts": { | ||||||
|  |     "dev": "vite", | ||||||
|  |     "build": "vite build", | ||||||
|  |     "build:css": "tailwindcss -i ./src/index.css -o ./dist/render.css --minify", | ||||||
|  |     "postbuild2": "pnpm build:css", | ||||||
|  |     "preview": "vite preview", | ||||||
|  |     "pub": "envision deploy ./dist -k vite-react -v 0.0.1", | ||||||
|  |     "dev:lib": "turbo dev" | ||||||
|  |   }, | ||||||
|  |   "files": [ | ||||||
|  |     "dist" | ||||||
|  |   ], | ||||||
|  |   "author": "abearxiong <xiongxiao@xiongxiao.me>", | ||||||
|  |   "license": "MIT", | ||||||
|  |   "dependencies": { | ||||||
|  |     "@kevisual/router": "0.0.9", | ||||||
|  |     "clsx": "^2.1.1", | ||||||
|  |     "dayjs": "^1.11.13", | ||||||
|  |     "lodash-es": "^4.17.21", | ||||||
|  |     "lucide-react": "^0.487.0", | ||||||
|  |     "nanoid": "^5.1.5", | ||||||
|  |     "react": "^19.1.0", | ||||||
|  |     "react-dom": "^19.1.0", | ||||||
|  |     "react-toastify": "^11.0.5", | ||||||
|  |     "zustand": "^5.0.3" | ||||||
|  |   }, | ||||||
|  |   "publishConfig": { | ||||||
|  |     "access": "public" | ||||||
|  |   }, | ||||||
|  |   "devDependencies": { | ||||||
|  |     "@kevisual/query": "0.0.15", | ||||||
|  |     "@kevisual/types": "^0.0.6", | ||||||
|  |     "@tailwindcss/vite": "^4.1.1", | ||||||
|  |     "@types/node": "^22.13.17", | ||||||
|  |     "@types/react": "^19.1.0", | ||||||
|  |     "@types/react-dom": "^19.1.1", | ||||||
|  |     "@vitejs/plugin-basic-ssl": "^2.0.0", | ||||||
|  |     "@vitejs/plugin-react": "^4.3.4", | ||||||
|  |     "tailwindcss": "^4.1.1", | ||||||
|  |     "typescript": "^5.8.2", | ||||||
|  |     "vite": "^6.2.4" | ||||||
|  |   }, | ||||||
|  |   "packageManager": "pnpm@10.7.1" | ||||||
|  | } | ||||||
							
								
								
									
										0
									
								
								packages/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								packages/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										1869
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										1869
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3
									
								
								pnpm-workspace.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								pnpm-workspace.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | packages: | ||||||
|  |   - 'submodules/*' | ||||||
|  |   - 'packages/*' | ||||||
							
								
								
									
										38
									
								
								public/demo.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								public/demo.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | <!doctype html> | ||||||
|  | <html lang="en"> | ||||||
|  |  | ||||||
|  | <head> | ||||||
|  |   <meta charset="UTF-8" /> | ||||||
|  |   <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
|  |   <title>Excalidraw</title> | ||||||
|  |   <style> | ||||||
|  |     html, | ||||||
|  |     body { | ||||||
|  |       margin: 0; | ||||||
|  |       padding: 0; | ||||||
|  |       width: 100%; | ||||||
|  |       height: 100%; | ||||||
|  |       overflow: hidden; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     #root { | ||||||
|  |       width: 100%; | ||||||
|  |       height: 100%; | ||||||
|  |     } | ||||||
|  |   </style> | ||||||
|  |   <link rel="stylesheet" crossorigin href="./render.css"> | ||||||
|  | </head> | ||||||
|  |  | ||||||
|  | <body> | ||||||
|  |   <div id="root"></div> | ||||||
|  |   <script type="module"> | ||||||
|  |     import { render } from './render.js'; | ||||||
|  |     console.log('render', render); | ||||||
|  |     const opts = { | ||||||
|  |       renderRoot: document.getElementById('root'), | ||||||
|  |     } | ||||||
|  |     render(opts); | ||||||
|  |   </script> | ||||||
|  | </body> | ||||||
|  |  | ||||||
|  | </html> | ||||||
							
								
								
									
										11
									
								
								script/clear.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								script/clear.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | import fs from 'fs'; | ||||||
|  | import path from 'path'; | ||||||
|  |  | ||||||
|  | export const root = process.cwd(); | ||||||
|  |  | ||||||
|  | export const clearWorkspace = () => { | ||||||
|  |   const files = ['submodules', 'packages', 'pnpm-workspace.yaml', 'turbo.json']; | ||||||
|  |   for (const file of files) { | ||||||
|  |     fs.rmSync(path.join(root, file), { recursive: true, force: true }); | ||||||
|  |   } | ||||||
|  | }; | ||||||
							
								
								
									
										0
									
								
								src/app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/app.ts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								src/index.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/index.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | @import "tailwindcss"; | ||||||
							
								
								
									
										6
									
								
								src/main.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/main.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | import { createRoot } from 'react-dom/client'; | ||||||
|  | import { App } from './pages/App.tsx'; | ||||||
|  |  | ||||||
|  | // import './index.css'; | ||||||
|  |  | ||||||
|  | createRoot(document.getElementById('root')!).render(<App />); | ||||||
							
								
								
									
										1
									
								
								src/modules/basename.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/modules/basename.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | export const basename = DEV_SERVER ? '/' : BASE_NAME; | ||||||
							
								
								
									
										3
									
								
								src/modules/query.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/modules/query.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | import { QueryClient } from '@kevisual/query'; | ||||||
|  |  | ||||||
|  | export const query = new QueryClient(); | ||||||
							
								
								
									
										5
									
								
								src/pages/App.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/pages/App.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | import { basename } from '../modules/basename'; | ||||||
|  | console.log('basename', basename); | ||||||
|  | export const App = () => { | ||||||
|  |   return <div className='bg-slate-200 w-full h-full border'>123</div>; | ||||||
|  | }; | ||||||
							
								
								
									
										1
									
								
								src/routes/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/routes/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | // import {} | ||||||
							
								
								
									
										6
									
								
								src/vite-env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/vite-env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | /// <reference types="vite/client" /> | ||||||
|  | type SimpleObject = { | ||||||
|  |   [key: string | number]: any; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | declare let BASE_NAME: string; | ||||||
							
								
								
									
										0
									
								
								submodules/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								submodules/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										43
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | |||||||
|  | { | ||||||
|  |   "compilerOptions": { | ||||||
|  |     "target": "ES2020", | ||||||
|  |     "useDefineForClassFields": true, | ||||||
|  |     "lib": [ | ||||||
|  |       "ES2020", | ||||||
|  |       "DOM", | ||||||
|  |       "DOM.Iterable" | ||||||
|  |     ], | ||||||
|  |     "module": "ESNext", | ||||||
|  |     "skipLibCheck": true, | ||||||
|  |     /* Bundler mode */ | ||||||
|  |     "moduleResolution": "bundler", | ||||||
|  |     "allowImportingTsExtensions": true, | ||||||
|  |     "isolatedModules": true, | ||||||
|  |     "moduleDetection": "force", | ||||||
|  |     "noEmit": true, | ||||||
|  |     // "jsx": "react", | ||||||
|  |     // "jsxFragmentFactory": "Fragment", | ||||||
|  |     // "jsxFactory": "h", | ||||||
|  |     "jsx": "react-jsx", | ||||||
|  |     "baseUrl": "./", | ||||||
|  |     "typeRoots": [ | ||||||
|  |       "node_modules/@types", | ||||||
|  |       "node_modules/@kevisual/types", | ||||||
|  |     ], | ||||||
|  |     "paths": { | ||||||
|  |       "@/*": [ | ||||||
|  |         "src/*" | ||||||
|  |       ] | ||||||
|  |     }, | ||||||
|  |     /* Linting */ | ||||||
|  |     "strict": true, | ||||||
|  |     "noImplicitAny": false, | ||||||
|  |     "noUnusedLocals": false, | ||||||
|  |     "noUnusedParameters": false, | ||||||
|  |     "noFallthroughCasesInSwitch": true | ||||||
|  |   }, | ||||||
|  |   "include": [ | ||||||
|  |     "src", | ||||||
|  |     "typings.d.ts" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								turbo.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								turbo.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | { | ||||||
|  |   "$schema": "https://turbo.build/schema.json", | ||||||
|  |   "tasks": { | ||||||
|  |     "build": { | ||||||
|  |       "dependsOn": [ | ||||||
|  |         "^build" | ||||||
|  |       ], | ||||||
|  |       "outputs": [ | ||||||
|  |         "dist/**" | ||||||
|  |       ] | ||||||
|  |     }, | ||||||
|  |     "dev:lib": { | ||||||
|  |       "persistent": true, | ||||||
|  |       "cache": true | ||||||
|  |     }, | ||||||
|  |     "build:lib": { | ||||||
|  |       "dependsOn": [ | ||||||
|  |         "^build:lib" | ||||||
|  |       ] | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										92
									
								
								vite.config.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								vite.config.mjs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | |||||||
|  | import { defineConfig } from 'vite'; | ||||||
|  | import react from '@vitejs/plugin-react'; | ||||||
|  | import path from 'path'; | ||||||
|  | import tailwindcss from '@tailwindcss/vite'; | ||||||
|  | import pkgs from './package.json' with { type: 'json' }; | ||||||
|  | const version = pkgs.version || '0.0.1'; | ||||||
|  |  | ||||||
|  | const isDev = process.env.NODE_ENV === 'development'; | ||||||
|  | const basename = isDev ? '/' : pkgs?.basename || '/'; | ||||||
|  |  | ||||||
|  | const checkJsh = () => { | ||||||
|  |   return process.env.SHELL === '/bin/jsh'; | ||||||
|  | }; | ||||||
|  | const isJsh = checkJsh(); | ||||||
|  | const plugins = [react(), ]; | ||||||
|  |  | ||||||
|  | if (!isJsh) { | ||||||
|  |   const basicSsl = await import('@vitejs/plugin-basic-ssl'); | ||||||
|  |   const tailwindcss = await import('@tailwindcss/vite'); | ||||||
|  |   const defaultPlugin = basicSsl.default; | ||||||
|  |   const defaultCssPlugin = tailwindcss.default; | ||||||
|  |   plugins.push(defaultCssPlugin(),defaultPlugin()); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | let target = 'https://kevisual.xiongxiao.me'; | ||||||
|  | if (isDev) { | ||||||
|  |   target = 'https://kevisual.xiongxiao.me'; | ||||||
|  | } else { | ||||||
|  |   target = 'https://kevisual.cn'; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | let proxy = { | ||||||
|  |   '/root/system-lib/': { | ||||||
|  |     target: `https://${target}/root/system-lib/`, | ||||||
|  |   }, | ||||||
|  |   '/user/login/': { | ||||||
|  |     target: `https://${target}/user/login/`, | ||||||
|  |   }, | ||||||
|  |   '/api': { | ||||||
|  |     target: `https://${target}`, | ||||||
|  |     changeOrigin: true, | ||||||
|  |     ws: true, | ||||||
|  |     rewriteWsOrigin: true, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | /** | ||||||
|  |  * @see https://vitejs.dev/config/ | ||||||
|  |  */ | ||||||
|  | export default defineConfig({ | ||||||
|  |   plugins, | ||||||
|  |   resolve: { | ||||||
|  |     alias: { | ||||||
|  |       '@': path.resolve(__dirname, './src'), | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   base: basename, | ||||||
|  |   define: { | ||||||
|  |     DEV_SERVER: JSON.stringify(process.env.NODE_ENV === 'development'), | ||||||
|  |     VERSION: JSON.stringify(version), | ||||||
|  |     BASE_NAME: JSON.stringify(basename), | ||||||
|  |     'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), | ||||||
|  |   }, | ||||||
|  |   build: { | ||||||
|  |     target: 'modules', | ||||||
|  |     // lib: { | ||||||
|  |     //   entry: './src/libs.ts', | ||||||
|  |     //   formats: ['es'], | ||||||
|  |     //   fileName: (format) => `render.js`, | ||||||
|  |     // }, | ||||||
|  |   }, | ||||||
|  |   server: { | ||||||
|  |     port: 7006, | ||||||
|  |     host: '0.0.0.0', | ||||||
|  |     proxy: { | ||||||
|  |       '/api': { | ||||||
|  |         target: 'http://localhost:3000', | ||||||
|  |         changeOrigin: true, | ||||||
|  |         ws: true, | ||||||
|  |         rewriteWsOrigin: true, | ||||||
|  |         rewrite: (path) => path.replace(/^\/api/, '/api'), | ||||||
|  |       }, | ||||||
|  |       '/api/router': { | ||||||
|  |         target: 'ws://localhost:3000', | ||||||
|  |         changeOrigin: true, | ||||||
|  |         ws: true, | ||||||
|  |         rewriteWsOrigin: true, | ||||||
|  |         rewrite: (path) => path.replace(/^\/api/, '/api'), | ||||||
|  |       }, | ||||||
|  |       ...proxy, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }); | ||||||
		Reference in New Issue
	
	Block a user
	 kevisual
					kevisual