chore: 完善依赖

This commit is contained in:
roymondchen 2024-05-14 14:25:47 +08:00
parent 5074c9e68b
commit 901fe4dd94
23 changed files with 60 additions and 69 deletions

View File

@ -18,7 +18,7 @@ https://tencent.github.io/tmagic-editor/playground/index.html
node.js >= 18 node.js >= 18
pnpm >= 8 pnpm >= 9
先安装 pnpm 先安装 pnpm

View File

@ -38,12 +38,14 @@
"vue" "vue"
], ],
"dependencies": { "dependencies": {
"@tmagic/data-source": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"events": "^3.3.0", "events": "^3.3.0",
"lodash-es": "^4.17.21" "lodash-es": "^4.17.21"
}, },
"peerDependencies": {
"@tmagic/data-source": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*"
},
"devDependencies": { "devDependencies": {
"@types/events": "^3.0.0", "@types/events": "^3.0.0",
"@types/lodash-es": "^4.17.4", "@types/lodash-es": "^4.17.4",

View File

@ -48,7 +48,10 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
}).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },

View File

@ -35,12 +35,14 @@
], ],
"dependencies": { "dependencies": {
"@tmagic/dep": "workspace:*", "@tmagic/dep": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"deep-state-observer": "^5.5.13", "deep-state-observer": "^5.5.13",
"events": "^3.3.0", "events": "^3.3.0",
"lodash-es": "^4.17.21" "lodash-es": "^4.17.21"
}, },
"peerDependencies": {
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*"
},
"devDependencies": { "devDependencies": {
"@types/events": "^3.0.0", "@types/events": "^3.0.0",
"@types/lodash-es": "^4.17.4", "@types/lodash-es": "^4.17.4",

View File

@ -52,7 +52,10 @@ export default defineConfig(({ mode }) => ({
if (mode === 'umd' && id === 'lodash-es') { if (mode === 'umd' && id === 'lodash-es') {
return false; return false;
} }
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
}).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },

View File

@ -30,7 +30,7 @@
"type": "git", "type": "git",
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"dependencies": { "peerDependencies": {
"@tmagic/schema": "workspace:*", "@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*" "@tmagic/utils": "workspace:*"
}, },

View File

@ -44,7 +44,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },

View File

@ -37,9 +37,6 @@
"vue3", "vue3",
"typescript" "typescript"
], ],
"dependencies": {
"vue": "^3.4.27"
},
"peerDependencies": { "peerDependencies": {
"vue": "^3.4.27" "vue": "^3.4.27"
}, },

View File

@ -47,7 +47,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
}, },
output: { output: {

View File

@ -47,14 +47,8 @@
], ],
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@tmagic/core": "workspace:*",
"@tmagic/dep": "workspace:*", "@tmagic/dep": "workspace:*",
"@tmagic/design": "workspace:*",
"@tmagic/form": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/stage": "workspace:*",
"@tmagic/table": "workspace:*", "@tmagic/table": "workspace:*",
"@tmagic/utils": "workspace:*",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"color": "^3.1.3", "color": "^3.1.3",
"emmet-monaco-es": "^5.3.0", "emmet-monaco-es": "^5.3.0",
@ -62,14 +56,16 @@
"gesto": "^1.19.1", "gesto": "^1.19.1",
"keycon": "^1.4.0", "keycon": "^1.4.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"monaco-editor": "^0.48.0",
"moveable": "^0.53.0", "moveable": "^0.53.0",
"serialize-javascript": "^6.0.0", "serialize-javascript": "^6.0.0"
"vue": "^3.4.27"
}, },
"peerDependencies": { "peerDependencies": {
"@tmagic/core": "workspace:*",
"@tmagic/design": "workspace:*", "@tmagic/design": "workspace:*",
"@tmagic/form": "workspace:*", "@tmagic/form": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/stage": "workspace:*",
"@tmagic/utils": "workspace:*",
"monaco-editor": "^0.48.0", "monaco-editor": "^0.48.0",
"vue": "^3.4.27" "vue": "^3.4.27"
}, },

View File

