types: add ImportMetaEnv

This commit is contained in:
陈凯龙 2022-03-01 14:37:15 +08:00
parent 563787c296
commit 38e0257487
9 changed files with 55 additions and 37 deletions

28
.github/workflows/auto-merge.yml vendored Normal file
View File

@ -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'

View File

@ -12,7 +12,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: use Node.js 16 - name: Use Node.js 16
uses: actions/setup-node@v2.1.2 uses: actions/setup-node@v2.1.2
with: with:
node-version: '16.x' node-version: '16.x'

View File

@ -12,12 +12,12 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: use Node.js 16 - name: Use Node.js 16
uses: actions/setup-node@v2.1.2 uses: actions/setup-node@v2.1.2
with: with:
node-version: '16.x' node-version: '16.x'
- name: Get yarn cache - name: Get Yarn Cache
id: yarn-cache id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)" run: echo "::set-output name=dir::$(yarn cache dir)"

View File

@ -1,20 +1,18 @@
name: Release
on: on:
push: push:
tags: branches:
- 'v*' - master
name: Release
jobs: jobs:
release: release-please:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: GoogleCloudPlatform/release-please-action@v3
id: release
with: with:
fetch-depth: 0 token: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- uses: actions/setup-node@v2 release-type: node
with: package-name: standard-version
node-version: '14' 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}]'
- run: npx conventional-github-releaser -p angular
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.ACCESS_TOKEN}}

View File

@ -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}
]
}

View File

@ -16,7 +16,6 @@
"serve:dev": "vite preview --mode dev", "serve:dev": "vite preview --mode dev",
"serve:test": "vite preview --mode test", "serve:test": "vite preview --mode test",
"npm:check": "npx npm-check-updates", "npm:check": "npx npm-check-updates",
"release": "standard-version",
"clean": "npx rimraf node_modules", "clean": "npx rimraf node_modules",
"clean:cache": "npx rimraf node_modules/.cache", "clean:cache": "npx rimraf node_modules/.cache",
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src", "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
@ -84,7 +83,6 @@
"prettier": "^2.5.1", "prettier": "^2.5.1",
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"standard-version": "^9.3.2",
"stylelint": "^14.5.3", "stylelint": "^14.5.3",
"stylelint-config-html": "^1.0.0", "stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",

View File

@ -48,7 +48,7 @@ export const appModules: AppState = {
userInfo: 'userInfo', // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突 userInfo: 'userInfo', // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突
sizeMap: ['default', 'large', 'small'], sizeMap: ['default', 'large', 'small'],
mobile: false, // 是否是移动端 mobile: false, // 是否是移动端
title: import.meta.env.VITE_APP_TITLE as string, // 标题 title: import.meta.env.VITE_APP_TITLE, // 标题
pageLoading: false, // 路由跳转loading pageLoading: false, // 路由跳转loading
breadcrumb: true, // 面包屑 breadcrumb: true, // 面包屑

View File

@ -14,7 +14,7 @@ import { config } from '@/config/axios/config'
const { result_code, base_url } = 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实例 // 创建axios实例
const service: AxiosInstance = axios.create({ const service: AxiosInstance = axios.create({

12
types/env.d.ts vendored
View File

@ -7,8 +7,18 @@ declare module '*.vue' {
export default component 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 { declare global {
interface ImportMeta { interface ImportMeta {
env: Record<string, unknown> readonly env: ImportMetaEnv
} }
} }