From 1b5f86751e836471aa055f64f3f6fdf34859da5c Mon Sep 17 00:00:00 2001 From: shizhongming Date: Fri, 23 Feb 2024 16:32:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9E=B6=E6=9E=84):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smart-ui-app/.eslintrc.cjs | 4 +++ modules/smart-ui-app/build.config.ts | 10 +++++++ modules/smart-ui-app/package.json | 40 ++++++++++++++++++++++++++++ modules/smart-ui-app/src/index.ts | 1 + modules/smart-ui-app/src/init.ts | 6 +++++ modules/smart-ui-app/tsconfig.json | 5 ++++ package.json | 1 + packages/types/src/utils.ts | 6 +++++ pnpm-lock.yaml | 23 ++++++++++++++-- pnpm-workspace.yaml | 1 + src/main.ts | 3 +++ vite.config.ts | 2 +- 12 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 modules/smart-ui-app/.eslintrc.cjs create mode 100644 modules/smart-ui-app/build.config.ts create mode 100644 modules/smart-ui-app/package.json create mode 100644 modules/smart-ui-app/src/index.ts create mode 100644 modules/smart-ui-app/src/init.ts create mode 100644 modules/smart-ui-app/tsconfig.json diff --git a/modules/smart-ui-app/.eslintrc.cjs b/modules/smart-ui-app/.eslintrc.cjs new file mode 100644 index 000000000..cd27a1961 --- /dev/null +++ b/modules/smart-ui-app/.eslintrc.cjs @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['@vben/eslint-config/strict'], +}; diff --git a/modules/smart-ui-app/build.config.ts b/modules/smart-ui-app/build.config.ts new file mode 100644 index 000000000..20c8b54a1 --- /dev/null +++ b/modules/smart-ui-app/build.config.ts @@ -0,0 +1,10 @@ +import { defineBuildConfig } from 'unbuild'; + +export default defineBuildConfig({ + clean: true, + entries: ['src/index'], + declaration: true, + rollup: { + emitCJS: true, + }, +}); diff --git a/modules/smart-ui-app/package.json b/modules/smart-ui-app/package.json new file mode 100644 index 000000000..0a9c0325f --- /dev/null +++ b/modules/smart-ui-app/package.json @@ -0,0 +1,40 @@ +{ + "name": "@smart/smart-ui-app", + "version": "1.0.0", + "homepage": "https://github.com/vbenjs/vue-vben-admin", + "bugs": { + "url": "https://github.com/vbenjs/vue-vben-admin/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vbenjs/vue-vben-admin.git", + "directory": "packages/hooks" + }, + "license": "MIT", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "default": "./src/index.ts" + } + }, + "main": "./src/index.ts", + "module": "./src/index.ts", + "files": [ + "dist" + ], + "scripts": { + "//build": "pnpm unbuild", + "//stub": "pnpm unbuild --stub", + "clean": "pnpm rimraf .turbo node_modules dist", + "lint": "pnpm eslint ." + }, + "dependencies": { + "@vueuse/core": "^10.7.1", + "lodash-es": "^4.17.21", + "vue": "3.3.4" + }, + "devDependencies": { + "@vben/types": "workspace:*" + } +} diff --git a/modules/smart-ui-app/src/index.ts b/modules/smart-ui-app/src/index.ts new file mode 100644 index 000000000..094199629 --- /dev/null +++ b/modules/smart-ui-app/src/index.ts @@ -0,0 +1 @@ +export * from './init'; diff --git a/modules/smart-ui-app/src/init.ts b/modules/smart-ui-app/src/init.ts new file mode 100644 index 000000000..3f7f36da5 --- /dev/null +++ b/modules/smart-ui-app/src/init.ts @@ -0,0 +1,6 @@ +import { SmartUiInitParams } from '@vben/types'; + +export const init = (params: SmartUiInitParams) => { + console.log(params); + console.log('初始化'); +}; diff --git a/modules/smart-ui-app/tsconfig.json b/modules/smart-ui-app/tsconfig.json new file mode 100644 index 000000000..8508d5072 --- /dev/null +++ b/modules/smart-ui-app/tsconfig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@vben/ts-config/vue-app.json", + "include": ["src"] +} diff --git a/package.json b/package.json index 789bc8403..ac5e31c09 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@iconify/iconify": "^3.1.1", "@logicflow/core": "^1.2.18", "@logicflow/extension": "^1.2.19", + "@smart/smart-ui-app": "workspace:*", "@vben/hooks": "workspace:*", "@vue/shared": "^3.4.5", "@vueuse/core": "^10.7.1", diff --git a/packages/types/src/utils.ts b/packages/types/src/utils.ts index b8ed226a0..f4edf077b 100644 --- a/packages/types/src/utils.ts +++ b/packages/types/src/utils.ts @@ -1,3 +1,5 @@ +import { App } from 'vue'; + /** * 任意类型的异步函数 */ @@ -56,3 +58,7 @@ export { type Recordable, type TimeoutHandle, }; + +export interface SmartUiInitParams { + app: App; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fed305228..a3f51980f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@logicflow/extension': specifier: ^1.2.19 version: 1.2.19 + '@smart/smart-ui-app': + specifier: workspace:* + version: link:modules/smart-ui-app '@vben/hooks': specifier: workspace:* version: link:packages/hooks @@ -450,6 +453,22 @@ importers: specifier: ^2.0.1 version: 2.0.1(vite@5.0.10) + modules/smart-ui-app: + dependencies: + '@vueuse/core': + specifier: ^10.7.1 + version: 10.7.1(vue@3.3.4) + lodash-es: + specifier: ^4.17.21 + version: 4.17.21 + vue: + specifier: 3.3.4 + version: 3.3.4 + devDependencies: + '@vben/types': + specifier: workspace:* + version: link:../../packages/types + packages/hooks: dependencies: '@vueuse/core': @@ -2519,7 +2538,7 @@ packages: dev: true /@types/web-bluetooth@0.0.20: - resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==, tarball: https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz} dev: false /@types/yargs-parser@21.0.3: @@ -11994,7 +12013,7 @@ packages: dev: true /vue-demi@0.14.6(vue@3.3.4): - resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==} + resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==, tarball: https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.6.tgz} engines: {node: '>=12'} hasBin: true requiresBuild: true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 103ba0720..ec2e52bb1 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,3 +2,4 @@ packages: - 'internal/*' - 'packages/*' - 'apps/*' + - 'modules/*' diff --git a/src/main.ts b/src/main.ts index 1c4c808b4..ec351adbd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,8 @@ import { setupStore } from '@/store'; import App from './App.vue'; +import { init } from '@smart/smart-ui-app'; + async function bootstrap() { const app = createApp(App); @@ -58,6 +60,7 @@ async function bootstrap() { // https://next.router.vuejs.org/api/#isready // await router.isReady(); + init({ app }); app.mount('#app'); } diff --git a/vite.config.ts b/vite.config.ts index 14bf6c074..f25e3f42f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -19,7 +19,7 @@ export default defineApplicationConfig({ server: { proxy: { '/basic-api': { - target: 'http://localhost:9095', + target: 'http://localhost:8080', changeOrigin: true, ws: true, rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),