Initial commit

This commit is contained in:
web customer 2025-02-21 12:47:37 +08:00
commit 07d053abe7
17 changed files with 4034 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{
"name": "Node.js 22 Development Environment",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
"runArgs": [
"--env",
"TZ=Asia/Shanghai"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "/bin/bash"
"terminal.integrated.env.linux": {
"TZ": "Asia/Shanghai"
}
},
"remoteEnv": {
"TZ": "Asia/Shanghai"
},
"extensions": [
"dbaeumer.vscode-eslint"
],
"postCreateCommand": "sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai | sudo tee /etc/timezone && pnpm install -g @kevisual/envision-cli@latest && npm install"
}

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# 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

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
@abearxiong:registry=https://npm.pkg.github.com
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

1
README.md Normal file
View File

@ -0,0 +1 @@
# vite-react-template

31
eslint.config.js Normal file
View File

@ -0,0 +1,31 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/no-explicit-any': 'off',
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
'@typescript-eslint/no-unused-vars': 'off',
'no-debugger': 'off',
},
},
);

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!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>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

60
package.json Normal file
View File

@ -0,0 +1,60 @@
{
"name": "vite-react",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"dev:web": "cross-env WEB_DEV=true vite --mode web",
"build": "vite build",
"lint": "eslint .",
"deploy": "rsync -avz --delete dist/ light:~/apps/ai/dist",
"preview": "vite preview",
"pub": "envision deploy ./dist -k vite-react -v 0.0.1",
"ev": "npm run build && npm run deploy"
},
"stackblitz": {
"startCommand": "npm dev:web"
},
"author": "abearxiong <xiongxiao@xiongxiao.me>",
"license": "MIT",
"dependencies": {
"@ant-design/icons": "^5.6.1",
"@kevisual/query": "0.0.7-alpha.3",
"@kevisual/router": "0.0.6-alpha-5",
"@kevisual/system-ui": "^0.0.3",
"@kevisual/ui": "^0.0.4-alpha-1",
"antd": "^5.24.1",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"immer": "^10.1.1",
"lodash-es": "^4.17.21",
"nanoid": "^5.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.2.0",
"react-router-dom": "^7.2.0",
"react-toastify": "^11.0.3",
"zustand": "^5.0.3"
},
"devDependencies": {
"@eslint/js": "^9.20.0",
"@kevisual/types": "^0.0.6",
"@tailwindcss/vite": "^4.0.7",
"@types/node": "^22.13.4",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-basic-ssl": "^1.2.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.20.1",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^15.15.0",
"tailwind-merge": "^3.0.1",
"tailwindcss": "^4.0.7",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1",
"vite": "^6.1.1"
}
}

3723
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

9
src/App.tsx Normal file
View File

@ -0,0 +1,9 @@
export const App = () => {
return (
<div className='bg-slate-200 w-full h-full border'>
<div className='test-loading bg-black'>
<div></div>
</div>
</div>
);
};

7
src/index.css Normal file
View File

@ -0,0 +1,7 @@
@import "tailwindcss";
@layer components {
.test-loading {
@apply w-20 h-20 bg-gray-300 rounded-full animate-spin;
}
}

6
src/main.tsx Normal file
View File

@ -0,0 +1,6 @@
import { createRoot } from 'react-dom/client';
import { App } from './App.tsx';
import './index.css';
createRoot(document.getElementById('root')!).render(<App />);

1
src/modules/basename.ts Normal file
View File

@ -0,0 +1 @@
export const basename = DEV_SERVER ? '/' : BASE_NAME;

6
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="vite/client" />
type SimpleObject = {
[key: string | number]: any;
};
declare let BASE_NAME: string;

43
tsconfig.app.json Normal file
View 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"
]
}

7
tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

22
tsconfig.node.json Normal file
View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}

53
vite.config.ts Normal file
View File

@ -0,0 +1,53 @@
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' };
import basicSsl from '@vitejs/plugin-basic-ssl';
const version = pkgs.version || '0.0.1';
const isDev = process.env.NODE_ENV === 'development';
const basename = isDev ? '/' : '/username/app';
const plugins = []
const isWeb = false;
if(isWeb) {
plugins.push(basicSsl())
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss(), ...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),
},
build: {
target: 'esnext',
},
server: {
port: 6004,
host: '0.0.0.0',
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: 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'),
},
},
},
});