build(projects): 更新tsconfig.json

This commit is contained in:
Soybean 2022-03-05 23:20:00 +08:00
parent f5c56c355c
commit f42ee9dbe5
13 changed files with 467 additions and 432 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
pnpm lint && pnpm typecheck
npm run lint && npm run typecheck

View File

@ -4,7 +4,7 @@
"scripts": {
"dev": "cross-env VITE_HTTP_ENV=test vite",
"dev:prod": "cross-env VITE_HTTP_ENV=prod vite",
"typecheck": "vue-tsc",
"typecheck": "vue-tsc --noEmit",
"build": "npm run typecheck && cross-env VITE_HTTP_ENV=prod vite build",
"build:test": "npm run typecheck && cross-env VITE_HTTP_ENV=test vite build",
"build:vercel": "cross-env VITE_HASH_ROUTE=true vite build",
@ -26,7 +26,7 @@
"dependencies": {
"@antv/g2plot": "^2.4.9",
"@better-scroll/core": "^2.4.2",
"@vueuse/core": "^7.7.0",
"@vueuse/core": "^7.7.1",
"axios": "^0.26.0",
"clipboard": "^2.0.10",
"colord": "^2.9.2",
@ -64,6 +64,7 @@
"@vitejs/plugin-vue": "^2.2.4",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"@vue/tsconfig": "^0.1.3",
"commitizen": "^4.2.4",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
@ -75,20 +76,20 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.5.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.4",
"lint-staged": "^12.3.5",
"mockjs": "^1.1.0",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.5.1",
"rollup-plugin-visualizer": "^5.6.0",
"sass": "^1.49.9",
"typescript": "^4.6.2",
"typescript": "~4.5.5",
"unplugin-icons": "^0.13.2",
"unplugin-vue-components": "^0.17.21",
"vite": "2.8.6",
"vite-plugin-html": "^3.1.0",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-windicss": "^1.8.2",
"vite-plugin-windicss": "^1.8.3",
"vue-tsc": "^0.32.1",
"vueuc": "^0.4.27",
"windicss": "^3.5.1"

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import { useRouter } from 'vue-router';
import type { RouteLocationRaw } from 'vue-router';
import { router as globalRouter, routeName } from '@/router';
import { LoginModuleKey } from '@/interface';
import type { LoginModuleKey } from '@/interface';
/**
*

View File

@ -1,4 +1,4 @@
import {
import type {
EnumLayoutComponentName,
EnumThemeLayoutMode,
EnumThemeTabMode,

View File

@ -1,4 +1,4 @@
import BScroll from '@better-scroll/core';
import type BScroll from '@better-scroll/core';
export interface ExposeBetterScroll {
instance: BScroll;

View File

@ -1,4 +1,9 @@
import { EnumThemeLayoutMode, EnumThemeTabMode, EnumThemeHorizontalMenuPosition, EnumThemeAnimateMode } from '@/enum';
import type {
EnumThemeLayoutMode,
EnumThemeTabMode,
EnumThemeHorizontalMenuPosition,
EnumThemeAnimateMode
} from '@/enum';
import type { ThemeLayoutMode, ThemeTabMode, ThemeHorizontalMenuPosition, ThemeAnimateMode } from './enum';
/** 主题相关类型 */

View File

@ -18,7 +18,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { FollowerPlacement } from 'vueuc';
import { EnumThemeLayoutMode } from '@/enum';
import type { EnumThemeLayoutMode } from '@/enum';
import type { ThemeLayoutMode } from '@/interface';
interface Props {

View File

@ -1,5 +1,5 @@
import { getLoginModuleRegExp } from '@/utils';
import { LoginModuleKey } from '@/interface';
import type { LoginModuleKey } from '@/interface';
/** 固定的路由 */
export const constantRoutes: AuthRoute.Route[] = [

View File

@ -1,4 +1,4 @@
import { Ref } from 'vue';
import type { Ref } from 'vue';
import type { FormItemRule } from 'naive-ui';
import { REGEXP_PHONE, REGEXP_PWD, REGEXP_CODE_SIX, REGEXP_EMAIL } from '@/config';

View File

@ -5,12 +5,17 @@ type ViewComponent = Record<string, () => Promise<Component>>;
const importViews = import.meta.glob('./**/index.vue');
const COMPONENTS_KEY = 'components';
const PREFIX = './';
const SUFFIX = '/index.vue';
/**
*
* 1 './' => ''
* 2 '/index.vue' => ''
* 3 'system-view_' => '' (RouteKey)
*/
const KEY_REGEXP = /\.\/|\/index\.vue|system-view_/g;
const PATH_SPLIT_MARK = '/';
const ROUTE_KEY_SPLIT_MARK = '_';
/** 系统的内置路由该文件夹名称不作为RouteKey */
const SYSTEM_VIEW = 'system-view_';
/** 过滤掉组件文件 */
const viewKeys = Object.keys(importViews).filter(key => !key.includes(COMPONENTS_KEY));
@ -18,11 +23,8 @@ const viewKeys = Object.keys(importViews).filter(key => !key.includes(COMPONENTS
function getViewComponent() {
const components: ViewComponent = {};
viewKeys.forEach(key => {
const routeKey = key
.replace(PREFIX, '')
.replace(SUFFIX, '')
.replaceAll(PATH_SPLIT_MARK, ROUTE_KEY_SPLIT_MARK)
.replace(SYSTEM_VIEW, '');
const routeKey = key.replace(KEY_REGEXP, '').replace(new RegExp(PATH_SPLIT_MARK, 'g'), ROUTE_KEY_SPLIT_MARK);
components[routeKey] = importViews[key];
});
return components;

View File

@ -1,26 +1,24 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"isolatedModules": true,
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"importHelpers": true,
"skipLibCheck": true,
"noEmit": true,
"paths": {
"@/*": ["src/*"],
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": [
"src/typings/**/*.d.ts",
"src/**/*",
"src/**/*.vue",
"vite.config.*",
"mock/**/*.ts",
"build/**/*.ts",
".env-config.ts",
],
"exclude": [
"/dist/**",
"node_modules"
],
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./src/*"],
"~/*": ["./*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
},
"types": ["naive-ui/volar"]
},
"include": ["vite.config.*", "src/typings/**/*.d.ts", "src/**/*", "src/**/*.vue", "mock/**/*.ts", "build/**/*.ts", ".env-config.ts", "icons.d.ts"],
"exclude": ["/dist/**", "node_modules"]
}
}

View File

@ -0,0 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node", "vitest"]
}
}