Skip to content

Commit 94dd25f

Browse files
committed
refactor(plugin-command): add plugin-command package
1 parent 5657d9c commit 94dd25f

File tree

5 files changed

+43
-8
lines changed

5 files changed

+43
-8
lines changed

packages/engine/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@alilc/lowcode-shell": "1.3.1",
2929
"@alilc/lowcode-utils": "1.3.1",
3030
"@alilc/lowcode-workspace": "1.3.1",
31+
"@alilc/lowcode-plugin-command": "1.3.1",
3132
"react": "^16.8.1",
3233
"react-dom": "^16.8.1"
3334
},

packages/engine/src/engine-core.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry';
6666
import { shellModelFactory } from './modules/shell-model-factory';
6767
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
6868
import { defaultContextMenu } from './inner-plugins/default-context-menu';
69-
import { defaultCommand } from '@alilc/lowcode-plugin-command';
69+
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
7070
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
7171

7272
export * from './modules/skeleton-types';
@@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
8484
await plugins.register(builtinHotkey);
8585
await plugins.register(registerDefaults, {}, { autoInit: true });
8686
await plugins.register(defaultContextMenu);
87-
await plugins.register(defaultCommand, {});
87+
await plugins.register(CommandPlugin, {});
8888

8989
return () => {
9090
plugins.delete(OutlinePlugin.pluginName);
@@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
9494
plugins.delete(builtinHotkey.pluginName);
9595
plugins.delete(registerDefaults.pluginName);
9696
plugins.delete(defaultContextMenu.pluginName);
97-
plugins.delete(defaultCommand.pluginName);
97+
plugins.delete(CommandPlugin.pluginName);
9898
};
9999
}
100100

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const esModules = [
2+
'@recore/obx-react',
3+
// '@ali/lowcode-editor-core',
4+
].join('|');
5+
6+
module.exports = {
7+
// transform: {
8+
// '^.+\\.[jt]sx?$': 'babel-jest',
9+
// // '^.+\\.(ts|tsx)$': 'ts-jest',
10+
// // '^.+\\.(js|jsx)$': 'babel-jest',
11+
// },
12+
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
13+
transformIgnorePatterns: [
14+
`/node_modules/(?!${esModules})/`,
15+
],
16+
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
17+
collectCoverage: false,
18+
collectCoverageFrom: [
19+
'src/**/*.{ts,tsx}',
20+
'!src/**/*.d.ts',
21+
'!src/base/**',
22+
'!src/fields/**',
23+
'!src/prop.ts',
24+
'!**/node_modules/**',
25+
'!**/vendor/**',
26+
],
27+
};

packages/plugin-command/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"author": "liujuping <[email protected]>",
66
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
77
"license": "ISC",
8-
"main": "lib/plugin-command.js",
8+
"main": "lib/index.js",
9+
"module": "es/index.js",
910
"directories": {
1011
"lib": "lib",
1112
"test": "__tests__"
1213
},
1314
"files": [
14-
"lib"
15+
"lib",
16+
"es"
1517
],
1618
"publishConfig": {
1719
"access": "public"
@@ -30,5 +32,8 @@
3032
"dependencies": {
3133
"@alilc/lowcode-types": "^1.3.1",
3234
"@alilc/lowcode-utils": "^1.3.1"
35+
},
36+
"devDependencies": {
37+
"@alib/build-scripts": "^0.1.18"
3338
}
3439
}

packages/plugin-command/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ
22
import { nodeCommand } from './node-command';
33
import { historyCommand } from './history-command';
44

5-
export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
5+
export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
66
const { plugins } = ctx;
77

88
return {
@@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext
1717
};
1818
};
1919

20-
defaultCommand.pluginName = '___default_command___';
21-
defaultCommand.meta = {
20+
CommandPlugin.pluginName = '___default_command___';
21+
CommandPlugin.meta = {
2222
commandScope: 'common',
2323
};
24+
25+
export default CommandPlugin;

0 commit comments

Comments
 (0)