Skip to content

Commit a4b366b

Browse files
committed
build(plugin-datasource-pane): 重构构建配置并迁移至 Vite
- 移除原有的 build.js 配置文件 - 新增 vite.config.ts 配置文件 - 更新 package.json 中的构建脚本 - 调整项目结构,将打包输出目录从 lib 改为 dist - 优化类型导入语句,使用 type 关键字 - 版本号升级到 1.1.0-beta.1
1 parent 27f18a4 commit a4b366b

File tree

6 files changed

+89
-81
lines changed

6 files changed

+89
-81
lines changed

packages/plugin-datasource-pane/build.js

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,64 @@
11
{
22
"name": "@felce/lowcode-plugin-datasource-pane",
3-
"version": "1.0.11",
3+
"version": "1.1.0-beta.1",
44
"description": "低代码引擎数据源面板",
5-
"main": "lib/index.js",
5+
"main": "dist/index.umd.js",
6+
"module": "dist/index.es.js",
7+
"types": "dist/index.d.ts",
8+
"style": "dist/index.css",
69
"files": [
7-
"lib"
10+
"dist"
811
],
912
"scripts": {
10-
"start": "build-scripts start --config build.js",
11-
"build": "build-scripts build --config build.js",
12-
"test": "ava",
13-
"test:snapshot": "ava --update-snapshots"
14-
},
15-
"ava": {
16-
"compileEnhancements": false,
17-
"snapshotDir": "test/fixtures/__snapshots__",
18-
"extensions": [
19-
"ts"
20-
],
21-
"require": [
22-
"ts-node/register"
23-
]
13+
"start": "vite",
14+
"build": "vite build"
2415
},
2516
"license": "MIT",
26-
"devDependencies": {
27-
"@alib/build-scripts": "^0.1.32",
28-
"@alifd/theme-lowcode-light": "^0.2.1",
29-
"@alilc/build-plugin-alt": "^1.2.2",
30-
"@felce/lowcode-engine": "beta",
31-
"@felce/lowcode-shell": "^1.0.0",
32-
"@felce/lowcode-types": "beta",
33-
"@types/babel-types": "^7.0.9",
34-
"@types/babel__preset-env": "^7.9.2",
35-
"@types/react": "^18",
36-
"@types/react-dom": "^18",
37-
"@types/traverse": "^0.6.32",
38-
"build-plugin-fusion": "^0.1.9",
39-
"build-plugin-moment-locales": "^0.1.3",
40-
"monaco-editor": "^0.21.0"
41-
},
42-
"peerDependencies": {
43-
"@alifd/next": "^1.25.13",
44-
"moment": "^2.29.1"
45-
},
4617
"dependencies": {
47-
"@alifd/next": "^1.25.13",
48-
"@babel/core": "^7.15.8",
49-
"@babel/parser": "^7.15.8",
50-
"@babel/preset-env": "^7.15.8",
51-
"@babel/preset-react": "^7.14.5",
52-
"@babel/standalone": "^7.15.8",
53-
"@babel/traverse": "^7.15.4",
54-
"@babel/types": "^7.15.6",
55-
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
56-
"classnames": "^2.3.1",
57-
"js-beautify": "^1.14.0",
18+
"@alifd/next": "^1.27.30",
19+
"classnames": "^2.5.1",
20+
"js-beautify": "^1.15.1",
5821
"react": "^18.3.1",
5922
"react-dom": "^18.3.1",
23+
"@felce/lowcode-engine": "^1.5.0-beta.4",
24+
"@felce/lowcode-shell": "^1.5.0-beta.4",
25+
"@felce/lowcode-types": "^1.5.0-beta.4",
26+
"@felce/lowcode-utils": "^1.5.0-beta.4",
6027
"@felce/lowcode-plugin-base-monaco-editor": "workspace:^",
61-
"@felce/lowcode-types": "^1.0.0-beta.3",
62-
"@formily/core": "^2.1.12",
63-
"@formily/next": "^2.1.12",
64-
"@formily/react": "^2.1.12",
65-
"@types/lodash": "^4.14.178",
28+
"@formily/core": "^2.3.2",
29+
"@formily/next": "^2.3.2",
30+
"@formily/react": "^2.3.2",
6631
"@xstate/react": "^4.1.3",
6732
"ajv": "^6.12.4",
68-
"lodash": "^4.17.20",
33+
"lodash": "^4.17.21",
6934
"react-copy-to-clipboard": "^5.0.4",
7035
"react-dnd": "^14.0.4",
7136
"react-dnd-html5-backend": "^14.0.2",
7237
"react-error-boundary": "^3.1.4",
7338
"svgo": "2.x",
7439
"traverse": "^0.6.6",
75-
"xstate": "^5.18.2"
40+
"xstate": "^5.18.2",
41+
"json-schema": "^0.4.0",
42+
"monaco-editor": "^0.52.2",
43+
"zen-logger": "^1.1.4"
7644
},
45+
"devDependencies": {
46+
"@alilc/lowcode-datasource-types": "^1.2.1",
47+
"@types/lodash": "^4.17.14",
48+
"@types/react": "^18.3.1",
49+
"@types/react-dom": "^18.3.1",
50+
"@types/traverse": "^0.6.32",
51+
"@types/json-schema": "^7.0.15"
52+
},
53+
"peerDependencies": {},
7754
"homepage": "https://unpkg.com/@felce/lowcode-plugin-datasource-pane@1.0.11/build/index.html",
7855
"repository": {
7956
"type": "git",
8057
"url": "https://github.com/fe-lce/lowcode-plugins.git",
8158
"directory": "packages/plugin-datasource-pane"
59+
},
60+
"publishConfig": {
61+
"registry": "https://registry.npmjs.org/",
62+
"access": "public"
8263
}
8364
}
File renamed without changes.

