Skip to content

Commit

Permalink
chore: improve the console project infrastructure (#4105)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

#### What this PR does / why we need it:

维护 Console 端的开发基础设施。

- 升级 TypeScript 以及 Vue 对于 TS 支持的相关包。
- 优化 packages 下所有包的配置,解决构建时生成 d.ts 文件的异常。
- 解决 TS 异常。

#### Special notes for your reviewer:

尝试执行:

1. pnpm build:packages
2. pnpm typecheck

观察是否正常即可。

#### Does this PR introduce a user-facing change?

```release-note
维护 Console 端的开发基础设施。
```
  • Loading branch information
ruibaby authored Jun 26, 2023
1 parent d28f607 commit 96225e4
Show file tree
Hide file tree
Showing 35 changed files with 737 additions and 841 deletions.
3 changes: 3 additions & 0 deletions console/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ module.exports = {
extends: ["plugin:cypress/recommended"],
},
],
parserOptions: {
ecmaVersion: "latest",
},
};
1 change: 1 addition & 0 deletions console/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="vite/client" />
/// <reference types="unplugin-icons/types/vue" />

export {};

Expand Down
19 changes: 10 additions & 9 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"vue": "^3.2.45",
"vue-demi": "^0.13.11",
"vue-grid-layout": "3.0.0-beta1",
"vue-i18n": "^9.2.2",
"vue-i18n": "9.3.0-beta.19",
"vue-router": "^4.1.6",
"vuedraggable": "^4.1.0"
},
Expand All @@ -103,9 +103,10 @@
"@iconify-json/mdi": "^1.1.50",
"@iconify-json/vscode-icons": "^1.1.22",
"@intlify/unplugin-vue-i18n": "^0.9.3",
"@rushstack/eslint-patch": "^1.2.0",
"@rushstack/eslint-patch": "^1.3.2",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.0",
"@tsconfig/node18": "^2.0.1",
"@types/jsdom": "^20.0.1",
"@types/lodash.clonedeep": "4.5.7",
"@types/lodash.debounce": "^4.0.7",
Expand All @@ -115,19 +116,19 @@
"@types/qs": "^6.9.7",
"@types/randomstring": "^1.1.8",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vitest/ui": "^0.25.3",
"@vue/compiler-sfc": "^3.2.45",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "^2.2.4",
"@vue/tsconfig": "^0.1.3",
"@vue/test-utils": "^2.3.2",
"@vue/tsconfig": "^0.4.0",
"autoprefixer": "^10.4.14",
"c8": "^7.12.0",
"cypress": "^10.11.0",
"eslint": "^8.41.0",
"eslint": "^8.43.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-vue": "^9.13.0",
"eslint-plugin-vue": "^9.15.0",
"husky": "^8.0.3",
"jsdom": "^20.0.3",
"lint-staged": "^13.2.2",
Expand All @@ -141,7 +142,7 @@
"tailwindcss": "^3.2.7",
"tailwindcss-safe-area": "^0.2.2",
"tailwindcss-themer": "^2.0.3",
"typescript": "~4.7.4",
"typescript": "~5.0.4",
"unplugin-icons": "^0.14.15",
"vite": "^4.0.4",
"vite-compression-plugin": "^0.0.4",
Expand All @@ -150,6 +151,6 @@
"vite-plugin-pwa": "^0.13.3",
"vite-plugin-static-copy": "^0.11.1",
"vitest": "^0.25.3",
"vue-tsc": "^1.0.24"
"vue-tsc": "^1.8.1"
}
}
1 change: 1 addition & 0 deletions console/packages/components/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="histoire" />
/// <reference types="unplugin-icons/types/vue" />

declare module "*.vue" {
import type { DefineComponent } from "vue";
Expand Down
2 changes: 1 addition & 1 deletion console/packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@iconify-json/ri": "^1.1.4",
"histoire": "^0.11.7",
"unplugin-icons": "^0.14.14",
"vite-plugin-dts": "^1.7.3"
"vite-plugin-dts": "^2.3.0"
},
"peerDependencies": {
"vue": "^3.2.37",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type Type = "success" | "info" | "warning" | "error";
export const DialogProviderProvideKey = "DIALOG_PROVIDER_PROVIDE_KEY";
import type { Type as ButtonType } from "@/components/button/interface";
import type { Type as ButtonType } from "../button/interface";

export interface useDialogOptions {
type?: Type;
Expand Down
2 changes: 1 addition & 1 deletion console/packages/components/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion console/packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [],
"references": [
{
"path": "./tsconfig.vite-config.json"
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
Expand Down
9 changes: 9 additions & 0 deletions console/packages/components/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"types": ["node"]
}
}
8 changes: 0 additions & 8 deletions console/packages/components/tsconfig.vite-config.json

This file was deleted.

5 changes: 3 additions & 2 deletions console/packages/components/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fileURLToPath, URL } from "url";

import { defineConfig } from "vite";
import { defineConfig, type Plugin } from "vite";
import Vue from "@vitejs/plugin-vue";
import VueJsx from "@vitejs/plugin-vue-jsx";
import Icons from "unplugin-icons/vite";
Expand All @@ -13,10 +13,11 @@ export default defineConfig({
VueJsx(),
Icons({ compiler: "vue3" }),
Dts({
tsConfigFilePath: "./tsconfig.app.json",
entryRoot: "./src",
outputDir: "./dist",
insertTypesEntry: true,
}),
}) as Plugin,
],
define: {
"process.env": process.env,
Expand Down
2 changes: 1 addition & 1 deletion console/packages/shared/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

export {};

import type { Component } from "vue";
import type { CoreMenuGroupId } from "./src/types/menus";


declare module "*.vue" {
import type { DefineComponent } from "vue";
// eslint-disable-next-line
Expand Down
5 changes: 4 additions & 1 deletion console/packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@
"homepage": "https://github.com/halo-dev/console/tree/main/packages/shared#readme",
"license": "MIT",
"devDependencies": {
"vite-plugin-dts": "^1.7.3"
"vite-plugin-dts": "^2.3.0"
},
"peerDependencies": {
"vue": "^3.2.37",
"vue-router": "^4.0.16"
},
"dependencies": {
"@halo-dev/api-client": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion console/packages/shared/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion console/packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [],
"references": [
{
"path": "./tsconfig.vite-config.json"
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
Expand Down
9 changes: 9 additions & 0 deletions console/packages/shared/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"types": ["node"]
}
}
8 changes: 0 additions & 8 deletions console/packages/shared/tsconfig.vite-config.json

This file was deleted.

1 change: 1 addition & 0 deletions console/packages/shared/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
Vue(),
VueJsx(),
Dts({
tsConfigFilePath: "./tsconfig.app.json",
entryRoot: "./src",
outputDir: "./dist",
insertTypesEntry: true,
Expand Down
Loading

0 comments on commit 96225e4

Please sign in to comment.