Skip to content

Commit

Permalink
chore: cli
Browse files Browse the repository at this point in the history
  • Loading branch information
mz-dfhp committed Mar 5, 2023
1 parent c0b3cbc commit 9efaa9b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
rules: {
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off'
'prefer-arrow-callback': 'off',
'@typescript-eslint/no-explicit-any': ['off']
},
settings: {
react: {
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and Deploy
on: # 监听 main 分支上的 push 事件
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest # 构建环境使用 ubuntu
steps:
- name: Checkout # 将代码拉到虚拟机
uses: actions/[email protected]
with:
persist-credentials: false

- name: Install and Build # 下载依赖 打包项目
run: |
npm i -g pnpm
pnpm install
pnpm run build
- name: Deploy to remote 🚀 # 部署到服务器
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
password: ${{ secrets.REMOTE_PASSWORD }}
port: 22
source: 'dist/'
target: ${{ secrets.REMOTE_TARGET }}
2 changes: 1 addition & 1 deletion src/layout/AppTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const AppTabs: React.FC = () => {
setItems(newPanes)
}

const onEdit = (targetKey: string, action: 'add' | 'remove') => {
const onEdit: any = (targetKey: string, action: 'add' | 'remove') => {
if (action === 'add') {
add()
} else {
Expand Down
29 changes: 28 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,33 @@ export default defineConfig({
},
server: {
open: true,
port: 8081
port: 8081,
host: '0.0.0.0',
cors: true,
// 跨域代理配置
proxy: {
'/api': {
target: 'https://www.baidu.com/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
// * 打包去除 console.log && debugger
esbuild: {
pure: ['console.log', 'debugger']
},
build: {
outDir: 'dist',
minify: 'esbuild',
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
// Static resource classification and packaging
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]'
}
}
}
})

0 comments on commit 9efaa9b

Please sign in to comment.