packages/plugin-datasource-pane/src/pane/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { DataSourcePane } from './DataSourcePane';
1414
import { DataSourceFilter } from '../components/DataSourceFilter';
1515
import { DataSourceList } from '../components/DataSourceList';
1616
import { DroppableDataSourceListItem } from '../components/DataSourceListItem';
17-
import {
17+
import type {
1818
DataSourcePaneImportPlugin,
1919
DataSourceType,
2020
DataSourceConfig,

packages/plugin-datasource-pane/src/types/ImportPlugin.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RuntimeDataSourceConfig as DataSourceConfig } from '@alilc/lowcode-datasource-types';
1+
import type { RuntimeDataSourceConfig as DataSourceConfig } from '@alilc/lowcode-datasource-types';
22
import { DataSourceType } from './DataSourceType';
33

44
// 导入插件
@@ -9,7 +9,8 @@ export interface DataSourcePaneImportPlugin {
99
componentProps?: DataSourcePaneImportPluginCustomProps;
1010
}
1111

12-
export interface DataSourcePaneImportPluginCustomProps extends DataSourcePaneImportPluginComponentProps {
12+
export interface DataSourcePaneImportPluginCustomProps
13+
extends DataSourcePaneImportPluginComponentProps {
1314
[customPropName: string]: any;
1415
}
1516

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { defineConfig } from 'vite';
2+
import React from '@vitejs/plugin-react-swc';
3+
import dts from 'vite-plugin-dts';
4+
import external from 'vite-plugin-external';
5+
6+
export default defineConfig({
7+
plugins: [
8+
// external({
9+
// externals: {
10+
// react: 'React',
11+
// },
12+
// }),
13+
React({}),
14+
dts(),
15+
],
16+
server: {
17+
port: 4173,
18+
hmr: false,
19+
},
20+
build: {
21+
lib: {
22+
entry: 'src/index.ts',
23+
fileName(format, entryName) {
24+
return `${entryName}.${format}.js`;
25+
},
26+
name: 'LowCodePluginDataSourcePane',
27+
cssFileName: 'index',
28+
},
29+
rollupOptions: {
30+
output: {
31+
exports: 'named',
32+
},
33+
external: ['react', 'react-dom'],
34+
},
35+
},
36+
resolve: {
37+
alias: {
38+
'~@alifd': '@alifd',
39+
},
40+
},
41+
css: {
42+
preprocessorOptions: {
43+
scss: {
44+
// https://cn.vitejs.dev/config/shared-options.html#css-preprocessoroptions
45+
api: 'legacy',
46+
},
47+
},
48+
},
49+
});

0 commit comments

Comments
 (0)