GeezerVison is showing github.com — refactor(plugin-command): add plugin-command package · Julvae/lowcode-engine@19eb917
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/engine/package.json +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 28 | 28 | "@alilc/lowcode-shell": "1.3.1", | 29 | 29 | "@alilc/lowcode-utils": "1.3.1", | 30 | 30 | "@alilc/lowcode-workspace": "1.3.1", | | 31 | + "@alilc/lowcode-plugin-command": "1.3.1", | 31 | 32 | "react": "^16.8.1", | 32 | 33 | "react-dom": "^16.8.1" | 33 | 34 | }, | |
Collapse file Copy file name to clipboardExpand all lines: packages/engine/src/engine-core.ts +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry'; | 66 | 66 | import { shellModelFactory } from './modules/shell-model-factory'; | 67 | 67 | import { builtinHotkey } from './inner-plugins/builtin-hotkey'; | 68 | 68 | import { defaultContextMenu } from './inner-plugins/default-context-menu'; | 69 | | -import { defaultCommand } from '@alilc/lowcode-plugin-command'; | | 69 | +import { CommandPlugin } from '@alilc/lowcode-plugin-command'; | 70 | 70 | import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane'; | 71 | 71 |
| 72 | 72 | export * from './modules/skeleton-types'; | @@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins | 84 | 84 | await plugins.register(builtinHotkey); | 85 | 85 | await plugins.register(registerDefaults, {}, { autoInit: true }); | 86 | 86 | await plugins.register(defaultContextMenu); | 87 | | - await plugins.register(defaultCommand, {}); | | 87 | + await plugins.register(CommandPlugin, {}); | 88 | 88 |
| 89 | 89 | return () => { | 90 | 90 | plugins.delete(OutlinePlugin.pluginName); | @@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins | 94 | 94 | plugins.delete(builtinHotkey.pluginName); | 95 | 95 | plugins.delete(registerDefaults.pluginName); | 96 | 96 | plugins.delete(defaultContextMenu.pluginName); | 97 | | - plugins.delete(defaultCommand.pluginName); | | 97 | + plugins.delete(CommandPlugin.pluginName); | 98 | 98 | }; | 99 | 99 | } | 100 | 100 |
| |
Collapse file Copy file name to clipboard +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 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 Copy file name to clipboardExpand all lines: packages/plugin-command/package.json +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | | 6 | 6 | "homepage": "https://github.com/alibaba/lowcode-engine#readme", | 7 | 7 | "license": "ISC", | 8 | | - "main": "lib/plugin-command.js", | | 8 | + "main": "lib/index.js", | | 9 | + "module": "es/index.js", | 9 | 10 | "directories": { | 10 | 11 | "lib": "lib", | 11 | 12 | "test": "__tests__" | 12 | 13 | }, | 13 | 14 | "files": [ | 14 | | - "lib" | | 15 | + "lib", | | 16 | + "es" | 15 | 17 | ], | 16 | 18 | "publishConfig": { | 17 | 19 | "access": "public" | | 30 | 32 | "dependencies": { | 31 | 33 | "@alilc/lowcode-types": "^1.3.1", | 32 | 34 | "@alilc/lowcode-utils": "^1.3.1" | | 35 | + }, | | 36 | + "devDependencies": { | | 37 | + "@alib/build-scripts": "^0.1.18" | 33 | 38 | } | 34 | 39 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/plugin-command/src/index.ts +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ | 2 | 2 | import { nodeCommand } from './node-command'; | 3 | 3 | import { historyCommand } from './history-command'; | 4 | 4 |
| 5 | | -export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => { | | 5 | +export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => { | 6 | 6 | const { plugins } = ctx; | 7 | 7 |
| 8 | 8 | return { | @@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext | 17 | 17 | }; | 18 | 18 | }; | 19 | 19 |
| 20 | | -defaultCommand.pluginName = '___default_command___'; | 21 | | -defaultCommand.meta = { | | 20 | +CommandPlugin.pluginName = '___default_command___'; | | 21 | +CommandPlugin.meta = { | 22 | 22 | commandScope: 'common', | 23 | 23 | }; | | 24 | + | | 25 | +export default CommandPlugin; |
|