From 38e0257487e4138a74ad1bb4ee4ba004abcfaa12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=87=AF=E9=BE=99?= <502431556@qq.com> Date: Tue, 1 Mar 2022 14:37:15 +0800 Subject: [PATCH] types: add ImportMetaEnv --- .github/workflows/auto-merge.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/deploy-gitee.yml | 2 +- .github/workflows/deploy.yml | 4 ++-- .github/workflows/release.yml | 24 +++++++++++------------- .versionrc | 16 ---------------- package.json | 2 -- src/config/app.ts | 2 +- src/config/axios/index.ts | 2 +- types/env.d.ts | 12 +++++++++++- 9 files changed, 55 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/auto-merge.yml delete mode 100644 .versionrc diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 000000000..32478e47e --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,28 @@ +name: Automerge + +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + status: {} + +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: Automerge + uses: 'pascalgn/automerge-action@v0.14.3' + env: + GITHUB_TOKEN: '${{ secrets.ACTIONS_DEPLOY_KEY }}' + MERGE_LABELS: '' + MERGE_FILTER_AUTHOR: 'kailong321200875' diff --git a/.github/workflows/deploy-gitee.yml b/.github/workflows/deploy-gitee.yml index ef89ee2f0..6b125a32f 100644 --- a/.github/workflows/deploy-gitee.yml +++ b/.github/workflows/deploy-gitee.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: use Node.js 16 + - name: Use Node.js 16 uses: actions/setup-node@v2.1.2 with: node-version: '16.x' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3c3ca349f..25da1a423 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,12 +12,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: use Node.js 16 + - name: Use Node.js 16 uses: actions/setup-node@v2.1.2 with: node-version: '16.x' - - name: Get yarn cache + - name: Get Yarn Cache id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc6f9c623..0a22fb702 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,18 @@ -name: Release - on: push: - tags: - - 'v*' + branches: + - master + +name: Release jobs: - release: + release-please: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: GoogleCloudPlatform/release-please-action@v3 + id: release with: - node-version: '14' - - run: npx conventional-github-releaser -p angular - env: - CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.ACCESS_TOKEN}} + token: ${{ secrets.ACTIONS_DEPLOY_KEY }} + release-type: node + package-name: standard-version + changelog-types: '[{"type": "types", "section":"Types", "hidden": false},{"type": "revert", "section":"Reverts", "hidden": false},{"type": "feat", "section": "Features", "hidden": false},{"type": "fix", "section": "Bug Fixes", "hidden": false},{"type": "improvement", "section": "Feature Improvements", "hidden": false},{"type": "docs", "section":"Docs", "hidden": false},{"type": "style", "section":"Styling", "hidden": false},{"type": "refactor", "section":"Code Refactoring", "hidden": false},{"type": "perf", "section":"Performance Improvements", "hidden": false},{"type": "test", "section":"Tests", "hidden": false},{"type": "build", "section":"Build System", "hidden": false},{"type": "ci", "section":"CI", "hidden":false}]' diff --git a/.versionrc b/.versionrc deleted file mode 100644 index 22bca9652..000000000 --- a/.versionrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "types": [ - {"type": "chore", "section":"Others", "hidden": false}, - {"type": "revert", "section":"Reverts", "hidden": false}, - {"type": "feat", "section": "Features", "hidden": false}, - {"type": "fix", "section": "Bug Fixes", "hidden": false}, - {"type": "improvement", "section": "Feature Improvements", "hidden": false}, - {"type": "docs", "section":"Docs", "hidden": false}, - {"type": "style", "section":"Styling", "hidden": false}, - {"type": "refactor", "section":"Code Refactoring", "hidden": false}, - {"type": "perf", "section":"Performance Improvements", "hidden": false}, - {"type": "test", "section":"Tests", "hidden": false}, - {"type": "build", "section":"Build System", "hidden": false}, - {"type": "ci", "section":"CI", "hidden":false} - ] -} \ No newline at end of file diff --git a/package.json b/package.json index b2c6cc864..9705ee979 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "serve:dev": "vite preview --mode dev", "serve:test": "vite preview --mode test", "npm:check": "npx npm-check-updates", - "release": "standard-version", "clean": "npx rimraf node_modules", "clean:cache": "npx rimraf node_modules/.cache", "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src", @@ -84,7 +83,6 @@ "prettier": "^2.5.1", "pretty-quick": "^3.1.3", "rimraf": "^3.0.2", - "standard-version": "^9.3.2", "stylelint": "^14.5.3", "stylelint-config-html": "^1.0.0", "stylelint-config-prettier": "^9.0.3", diff --git a/src/config/app.ts b/src/config/app.ts index 715935689..296b587f9 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -48,7 +48,7 @@ export const appModules: AppState = { userInfo: 'userInfo', // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突 sizeMap: ['default', 'large', 'small'], mobile: false, // 是否是移动端 - title: import.meta.env.VITE_APP_TITLE as string, // 标题 + title: import.meta.env.VITE_APP_TITLE, // 标题 pageLoading: false, // 路由跳转loading breadcrumb: true, // 面包屑 diff --git a/src/config/axios/index.ts b/src/config/axios/index.ts index b03178365..6bc86d3ce 100644 --- a/src/config/axios/index.ts +++ b/src/config/axios/index.ts @@ -14,7 +14,7 @@ import { config } from '@/config/axios/config' const { result_code, base_url } = config -export const PATH_URL = base_url[import.meta.env.VITE_API_BASEPATH as string] +export const PATH_URL = base_url[import.meta.env.VITE_API_BASEPATH] // 创建axios实例 const service: AxiosInstance = axios.create({ diff --git a/types/env.d.ts b/types/env.d.ts index d4653f54b..1364a4766 100644 --- a/types/env.d.ts +++ b/types/env.d.ts @@ -7,8 +7,18 @@ declare module '*.vue' { export default component } +interface ImportMetaEnv { + readonly VITE_APP_TITLE: string + readonly VITE_API_BASEPATH: string + readonly VITE_BASE_PATH: string + readonly VITE_DROP_DEBUGGER: string + readonly VITE_DROP_CONSOLE: string + readonly VITE_SOURCEMAP: string + readonly VITE_OUT_DIR: string +} + declare global { interface ImportMeta { - env: Record + readonly env: ImportMetaEnv } }