chore: fix package/workspace build error

This commit is contained in:
liujuping 2022-12-26 21:37:15 +08:00 committed by 林熠
parent a1828b1bbc
commit 1342481942
12 changed files with 27 additions and 58 deletions

View File

@ -1,6 +1,6 @@
{
"lerna": "4.0.0",
"version": "1.0.18",
"version": "1.1.0",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [

View File

@ -34,7 +34,6 @@ module.exports = ({ context, onGetWebpackConfig }) => {
.use('babel-loader')
.tap((options) => {
const { plugins = [] } = options;
console.log('plugins', plugins);
return {
...options,
plugins: [

View File

@ -27,6 +27,7 @@
"@alilc/lowcode-plugin-outline-pane": "1.0.18",
"@alilc/lowcode-shell": "1.0.18",
"@alilc/lowcode-utils": "1.0.18",
"@alilc/lowcode-workspace": "1.0.18",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -61,7 +61,16 @@ export * from './modules/lowcode-types';
registerDefaults();
const innerWorkspace = new InnerWorkspace();
async function registryInnerPlugin(designer: Designer, editor: Editor, plugins: Plugins) {
// 注册一批内置插件
await plugins.register(OutlinePlugin, {}, { autoInit: true });
await plugins.register(componentMetaParser(designer));
await plugins.register(setterRegistry, {}, { autoInit: true });
await plugins.register(defaultPanelRegistry(editor, designer));
await plugins.register(builtinHotkey);
}
const innerWorkspace = new InnerWorkspace(registryInnerPlugin, shellModelFactory);
const workspace = new Workspace(innerWorkspace);
const editor = new Editor();
globalContext.register(editor, Editor);
@ -170,12 +179,7 @@ export async function init(
}
engineConfig.setEngineOptions(engineOptions as any);
// 注册一批内置插件
await plugins.register(OutlinePlugin, {}, { autoInit: true });
await plugins.register(componentMetaParser(designer));
await plugins.register(setterRegistry, {}, { autoInit: true });
await plugins.register(defaultPanelRegistry(editor, designer));
await plugins.register(builtinHotkey);
await registryInnerPlugin(designer, editor, plugins);
await plugins.init(pluginPreference as any);

View File

@ -1,16 +1,3 @@
jest.mock('zen-logger', () => {
class Logger {
log() {}
error() {}
warn() {}
debug() {}
}
return {
__esModule: true,
default: Logger,
};
});
jest.mock('lodash', () => {
const original = jest.requireActual('lodash');

View File

@ -20,6 +20,7 @@
"@alilc/lowcode-editor-skeleton": "1.0.18",
"@alilc/lowcode-types": "1.0.18",
"@alilc/lowcode-utils": "1.0.18",
"@alilc/lowcode-workspace": "1.0.18",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",

View File

@ -3,7 +3,6 @@
"version": "1.0.18",
"description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js",
"private": true,
"module": "es/index.js",
"files": [
"lib",

View File

@ -16,7 +16,6 @@ import {
import {
Skeleton as InnerSkeleton,
} from '@alilc/lowcode-editor-skeleton';
import {
Hotkey,
Plugins,
@ -34,14 +33,8 @@ import {
IPublicTypePluginMeta,
} from '@alilc/lowcode-types';
import { getLogger } from '@alilc/lowcode-utils';
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
import { setterRegistry } from '../../engine/src/inner-plugins/setter-registry';
import { componentMetaParser } from '../../engine/src/inner-plugins/component-meta-parser';
import defaultPanelRegistry from '../../engine/src/inner-plugins/default-panel-registry';
import { builtinHotkey } from '../../engine/src/inner-plugins/builtin-hotkey';
import { Workspace as InnerWorkspace } from './index';
import { EditorWindow } from './editor-window/context';
import { shellModelFactory } from './shell-model-factory';
export class BasicContext {
skeleton: Skeleton;
plugins: Plugins;
@ -62,7 +55,7 @@ export class BasicContext {
innerPlugins: LowCodePluginManager;
canvas: Canvas;
constructor(innerWorkspace: any, viewName: string, public editorWindow?: EditorWindow) {
constructor(innerWorkspace: InnerWorkspace, viewName: string, public editorWindow?: EditorWindow) {
const editor = new Editor(viewName, true);
const innerSkeleton = new InnerSkeleton(editor, viewName);
@ -71,7 +64,7 @@ export class BasicContext {
const designer: Designer = new Designer({
editor,
viewName,
shellModelFactory,
shellModelFactory: innerWorkspace.shellModelFactory,
});
editor.set('designer' as any, designer);
@ -138,11 +131,7 @@ export class BasicContext {
// 注册一批内置插件
this.registerInnerPlugins = async function registerPlugins() {
await plugins.register(OutlinePlugin, {}, { autoInit: true });
await plugins.register(componentMetaParser(designer));
await plugins.register(setterRegistry, {}, { autoInit: true });
await plugins.register(defaultPanelRegistry(editor, designer));
await plugins.register(builtinHotkey);
await innerWorkspace.registryInnerPlugin(designer, editor, plugins);
};
}
}

View File

@ -1,7 +1,9 @@
import { Designer } from '@alilc/lowcode-designer';
import { Editor } from '@alilc/lowcode-editor-core';
import {
Skeleton as InnerSkeleton,
} from '@alilc/lowcode-editor-skeleton';
import { Plugins } from '@alilc/lowcode-shell';
import { IPublicResourceOptions } from '@alilc/lowcode-types';
import { EditorWindow } from './editor-window/context';
import { Resource } from './resource';
@ -14,7 +16,10 @@ export class Workspace {
readonly editor = new Editor();
readonly skeleton = new InnerSkeleton(this.editor);
constructor() {
constructor(
readonly registryInnerPlugin: (designer: Designer, editor: Editor, plugins: Plugins) => Promise<void>,
readonly shellModelFactory: any,
) {
if (this.defaultResource) {
this.window = new EditorWindow(this.defaultResource, this);
}

View File

@ -1,18 +0,0 @@
import {
Node as InnerNode,
SettingField as InnerSettingField,
} from '@alilc/lowcode-designer';
import { IShellModelFactory, IPublicModelNode, IPublicModelSettingPropEntry } from '@alilc/lowcode-types';
import {
Node,
SettingPropEntry,
} from '@alilc/lowcode-shell';
class ShellModelFactory implements IShellModelFactory {
createNode(node: InnerNode | null | undefined): IPublicModelNode | null {
return Node.create(node);
}
createSettingPropEntry(prop: InnerSettingField): IPublicModelSettingPropEntry {
return SettingPropEntry.create(prop);
}
}
export const shellModelFactory = new ShellModelFactory();

View File

@ -14,6 +14,7 @@ lerna run build \
--scope @alilc/lowcode-react-renderer \
--scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-renderer-core \
--scope @alilc/lowcode-workspace \
--scope @alilc/lowcode-engine \
--stream

View File

@ -14,4 +14,5 @@ tnpm sync @alilc/lowcode-rax-renderer
tnpm sync @alilc/lowcode-rax-simulator-renderer
tnpm sync @alilc/lowcode-react-renderer
tnpm sync @alilc/lowcode-react-simulator-renderer
tnpm sync @alilc/lowcode-engine
tnpm sync @alilc/lowcode-engine
tnpm sync @alilc/lowcode-workspace