Skip to content

Commit

Permalink
types: add ImportMetaEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong502431556 committed Mar 1, 2022
1 parent 563787c commit 38e0257
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 37 deletions.
28 changes: 28 additions & 0 deletions .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'
2 changes: 1 addition & 1 deletion .github/workflows/deploy-gitee.yml
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Expand Up @@ -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)"

Expand Down
24 changes: 11 additions & 13 deletions .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}]'
16 changes: 0 additions & 16 deletions .versionrc

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/config/app.ts
Expand Up @@ -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, // 面包屑
Expand Down
2 changes: 1 addition & 1 deletion src/config/axios/index.ts
Expand Up @@ -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({
Expand Down
12 changes: 11 additions & 1 deletion types/env.d.ts
Expand Up @@ -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<string, unknown>
readonly env: ImportMetaEnv
}
}

0 comments on commit 38e0257

Please sign in to comment.