@ -63,7 +63,10 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
}).some((k) => new RegExp(`^${k}`).test(id));
}, },
output: { output: {

View File

@ -37,10 +37,6 @@
"vue3", "vue3",
"typescript" "typescript"
], ],
"dependencies": {
"@tmagic/design": "workspace:*",
"element-plus": "^2.6.1"
},
"peerDependencies": { "peerDependencies": {
"@tmagic/design": "workspace:*", "@tmagic/design": "workspace:*",
"element-plus": "^2.6.1" "element-plus": "^2.6.1"

View File

@ -35,7 +35,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },

View File

@ -38,13 +38,12 @@
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@tmagic/design": "workspace:*",
"@tmagic/utils": "workspace:*",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"sortablejs": "^1.15.2", "sortablejs": "^1.15.2"
"vue": "^3.4.27"
}, },
"peerDependencies": { "peerDependencies": {
"@tmagic/design": "workspace:*",
"@tmagic/utils": "workspace:*",
"vue": "^3.4.27" "vue": "^3.4.27"
}, },
"devDependencies": { "devDependencies": {

View File

@ -51,12 +51,10 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return ( return Object.keys({
/^vue/.test(id) || ...pkg.dependencies,
/^element-plus/.test(id) || ...pkg.peerDependencies,
/^@tmagic\//.test(id) || }).some((k) => new RegExp(`^${k}`).test(id));
Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id))
);
}, },
output: { output: {

View File

@ -32,15 +32,17 @@
}, },
"dependencies": { "dependencies": {
"@scena/guides": "^0.29.2", "@scena/guides": "^0.29.2",
"@tmagic/core": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*",
"events": "^3.3.0", "events": "^3.3.0",
"keycon": "^1.4.0", "keycon": "^1.4.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"moveable": "^0.53.0", "moveable": "^0.53.0",
"moveable-helper": "^0.4.0" "moveable-helper": "^0.4.0"
}, },
"peerDependencies": {
"@tmagic/core": "workspace:*",
"@tmagic/schema": "workspace:*",
"@tmagic/utils": "workspace:*"
},
"devDependencies": { "devDependencies": {
"@types/events": "^3.0.0", "@types/events": "^3.0.0",
"@types/lodash-es": "^4.17.4", "@types/lodash-es": "^4.17.4",

View File

@ -49,11 +49,10 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return ( return Object.keys({
/^vue/.test(id) || ...pkg.dependencies,
/^@tmagic\//.test(id) || ...pkg.peerDependencies,
Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)) }).some((k) => new RegExp(`^${k}`).test(id));
);
}, },
}, },
}, },

View File

@ -35,14 +35,12 @@
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"dependencies": { "dependencies": {
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"@tmagic/design": "workspace:*", "@tmagic/design": "workspace:*",
"@tmagic/form": "workspace:*", "@tmagic/form": "workspace:*",
"@tmagic/utils": "workspace:*", "@tmagic/utils": "workspace:*",
"lodash-es": "^4.17.21",
"vue": "^3.4.27"
},
"peerDependencies": {
"@tmagic/form": "workspace:*",
"vue": "^3.4.27" "vue": "^3.4.27"
}, },
"devDependencies": { "devDependencies": {

View File

@ -51,12 +51,10 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return ( return Object.keys({
/^vue/.test(id) || ...pkg.dependencies,
/^element-plus/.test(id) || ...pkg.peerDependencies,
/^@tmagic\//.test(id) || }).some((k) => new RegExp(`^${k}`).test(id));
Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id))
);
}, },
output: { output: {

View File

@ -37,11 +37,6 @@
"vue3", "vue3",
"typescript" "typescript"
], ],
"dependencies": {
"@tmagic/design": "workspace:*",
"tdesign-vue-next": "^1.8.1",
"vue": "^3.4.27"
},
"peerDependencies": { "peerDependencies": {
"@tmagic/design": "workspace:*", "@tmagic/design": "workspace:*",
"tdesign-vue-next": "^1.8.1", "tdesign-vue-next": "^1.8.1",

View File

@ -38,7 +38,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖 // 确保外部化处理那些你不想打包进库的依赖
external(id: string) { external(id: string) {
return Object.keys(pkg.dependencies).some((k) => new RegExp(`^${k}`).test(id)); return Object.keys(pkg.peerDependencies).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },

View File

@ -31,12 +31,11 @@
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"dependencies": { "dependencies": {
"@tmagic/schema": "workspace:*",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"lodash-es": "^4.17.21" "lodash-es": "^4.17.21"
}, },
"peerDependencies": { "peerDependencies": {
"dayjs": "^1.11.11" "@tmagic/schema": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash-es": "^4.17.4", "@types/lodash-es": "^4.17.4",

View File

@ -20,8 +20,6 @@ import { defineConfig, type LibraryFormats } from 'vite';
import pkg from './package.json'; import pkg from './package.json';
const deps = Object.keys(pkg.dependencies);
export default defineConfig(({ mode }) => ({ export default defineConfig(({ mode }) => ({
build: { build: {
cssCodeSplit: false, cssCodeSplit: false,
@ -43,7 +41,10 @@ export default defineConfig(({ mode }) => ({
if (mode === 'umd' && id === 'lodash-es') { if (mode === 'umd' && id === 'lodash-es') {
return false; return false;
} }
return deps.some((k) => new RegExp(`^${k}`).test(id)); return Object.keys({
...pkg.dependencies,
...pkg.peerDependencies,
}).some((k) => new RegExp(`^${k}`).test(id));
}, },
}, },
}, },