mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
refactor(plugin-command): add plugin-command package
This commit is contained in:
parent
501ad872c4
commit
19eb917259
@ -28,6 +28,7 @@
|
|||||||
"@alilc/lowcode-shell": "1.3.1",
|
"@alilc/lowcode-shell": "1.3.1",
|
||||||
"@alilc/lowcode-utils": "1.3.1",
|
"@alilc/lowcode-utils": "1.3.1",
|
||||||
"@alilc/lowcode-workspace": "1.3.1",
|
"@alilc/lowcode-workspace": "1.3.1",
|
||||||
|
"@alilc/lowcode-plugin-command": "1.3.1",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry';
|
|||||||
import { shellModelFactory } from './modules/shell-model-factory';
|
import { shellModelFactory } from './modules/shell-model-factory';
|
||||||
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
|
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
|
||||||
import { defaultContextMenu } from './inner-plugins/default-context-menu';
|
import { defaultContextMenu } from './inner-plugins/default-context-menu';
|
||||||
import { defaultCommand } from '@alilc/lowcode-plugin-command';
|
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
|
||||||
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
|
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
|
||||||
|
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
|
|||||||
await plugins.register(builtinHotkey);
|
await plugins.register(builtinHotkey);
|
||||||
await plugins.register(registerDefaults, {}, { autoInit: true });
|
await plugins.register(registerDefaults, {}, { autoInit: true });
|
||||||
await plugins.register(defaultContextMenu);
|
await plugins.register(defaultContextMenu);
|
||||||
await plugins.register(defaultCommand, {});
|
await plugins.register(CommandPlugin, {});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
plugins.delete(OutlinePlugin.pluginName);
|
plugins.delete(OutlinePlugin.pluginName);
|
||||||
@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
|
|||||||
plugins.delete(builtinHotkey.pluginName);
|
plugins.delete(builtinHotkey.pluginName);
|
||||||
plugins.delete(registerDefaults.pluginName);
|
plugins.delete(registerDefaults.pluginName);
|
||||||
plugins.delete(defaultContextMenu.pluginName);
|
plugins.delete(defaultContextMenu.pluginName);
|
||||||
plugins.delete(defaultCommand.pluginName);
|
plugins.delete(CommandPlugin.pluginName);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
packages/plugin-command/jest.config.js
Normal file
22
packages/plugin-command/jest.config.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const { join } = require('path');
|
||||||
|
const esModules = [].join('|');
|
||||||
|
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
|
||||||
|
|
||||||
|
const jestConfig = {
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
`/node_modules/(?!${esModules})/`,
|
||||||
|
],
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
|
collectCoverage: true,
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'src/**/*.ts',
|
||||||
|
'src/**/*.tsx',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 只对本仓库内的 pkg 做 mapping
|
||||||
|
jestConfig.moduleNameMapper = {};
|
||||||
|
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
|
||||||
|
|
||||||
|
module.exports = jestConfig;
|
||||||
@ -5,13 +5,15 @@
|
|||||||
"author": "liujuping <liujup@foxmail.com>",
|
"author": "liujuping <liujup@foxmail.com>",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "lib/plugin-command.js",
|
"main": "lib/index.js",
|
||||||
|
"module": "es/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib",
|
||||||
|
"es"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@ -30,5 +32,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-types": "^1.3.1",
|
"@alilc/lowcode-types": "^1.3.1",
|
||||||
"@alilc/lowcode-utils": "^1.3.1"
|
"@alilc/lowcode-utils": "^1.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ
|
|||||||
import { nodeCommand } from './node-command';
|
import { nodeCommand } from './node-command';
|
||||||
import { historyCommand } from './history-command';
|
import { historyCommand } from './history-command';
|
||||||
|
|
||||||
export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
|
export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
|
||||||
const { plugins } = ctx;
|
const { plugins } = ctx;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultCommand.pluginName = '___default_command___';
|
CommandPlugin.pluginName = '___default_command___';
|
||||||
defaultCommand.meta = {
|
CommandPlugin.meta = {
|
||||||
commandScope: 'common',
|
commandScope: 'common',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default CommandPlugin;
|
||||||
Loading…
x
Reference in New Issue
Block a user