Merge pull request '测试' (#1) from dev into main
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			Reviewed-on: #1
This commit is contained in:
		
							
								
								
									
										91
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,91 @@
 | 
			
		||||
kind: pipeline # 定义一个管道
 | 
			
		||||
type: docker # 当前管道的类型
 | 
			
		||||
name: test # 当前管道的名称
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
 | 
			
		||||
  # 第一步:构建项目
 | 
			
		||||
  - name: 构建项目
 | 
			
		||||
    image: node:18-alpine
 | 
			
		||||
    commands:
 | 
			
		||||
      - npm install
 | 
			
		||||
      - npm run build
 | 
			
		||||
    volumes:
 | 
			
		||||
      - name: node_modules_cache
 | 
			
		||||
        path: /drone/src/node_modules
 | 
			
		||||
 | 
			
		||||
  # 第二步:上传静态资源到腾讯云COS (使用另一个插件)
 | 
			
		||||
  - name: 静态资源上传到cos
 | 
			
		||||
    image: ccr.ccs.tencentyun.com/xiaoqidun/gocos
 | 
			
		||||
    settings:
 | 
			
		||||
      secret_id:
 | 
			
		||||
        from_secret: cos_secret_id
 | 
			
		||||
      secret_key:
 | 
			
		||||
        from_secret: cos_secret_key
 | 
			
		||||
      bucket_url: https://files-1302416092.cos.ap-shanghai.myqcloud.com
 | 
			
		||||
      source: dist
 | 
			
		||||
      target: /utils
 | 
			
		||||
      strip_prefix: dist
 | 
			
		||||
 | 
			
		||||
  # 第三步:部署到服务器
 | 
			
		||||
  - name: 清除服务器缓存
 | 
			
		||||
    image: appleboy/drone-ssh
 | 
			
		||||
    settings:
 | 
			
		||||
      host:
 | 
			
		||||
        from_secret: server_host
 | 
			
		||||
      username:
 | 
			
		||||
        from_secret: server_username  
 | 
			
		||||
      password:
 | 
			
		||||
        from_secret: server_password
 | 
			
		||||
      # 或者使用SSH密钥
 | 
			
		||||
      # key:
 | 
			
		||||
      #   from_secret: server_ssh_key
 | 
			
		||||
      port: 22
 | 
			
		||||
      script:
 | 
			
		||||
        - rm -rf /www/wwwroot/utils.zguiy.com/*
 | 
			
		||||
        - mkdir -p /www/wwwroot/utils.zguiy.com/
 | 
			
		||||
        - chmod 755 /www/wwwroot/utils.zguiy.com/
 | 
			
		||||
    when:
 | 
			
		||||
      branch: 
 | 
			
		||||
        - main
 | 
			
		||||
        - master
 | 
			
		||||
        - dev
 | 
			
		||||
 | 
			
		||||
  # 第四步:上传构建文件
 | 
			
		||||
  - name: 上传构建文件
 | 
			
		||||
    image: appleboy/drone-scp
 | 
			
		||||
    settings:
 | 
			
		||||
      host:
 | 
			
		||||
        from_secret: server_host
 | 
			
		||||
      username:
 | 
			
		||||
        from_secret: server_username
 | 
			
		||||
      password:
 | 
			
		||||
        from_secret: server_password
 | 
			
		||||
      # 或者使用SSH密钥
 | 
			
		||||
      # key:
 | 
			
		||||
      #   from_secret: server_ssh_key
 | 
			
		||||
      port: 22
 | 
			
		||||
      source: dist/*
 | 
			
		||||
      target: /www/wwwroot/show.zguiy.com/
 | 
			
		||||
      strip_components: 1
 | 
			
		||||
    when:
 | 
			
		||||
      branch:
 | 
			
		||||
        - main
 | 
			
		||||
        - master  
 | 
			
		||||
        - dev
 | 
			
		||||
 | 
			
		||||
# 定义数据卷用于缓存node_modules
 | 
			
		||||
volumes:
 | 
			
		||||
  - name: node_modules_cache
 | 
			
		||||
    host:
 | 
			
		||||
      path: /tmp/drone_cache/node_modules
 | 
			
		||||
 | 
			
		||||
# 触发条件
 | 
			
		||||
trigger:
 | 
			
		||||
  branch:
 | 
			
		||||
    - main
 | 
			
		||||
    - master
 | 
			
		||||
    - dev
 | 
			
		||||
  event:
 | 
			
		||||
    - push
 | 
			
		||||
    - pull_request
 | 
			
		||||
							
								
								
									
										1
									
								
								.env.development
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.env.development
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
VITE_PUBLIC = /
 | 
			
		||||
							
								
								
									
										1
									
								
								.env.production
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.env.production
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
VITE_PUBLIC = https://cdn.files.zguiy.com/utils/
 | 
			
		||||
							
								
								
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -11,6 +11,7 @@
 | 
			
		||||
        "vue": "^3.5.13"
 | 
			
		||||
      },
 | 
			
		||||
      "devDependencies": {
 | 
			
		||||
        "@types/node": "^24.0.7",
 | 
			
		||||
        "@vitejs/plugin-vue": "^5.2.3",
 | 
			
		||||
        "@vue/tsconfig": "^0.7.0",
 | 
			
		||||
        "typescript": "~5.8.3",
 | 
			
		||||
@ -782,6 +783,16 @@
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "license": "MIT"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/@types/node": {
 | 
			
		||||
      "version": "24.0.7",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.7.tgz",
 | 
			
		||||
      "integrity": "sha512-YIEUUr4yf8q8oQoXPpSlnvKNVKDQlPMWrmOcgzoduo7kvA2UF0/BwJ/eMKFTiTtkNL17I0M6Xe2tvwFU7be6iw==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "license": "MIT",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "undici-types": "~7.8.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/@vitejs/plugin-vue": {
 | 
			
		||||
      "version": "5.2.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz",
 | 
			
		||||
@ -1300,6 +1311,13 @@
 | 
			
		||||
        "node": ">=14.17"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/undici-types": {
 | 
			
		||||
      "version": "7.8.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
 | 
			
		||||
      "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "license": "MIT"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/vite": {
 | 
			
		||||
      "version": "6.3.5",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz",
 | 
			
		||||
 | 
			
		||||
@ -5,17 +5,18 @@
 | 
			
		||||
  "type": "module",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "dev": "vite",
 | 
			
		||||
    "build": "vue-tsc -b && vite build",
 | 
			
		||||
    "build": "vite build",
 | 
			
		||||
    "preview": "vite preview"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "vue": "^3.5.13"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/node": "^24.0.3",
 | 
			
		||||
    "@vitejs/plugin-vue": "^5.2.3",
 | 
			
		||||
    "@vue/tsconfig": "^0.7.0",
 | 
			
		||||
    "typescript": "~5.8.3",
 | 
			
		||||
    "vite": "^6.3.5",
 | 
			
		||||
    "vue-tsc": "^2.2.8"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
    "strict": true,
 | 
			
		||||
    "noUnusedLocals": true,
 | 
			
		||||
    "noUnusedParameters": true,
 | 
			
		||||
    "erasableSyntaxOnly": true,
 | 
			
		||||
    "verbatimModuleSyntax": true,
 | 
			
		||||
    "noFallthroughCasesInSwitch": true,
 | 
			
		||||
    "noUncheckedSideEffectImports": true
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@
 | 
			
		||||
    "strict": true,
 | 
			
		||||
    "noUnusedLocals": true,
 | 
			
		||||
    "noUnusedParameters": true,
 | 
			
		||||
    "erasableSyntaxOnly": true,
 | 
			
		||||
    "noFallthroughCasesInSwitch": true,
 | 
			
		||||
    "noUncheckedSideEffectImports": true
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,47 @@
 | 
			
		||||
import { defineConfig } from 'vite'
 | 
			
		||||
import { defineConfig, loadEnv } from 'vite'
 | 
			
		||||
import vue from '@vitejs/plugin-vue'
 | 
			
		||||
import { resolve } from 'path'
 | 
			
		||||
 | 
			
		||||
// https://vite.dev/config/
 | 
			
		||||
export default defineConfig({
 | 
			
		||||
  plugins: [vue()],
 | 
			
		||||
export default defineConfig(({ mode }) => {
 | 
			
		||||
  const env = loadEnv(mode, process.cwd());
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    base: env.VITE_PUBLIC || './', //使用环境变量设置资源路径,默认为相对路径
 | 
			
		||||
  
 | 
			
		||||
    server: {
 | 
			
		||||
      host: true,
 | 
			
		||||
      port: 8080, //vite项目启动时自定义端口
 | 
			
		||||
 | 
			
		||||
      open: true,
 | 
			
		||||
      proxy: {
 | 
			
		||||
        // 正则表达式写法
 | 
			
		||||
        '^/api': {
 | 
			
		||||
          target: 'http://192.168.3.13:3000/api', // 后端服务实际地址
 | 
			
		||||
          changeOrigin: true, //开启代理
 | 
			
		||||
          rewrite: (path) => path.replace(/^\/api/, '')
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    plugins: [
 | 
			
		||||
      vue(),
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    resolve: {
 | 
			
		||||
      //别名
 | 
			
		||||
      alias: {
 | 
			
		||||
        '@': resolve(__dirname, './src'),
 | 
			
		||||
        components: resolve(__dirname, './src/components'),
 | 
			
		||||
        script: resolve(__dirname, './src/script'),
 | 
			
		||||
        utils: resolve(__dirname, './src/utils'),
 | 
			
		||||
        stores: resolve(__dirname, './src/stores')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    build: {
 | 
			
		||||
      assetsDir: 'static', //打包后的公共文件夹名
 | 
			
		||||
      target: 'es2015',
 | 
			
		||||
      cssTarget: ['chrome61'],
 | 
			
		||||
      chunkSizeWarningLimit: 5000
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user