GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(plugin-command): add plugin-command package · DavidAlphaFox/lowcode-engine@19eb917

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • engine
      • package.json
      • src
        • engine-core.ts
    • plugin-command
      • jest.config.js
      • package.json
      • src
        • index.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/engine/package.json‎

Copy file name to clipboardExpand all lines: packages/engine/package.json
+1Lines 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
},
Collapse file

‎packages/engine/src/engine-core.ts‎

Copy file name to clipboardExpand all lines: packages/engine/src/engine-core.ts
+3-3Lines 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

Collapse file

‎packages/plugin-command/jest.config.js‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const fs = require('fs');
2+
const { join } = require('path');
3+
const esModules = [].join('|');
4+
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
5+
6+
const jestConfig = {
7+
transformIgnorePatterns: [
8+
`/node_modules/(?!${esModules})/`,
9+
],
10+
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
11+
collectCoverage: true,
12+
collectCoverageFrom: [
13+
'src/**/*.ts',
14+
'src/**/*.tsx',
15+
],
16+
};
17+
18+
// 只对本仓库内的 pkg 做 mapping
19+
jestConfig.moduleNameMapper = {};
20+
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
21+
22+
module.exports = jestConfig;
Collapse file

‎packages/plugin-command/package.json‎

Copy file name to clipboardExpand all lines: packages/plugin-command/package.json
+7-2Lines 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
}
Collapse file

‎packages/plugin-command/src/index.ts‎

Copy file name to clipboardExpand all lines: packages/plugin-command/src/index.ts
+5-3Lines 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 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.