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", "lerna": "4.0.0",
"version": "1.0.18", "version": "1.1.0",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"packages": [ "packages": [

View File

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

View File

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

View File

@ -61,7 +61,16 @@ export * from './modules/lowcode-types';
registerDefaults(); 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 workspace = new Workspace(innerWorkspace);
const editor = new Editor(); const editor = new Editor();
globalContext.register(editor, Editor); globalContext.register(editor, Editor);
@ -170,12 +179,7 @@ export async function init(
} }
engineConfig.setEngineOptions(engineOptions as any); engineConfig.setEngineOptions(engineOptions as any);
// 注册一批内置插件 await registryInnerPlugin(designer, editor, 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);
await plugins.init(pluginPreference as any); 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', () => { jest.mock('lodash', () => {
const original = jest.requireActual('lodash'); const original = jest.requireActual('lodash');

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
import { Designer } from '@alilc/lowcode-designer';
import { Editor } from '@alilc/lowcode-editor-core'; import { Editor } from '@alilc/lowcode-editor-core';
import { import {
Skeleton as InnerSkeleton, Skeleton as InnerSkeleton,
} from '@alilc/lowcode-editor-skeleton'; } from '@alilc/lowcode-editor-skeleton';
import { Plugins } from '@alilc/lowcode-shell';
import { IPublicResourceOptions } from '@alilc/lowcode-types'; import { IPublicResourceOptions } from '@alilc/lowcode-types';
import { EditorWindow } from './editor-window/context'; import { EditorWindow } from './editor-window/context';
import { Resource } from './resource'; import { Resource } from './resource';
@ -14,7 +16,10 @@ export class Workspace {
readonly editor = new Editor(); readonly editor = new Editor();
readonly skeleton = new InnerSkeleton(this.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) { if (this.defaultResource) {
this.window = new EditorWindow(this.defaultResource, this); 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-renderer \
--scope @alilc/lowcode-react-simulator-renderer \ --scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-renderer-core \ --scope @alilc/lowcode-renderer-core \
--scope @alilc/lowcode-workspace \
--scope @alilc/lowcode-engine \ --scope @alilc/lowcode-engine \
--stream --stream

View File

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