diff --git a/.eslintignore b/.eslintignore index fe308b20..31f5c478 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,6 +4,7 @@ entry-dist coverage node_modules dest +types comp-entry.ts config-entry.ts diff --git a/.gitignore b/.gitignore index c9dd99d7..9ee629b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules dist +types .temp .cache diff --git a/magic-admin/web/tsconfig.json b/magic-admin/web/tsconfig.json index f78f9f5f..a6e358d3 100644 --- a/magic-admin/web/tsconfig.json +++ b/magic-admin/web/tsconfig.json @@ -15,7 +15,7 @@ "types": [ "webpack-env", "jest", - "./types", + "./typings", "node" ], "paths": { diff --git a/magic-admin/web/types/axios-jsonp/index.d.ts b/magic-admin/web/typings/axios-jsonp/index.d.ts similarity index 100% rename from magic-admin/web/types/axios-jsonp/index.d.ts rename to magic-admin/web/typings/axios-jsonp/index.d.ts diff --git a/magic-admin/web/types/index.d.ts b/magic-admin/web/typings/index.d.ts similarity index 100% rename from magic-admin/web/types/index.d.ts rename to magic-admin/web/typings/index.d.ts diff --git a/magic-admin/web/types/shims-vue.d.ts b/magic-admin/web/typings/shims-vue.d.ts similarity index 100% rename from magic-admin/web/types/shims-vue.d.ts rename to magic-admin/web/typings/shims-vue.d.ts diff --git a/package.json b/package.json index f8dcee42..fdaa91e9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "packageManager": "pnpm@7.1.9", "scripts": { "bootstrap": "pnpm i && pnpm build", - "clean:top": "rimraf */**/dist */**/admin-dist */**/entry-dist */dist coverage dwt*", + "clean:top": "rimraf */**/dist */**/types */**/admin-dist */**/entry-dist */dist coverage dwt*", "clean:modules": "rimraf node_modules **/node_modules **/**/node_modules", "clean:all": "pnpm clean:top && pnpm clean:modules", "lint": "eslint . --ext .js,.vue,.ts,.tsx", diff --git a/packages/core/package.json b/packages/core/package.json index b2c9c95b..1dcbe08b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -6,7 +6,7 @@ ], "main": "dist/tmagic-core.umd.js", "module": "dist/tmagic-core.mjs", - "types": "dist/types/src/index.d.ts", + "types": "types/index.d.ts", "exports": { ".": { "import": "./dist/tmagic-core.mjs", @@ -20,7 +20,9 @@ }, "license": "Apache-2.0", "scripts": { - "build": "vite build" + "build": "npm run build:type && vite build", + "build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json", + "clear:type": "rimraf ./types" }, "engines": { "node": ">=14" @@ -39,8 +41,8 @@ "devDependencies": { "@types/events": "^3.0.0", "@types/node": "^15.12.4", + "rimraf": "^3.0.2", "typescript": "^4.7.4", - "vite": "^3.0.4", - "vite-plugin-dts": "^0.9.6" + "vite": "^3.0.4" } } diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json new file mode 100644 index 00000000..c9476221 --- /dev/null +++ b/packages/core/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "declarationDir": "types", + "forceConsistentCasingInFileNames": true, + "paths": {}, + }, + "include": [ + "src" + ], +} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index a80ed035..6c40cf1e 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -3,7 +3,4 @@ "compilerOptions": { "baseUrl": "../..", }, - "exclude": [ - "**/dist/**/*" - ], } diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts index 0e9355d4..b64aa7f3 100644 --- a/packages/core/vite.config.ts +++ b/packages/core/vite.config.ts @@ -19,21 +19,10 @@ import path from 'path'; import { defineConfig } from 'vite'; -import dts from 'vite-plugin-dts'; import pkg from './package.json'; export default defineConfig({ - plugins: [ - dts({ - outputDir: 'dist/types', - include: ['src/**/*'], - staticImport: true, - insertTypesEntry: true, - logDiagnostics: true, - }), - ], - resolve: { alias: process.env.NODE_ENV === 'production' diff --git a/packages/editor/package.json b/packages/editor/package.json index ec7a417b..fb26e9f0 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -8,7 +8,7 @@ "main": "dist/tmagic-editor.umd.js", "module": "dist/tmagic-editor.mjs", "style": "dist/style.css", - "types": "dist/types/src/index.d.ts", + "types": "types/index.d.ts", "exports": { ".": { "import": "./dist/tmagic-editor.mjs", @@ -22,7 +22,9 @@ }, "license": "Apache-2.0", "scripts": { - "build": "vue-tsc --noEmit && vite build" + "build": "npm run build:type && vite build", + "build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json", + "clear:type": "rimraf ./types" }, "engines": { "node": ">=14" @@ -73,10 +75,10 @@ "@vitejs/plugin-vue": "^3.0.1", "@vue/compiler-sfc": "^3.2.37", "@vue/test-utils": "^2.0.0", + "rimraf": "^3.0.2", "sass": "^1.35.1", "typescript": "^4.7.4", "vite": "^3.0.4", - "vite-plugin-dts": "^0.9.6", - "vue-tsc": "^0.38.2" + "vue-tsc": "^0.39.4" } } diff --git a/packages/editor/src/components/ContentMenu.vue b/packages/editor/src/components/ContentMenu.vue index 4adf5df8..b9771ece 100644 --- a/packages/editor/src/components/ContentMenu.vue +++ b/packages/editor/src/components/ContentMenu.vue @@ -22,119 +22,107 @@ - diff --git a/packages/editor/src/components/ToolButton.vue b/packages/editor/src/components/ToolButton.vue index 0d72d689..80db7521 100644 --- a/packages/editor/src/components/ToolButton.vue +++ b/packages/editor/src/components/ToolButton.vue @@ -50,8 +50,8 @@ - diff --git a/packages/editor/src/fields/UISelect.vue b/packages/editor/src/fields/UISelect.vue index 37eb9865..6511cfff 100644 --- a/packages/editor/src/fields/UISelect.vue +++ b/packages/editor/src/fields/UISelect.vue @@ -12,89 +12,69 @@ - +