Skip to content

Commit

Permalink
feat(env.d.ts): 增加环境变量类型声明文件
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Dec 18, 2021
1 parent 00fa173 commit 96489b1
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 133 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test prod gzip": "http-server dist --cors --gzip -c-1"
},
"dependencies": {
"@vueuse/core": "^7.3.0",
"@vueuse/core": "^7.4.0",
"ant-design-vue": "3.0.0-alpha.15",
"axios": "^0.24.0",
"core-js": "^3.20.0",
Expand Down Expand Up @@ -60,7 +60,7 @@
"husky": "^7.0.4",
"less": "^4.1.2",
"less-loader": "10.2.0",
"lint-staged": "^12.1.2",
"lint-staged": "^12.1.3",
"lodash-webpack-plugin": "^0.11.6",
"mockjs": "^1.1.0",
"path-browserify": "^1.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/components/JSON-schema-form/schema-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
setup(props, { attrs, emit }) {
let oldFormSchema: FormSchema;
// TODO 将formSchema克隆一份,避免修改原有的formSchema
// TODO 类型为FormSchema 提示:类型实例化过深,且可能无限
const formSchemaRef = ref<any>({});
// 表单项数据
const formModel = reactive({ ...props.initialValues });
Expand Down
2 changes: 1 addition & 1 deletion src/router/asyncModules/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getAsyncPage } from '@/utils/common';
const prefix = 'shared/demos/';

export default {
'views/shared/demos/form/rule-form.vue': getAsyncPage(`${prefix}form/rule-form.vue`), // 验证表单
'views/shared/demos/form/rule-form.vue': getAsyncPage(`${prefix}form/rule-form/index.vue`), // 验证表单
'views/shared/demos/icons/Iconfont.vue': getAsyncPage(`${prefix}icons/Iconfont.vue`), // 自定义图标
[`views/${prefix}tables/summary-table/index.vue`]: getAsyncPage(`${prefix}tables/summary-table`), // 合计表格
'views/shared/demos/button.vue': getAsyncPage(`${prefix}button.vue`), // 自定义按钮
Expand Down
27 changes: 27 additions & 0 deletions types/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @description 环境变量类型声明
*/
declare namespace NodeJS {
interface Process {
env: {
ENV: 'development' | 'production';

/** 网站前缀 */
BASE_URL: string;

/** API请求路径 */
VUE_APP_BASE_API: string;
/** socket路径 */
VUE_APP_BASE_SOCKET_PATH: string;
/** socket命名空间 */
VUE_APP_BASE_SOCKET_NSP: string;

/** mock api请求路径 */
VUE_APP_MOCK_API: string;
GITHUB_AUTH_TOKEN: string;
NODE_ENV: 'development' | 'production';
PORT?: string;
PWD: string;
};
}
}
21 changes: 0 additions & 21 deletions types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,6 @@ declare global {
declare interface WheelEvent {
path?: EventTarget[];
}
interface ImportMetaEnv extends ViteEnv {
__: unknown;
}

declare interface ViteEnv {
VITE_PORT: number;
VITE_USE_MOCK: boolean;
VITE_USE_PWA: boolean;
VITE_PUBLIC_PATH: string;
VITE_PROXY: [string, string][];
VITE_GLOB_APP_TITLE: string;
VITE_GLOB_APP_SHORT_NAME: string;
VITE_USE_CDN: boolean;
VITE_DROP_CONSOLE: boolean;
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
VITE_LEGACY: boolean;
VITE_USE_IMAGEMIN: boolean;
VITE_GENERATE_UI: string;
}

declare function parseInt(s: string | number, radix?: number): number;

declare function parseFloat(string: string | number): number;
Expand Down
59 changes: 0 additions & 59 deletions types/schema.d.ts

This file was deleted.

28 changes: 0 additions & 28 deletions types/tableColumn.d.ts

This file was deleted.

48 changes: 26 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1890,18 +1890,18 @@
resolved "https://registry.npm.taobao.org/@vue/web-component-wrapper/download/@vue/web-component-wrapper-1.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40vue%2Fweb-component-wrapper%2Fdownload%2F%40vue%2Fweb-component-wrapper-1.3.0.tgz#b6b40a7625429d2bd7c2281ddba601ed05dc7f1a"
integrity sha1-trQKdiVCnSvXwigd26YB7QXcfxo=

"@vueuse/core@^7.3.0":
version "7.3.0"
resolved "https://registry.npmmirror.com/@vueuse/core/download/@vueuse/core-7.3.0.tgz#fe24ff698069cb7dcc835a8fe2eeb29b22b2a702"
integrity sha512-gPJyMMAquva9Qwqz63qGQT122m5hWI8Kuy8kfPV/JLQU7m01CXooyv8FIrX9TV8OxVcHBTPXPJHY0oyUiFoNgw==
"@vueuse/core@^7.4.0":
version "7.4.0"
resolved "https://registry.npmmirror.com/@vueuse/core/download/@vueuse/core-7.4.0.tgz#dca848b9b2209d94142f2ec0baad4ee00455262c"
integrity sha512-CgYouxjXOE63gMn3l9cOsgzPTEAk3yoncsSmJUxXAi/to25rCPVWB/39jXTPhWZboR43EDDMWoEhHaSoMzaldg==
dependencies:
"@vueuse/shared" "7.3.0"
"@vueuse/shared" "7.4.0"
vue-demi "*"

"@vueuse/shared@7.3.0":
version "7.3.0"
resolved "https://registry.npmmirror.com/@vueuse/shared/download/@vueuse/shared-7.3.0.tgz#729b2f0a83f38647896d955902e828dcbd8ed7dc"
integrity sha512-vOAeI84tIXKVkzm8s/Mxbrzhj0QN6NyVc/sC6LrW0AjVNdvpD8sB1dZiDn9yh8T77WJmloCEt4zZVIppeq7I+w==
"@vueuse/shared@7.4.0":
version "7.4.0"
resolved "https://registry.npmmirror.com/@vueuse/shared/download/@vueuse/shared-7.4.0.tgz#8f0767c4f7b89112c1b34accec44a6c8625ce085"
integrity sha512-x5Jn6jUB8gS1mGnVCoNWFEpAoDkm2QwtacZTUgKMn0Ow8tlUBKIfGVOt4vn9qZB10froED/ARHEj79WKLXRieA==
dependencies:
vue-demi "*"

Expand Down Expand Up @@ -3745,7 +3745,7 @@ enhanced-resolve@^5.0.0, enhanced-resolve@^5.8.3:
graceful-fs "^4.2.4"
tapable "^2.2.0"

enquirer@^2.3.5, enquirer@^2.3.6:
enquirer@^2.3.5:
version "2.3.6"
resolved "https://registry.npm.taobao.org/enquirer/download/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=
Expand Down Expand Up @@ -5508,27 +5508,26 @@ lines-and-columns@^1.1.6:
resolved "https://registry.npmmirror.com/lines-and-columns/download/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==

lint-staged@^12.1.2:
version "12.1.2"
resolved "https://registry.npmmirror.com/lint-staged/download/lint-staged-12.1.2.tgz?cache=0&sync_timestamp=1637566864097&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Flint-staged%2Fdownload%2Flint-staged-12.1.2.tgz#90c571927e1371fc133e720671dd7989eab53f74"
integrity sha512-bSMcQVqMW98HLLLR2c2tZ+vnDCnx4fd+0QJBQgN/4XkdspGRPc8DGp7UuOEBe1ApCfJ+wXXumYnJmU+wDo7j9A==
lint-staged@^12.1.3:
version "12.1.3"
resolved "https://registry.npmmirror.com/lint-staged/download/lint-staged-12.1.3.tgz#a16e885c0a5e77de9cf559724d29a10348670e68"
integrity sha512-ajapdkaFxx+MVhvq6xQRg9zCnCLz49iQLJZP7+w8XaA3U4B35Z9xJJGq9vxmWo73QTvJLG+N2NxhjWiSexbAWQ==
dependencies:
cli-truncate "^3.1.0"
colorette "^2.0.16"
commander "^8.3.0"
debug "^4.3.2"
enquirer "^2.3.6"
debug "^4.3.3"
execa "^5.1.1"
lilconfig "2.0.4"
listr2 "^3.13.3"
listr2 "^3.13.5"
micromatch "^4.0.4"
normalize-path "^3.0.0"
object-inspect "^1.11.0"
object-inspect "^1.11.1"
string-argv "^0.3.1"
supports-color "^9.0.2"
supports-color "^9.2.1"
yaml "^1.10.2"

listr2@^3.13.3:
listr2@^3.13.5:
version "3.13.5"
resolved "https://registry.npmmirror.com/listr2/download/listr2-3.13.5.tgz#105a813f2eb2329c4aae27373a281d610ee4985f"
integrity sha512-3n8heFQDSk+NcwBn3CgxEibZGaRzx+pC64n3YjpMD1qguV4nWus3Al+Oo3KooqFKTQEJ1v7MmnbnyyNspgx3NA==
Expand Down Expand Up @@ -6210,7 +6209,12 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"

object-inspect@^1.11.0, object-inspect@^1.9.0:
object-inspect@^1.11.1:
version "1.12.0"
resolved "https://registry.npmmirror.com/object-inspect/download/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0"
integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==

object-inspect@^1.9.0:
version "1.11.1"
resolved "https://registry.npmmirror.com/object-inspect/download/object-inspect-1.11.1.tgz#d4bd7d7de54b9a75599f59a00bd698c1f1c6549b"
integrity sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA==
Expand Down Expand Up @@ -8081,7 +8085,7 @@ supports-color@^8.0.0:
dependencies:
has-flag "^4.0.0"

supports-color@^9.0.2:
supports-color@^9.2.1:
version "9.2.1"
resolved "https://registry.npmmirror.com/supports-color/download/supports-color-9.2.1.tgz#599dc9d45acf74c6176e0d880bab1d7d718fe891"
integrity sha512-Obv7ycoCTG51N7y175StI9BlAXrmgZrFhZOb0/PyjHBher/NmsdBgbbQ1Inhq+gIhz6+7Gb+jWF2Vqi7Mf1xnQ==
Expand Down

0 comments on commit 96489b1

Please sign in to comment.