add cnb
This commit is contained in:
parent
10787fea6b
commit
55c97ad564
14
.cnb.yml
Normal file
14
.cnb.yml
Normal file
@ -0,0 +1,14 @@
|
||||
# .cnb.yml
|
||||
$:
|
||||
vscode:
|
||||
- docker:
|
||||
image: docker.cnb.cool/kevisual/dev-env:latest
|
||||
env:
|
||||
CNB_WELCOME_EXECUTE_COMMAND: echo "Welcome to CNB!"
|
||||
services:
|
||||
- vscode
|
||||
- docker
|
||||
# 开发环境启动后会执行的任务
|
||||
stages:
|
||||
- name: ls
|
||||
script: ls -al
|
7
.env.development
Normal file
7
.env.development
Normal file
@ -0,0 +1,7 @@
|
||||
## 本地环境
|
||||
|
||||
# VITE_API_URL = "http://localhost:8000"
|
||||
### 开发环境
|
||||
VITE_API_URL = "https://kevisual.xiongxiao.me"
|
||||
### 生产环境
|
||||
# VITE_API_URL = "https://kevisual.cn"
|
31
package.json
31
package.json
@ -23,18 +23,18 @@
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.0",
|
||||
"@kevisual/router": "0.0.10",
|
||||
"@mui/material": "^7.0.1",
|
||||
"@kevisual/router": "0.0.13",
|
||||
"@mui/material": "^7.0.2",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.13",
|
||||
"lodash-es": "^4.17.21",
|
||||
"lucide-react": "^0.487.0",
|
||||
"lucide-react": "^0.503.0",
|
||||
"nanoid": "^5.1.5",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-hook-form": "^7.55.0",
|
||||
"react-router": "^7.5.0",
|
||||
"react-router-dom": "^7.5.0",
|
||||
"react-hook-form": "^7.56.1",
|
||||
"react-router": "^7.5.2",
|
||||
"react-router-dom": "^7.5.2",
|
||||
"react-toastify": "^11.0.5",
|
||||
"zustand": "^5.0.3"
|
||||
},
|
||||
@ -44,18 +44,19 @@
|
||||
"devDependencies": {
|
||||
"@kevisual/components": "workspace:*",
|
||||
"@kevisual/query": "0.0.17",
|
||||
"@kevisual/types": "^0.0.6",
|
||||
"@tailwindcss/vite": "^4.1.3",
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.1",
|
||||
"@kevisual/types": "^0.0.7",
|
||||
"@tailwindcss/vite": "^4.1.4",
|
||||
"@types/node": "^22.15.2",
|
||||
"@types/react": "^19.1.2",
|
||||
"@types/react-dom": "^19.1.2",
|
||||
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitejs/plugin-react": "^4.4.1",
|
||||
"commander": "^13.1.0",
|
||||
"dotenv": "^16.5.0",
|
||||
"inquire": "^0.4.8",
|
||||
"tailwindcss": "^4.1.3",
|
||||
"tailwindcss": "^4.1.4",
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "^6.2.5"
|
||||
"vite": "^6.3.3"
|
||||
},
|
||||
"packageManager": "pnpm@10.7.1"
|
||||
"packageManager": "pnpm@10.10.0"
|
||||
}
|
977
pnpm-lock.yaml
generated
977
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
16
src/vite-env.d.ts
vendored
16
src/vite-env.d.ts
vendored
@ -3,4 +3,18 @@ type SimpleObject = {
|
||||
[key: string | number]: any;
|
||||
};
|
||||
|
||||
declare let BASE_NAME: string;
|
||||
declare let BASE_NAME: string;
|
||||
interface ViteTypeOptions {
|
||||
// 添加这行代码,你就可以将 ImportMetaEnv 的类型设为严格模式,
|
||||
// 这样就不允许有未知的键值了。
|
||||
// strictImportMetaEnv: unknown
|
||||
}
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_TITLE: string;
|
||||
// 更多环境变量...
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
|
108
vite.config.mjs
108
vite.config.mjs
@ -1,45 +1,28 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
import pkgs from './package.json' with { type: 'json' };
|
||||
import pkgs from './package.json';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import basicSsl from '@vitejs/plugin-basic-ssl';
|
||||
import dotenv from 'dotenv';
|
||||
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';
|
||||
}
|
||||
|
||||
const plugins = [react(), tailwindcss(), basicSsl()];
|
||||
dotenv.config({ path: '.env.development' });
|
||||
let target = process.env.VITE_API_URL || 'http://localhost:3000';
|
||||
let proxy = {
|
||||
'/root/center/': {
|
||||
target: `https://${target}/root/center/`,
|
||||
target: `${target}/root/center/`,
|
||||
},
|
||||
'/root/system-lib/': {
|
||||
target: `https://${target}/root/system-lib/`,
|
||||
target: `${target}/root/system-lib/`,
|
||||
},
|
||||
'/user/login/': {
|
||||
target: `https://${target}/user/login/`,
|
||||
target: `${target}/user/login/`,
|
||||
},
|
||||
'/api': {
|
||||
target: `https://${target}`,
|
||||
target: target,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewriteWsOrigin: true,
|
||||
@ -49,47 +32,34 @@ let proxy = {
|
||||
/**
|
||||
* @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'),
|
||||
APP_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: 7008,
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewriteWsOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
export default defineConfig(() => {
|
||||
return {
|
||||
plugins,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
'/api/router': {
|
||||
target: 'ws://localhost:3000',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewriteWsOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
},
|
||||
...proxy,
|
||||
},
|
||||
},
|
||||
base: basename,
|
||||
envPrefix: 'KEVISUAL_',
|
||||
define: {
|
||||
DEV_SERVER: JSON.stringify(process.env.NODE_ENV === 'development'),
|
||||
APP_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: 7008,
|
||||
host: '0.0.0.0',
|
||||
proxy,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user