mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
chore: 调整修改 version 脚本
refactor: 调整 engine 内部结构, 兼顾考虑 ignitor 调试启动 / 云编译 / npm 场景
This commit is contained in:
parent
67271bc2c5
commit
216d8202e9
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@ali/lowcode-editor-preset-vision",
|
||||
"version": "1.0.30-beta.9",
|
||||
"description": "Vision Polyfill for Ali lowCode engine",
|
||||
"description": "Preset Vision for AliLowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"private": true,
|
||||
"files": [
|
||||
|
||||
@ -4,7 +4,7 @@ const { execSync } = require('child_process');
|
||||
const { join } = require('path');
|
||||
const fse = require('fs-extra');
|
||||
|
||||
const gitBranchName = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' });
|
||||
const gitBranchName = process.env.BUILD_GIT_BRANCH || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' });
|
||||
const reBranchVersion = /^(?:[a-z]+\/)(\d+\.\d+\.\d+)$/im;
|
||||
|
||||
const match = reBranchVersion.exec(gitBranchName);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name": "@ali/lowcode-engine",
|
||||
"version": "1.0.30-beta.9",
|
||||
"description": "Universal API for AliLowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"main": "lib/engine.js",
|
||||
"module": "es/engine.js",
|
||||
"private": true,
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@ -4,7 +4,7 @@ const { execSync } = require('child_process');
|
||||
const { join } = require('path');
|
||||
const fse = require('fs-extra');
|
||||
|
||||
const gitBranchName = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' });
|
||||
const gitBranchName = process.env.BUILD_GIT_BRANCH || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' });
|
||||
const reBranchVersion = /^(?:[a-z]+\/)(\d+\.\d+\.\d+)$/im;
|
||||
|
||||
const match = reBranchVersion.exec(gitBranchName);
|
||||
|
||||
135
packages/engine/src/engine.ts
Normal file
135
packages/engine/src/engine.ts
Normal file
@ -0,0 +1,135 @@
|
||||
import { createElement } from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { Designer, LiveEditing, TransformStage, Node, getConvertedExtraKey, LowCodePluginManager } from '@ali/lowcode-designer';
|
||||
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
|
||||
import * as editorHelper from '@ali/lowcode-editor-core';
|
||||
import * as designerHelper from '@ali/lowcode-designer';
|
||||
import * as skeletonHelper from '@ali/lowcode-editor-skeleton';
|
||||
import DesignerPlugin from '@ali/lowcode-plugin-designer';
|
||||
import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-editor-skeleton';
|
||||
|
||||
const editor = new Editor();
|
||||
globalContext.register(editor, Editor);
|
||||
|
||||
const skeleton = new Skeleton(editor);
|
||||
editor.set(Skeleton, skeleton);
|
||||
editor.set('skeleton', skeleton);
|
||||
registerDefaults();
|
||||
|
||||
const designer = new Designer({ editor });
|
||||
editor.set(Designer, designer);
|
||||
editor.set('designer', designer);
|
||||
|
||||
const plugins = (new LowCodePluginManager(editor)).toProxy();
|
||||
editor.set('plugins', plugins);
|
||||
|
||||
skeleton.add({
|
||||
area: 'mainArea',
|
||||
name: 'designer',
|
||||
type: 'Widget',
|
||||
content: DesignerPlugin,
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'rightArea',
|
||||
name: 'settingsPane',
|
||||
type: 'Panel',
|
||||
content: SettingsPrimaryPane,
|
||||
props: {
|
||||
ignoreRoot: true,
|
||||
},
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'leftArea',
|
||||
name: 'outlinePane',
|
||||
type: 'PanelDock',
|
||||
content: Outline,
|
||||
panelProps: {
|
||||
area: 'leftFixedArea',
|
||||
},
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'rightArea',
|
||||
name: 'backupOutline',
|
||||
type: 'Panel',
|
||||
props: {
|
||||
condition: () => {
|
||||
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
||||
},
|
||||
},
|
||||
content: OutlineBackupPane,
|
||||
});
|
||||
|
||||
const { project, currentSelection: selection } = designer;
|
||||
const { hotkey, monitor, getSetter, registerSetter } = editorHelper;
|
||||
const { Workbench } = skeletonHelper;
|
||||
const setters = {
|
||||
getSetter,
|
||||
registerSetter,
|
||||
};
|
||||
|
||||
export {
|
||||
editor,
|
||||
editorHelper,
|
||||
skeleton,
|
||||
skeletonHelper,
|
||||
designer,
|
||||
designerHelper,
|
||||
plugins,
|
||||
setters,
|
||||
project,
|
||||
selection,
|
||||
/**
|
||||
* 注册一些全局的切面
|
||||
*/
|
||||
// hooks,
|
||||
/**
|
||||
* 全局的一些数据存储
|
||||
*/
|
||||
// store,
|
||||
hotkey,
|
||||
monitor,
|
||||
};
|
||||
|
||||
// TODO: build-plugin-component 的 umd 开发态没有导出 AliLowCodeEngine,这里先简单绕过
|
||||
(window as any).AliLowCodeEngine = {
|
||||
editor,
|
||||
editorHelper,
|
||||
skeleton,
|
||||
skeletonHelper,
|
||||
designer,
|
||||
designerHelper,
|
||||
plugins,
|
||||
setters,
|
||||
project,
|
||||
selection,
|
||||
/**
|
||||
* 注册一些全局的切面
|
||||
*/
|
||||
// hooks,
|
||||
/**
|
||||
* 全局的一些数据存储
|
||||
*/
|
||||
// store,
|
||||
hotkey,
|
||||
monitor,
|
||||
};
|
||||
|
||||
export async function init(container?: Element) {
|
||||
let engineContainer = container;
|
||||
if (!engineContainer) {
|
||||
engineContainer = document.createElement('div');
|
||||
document.body.appendChild(engineContainer);
|
||||
}
|
||||
engineContainer.id = 'engine';
|
||||
|
||||
await plugins.init();
|
||||
render(
|
||||
createElement(Workbench, {
|
||||
skeleton,
|
||||
className: 'engine-main',
|
||||
topAreaItemClassName: 'engine-actionitem',
|
||||
}),
|
||||
engineContainer,
|
||||
);
|
||||
}
|
||||
@ -1,135 +1,10 @@
|
||||
import { createElement } from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { Designer, LiveEditing, TransformStage, Node, getConvertedExtraKey, LowCodePluginManager } from '@ali/lowcode-designer';
|
||||
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
|
||||
import * as editorHelper from '@ali/lowcode-editor-core';
|
||||
import * as designerHelper from '@ali/lowcode-designer';
|
||||
import * as skeletonHelper from '@ali/lowcode-editor-skeleton';
|
||||
import DesignerPlugin from '@ali/lowcode-plugin-designer';
|
||||
import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-editor-skeleton';
|
||||
import './engine';
|
||||
|
||||
const editor = new Editor();
|
||||
globalContext.register(editor, Editor);
|
||||
const version = '{{VERSION_PLACEHOLDER}}';
|
||||
|
||||
const skeleton = new Skeleton(editor);
|
||||
editor.set(Skeleton, skeleton);
|
||||
editor.set('skeleton', skeleton);
|
||||
registerDefaults();
|
||||
console.log(
|
||||
`%c AliLowCodeEngine %c v${version} `,
|
||||
'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;',
|
||||
'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
|
||||
);
|
||||
|
||||
const designer = new Designer({ editor });
|
||||
editor.set(Designer, designer);
|
||||
editor.set('designer', designer);
|
||||
|
||||
const plugins = (new LowCodePluginManager(editor)).toProxy();
|
||||
editor.set('plugins', plugins);
|
||||
|
||||
skeleton.add({
|
||||
area: 'mainArea',
|
||||
name: 'designer',
|
||||
type: 'Widget',
|
||||
content: DesignerPlugin,
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'rightArea',
|
||||
name: 'settingsPane',
|
||||
type: 'Panel',
|
||||
content: SettingsPrimaryPane,
|
||||
props: {
|
||||
ignoreRoot: true,
|
||||
},
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'leftArea',
|
||||
name: 'outlinePane',
|
||||
type: 'PanelDock',
|
||||
content: Outline,
|
||||
panelProps: {
|
||||
area: 'leftFixedArea',
|
||||
},
|
||||
});
|
||||
skeleton.add({
|
||||
area: 'rightArea',
|
||||
name: 'backupOutline',
|
||||
type: 'Panel',
|
||||
props: {
|
||||
condition: () => {
|
||||
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
||||
},
|
||||
},
|
||||
content: OutlineBackupPane,
|
||||
});
|
||||
|
||||
const { project, currentSelection: selection } = designer;
|
||||
const { hotkey, monitor, getSetter, registerSetter } = editorHelper;
|
||||
const { Workbench } = skeletonHelper;
|
||||
const setters = {
|
||||
getSetter,
|
||||
registerSetter,
|
||||
};
|
||||
|
||||
export {
|
||||
editor,
|
||||
editorHelper,
|
||||
skeleton,
|
||||
skeletonHelper,
|
||||
designer,
|
||||
designerHelper,
|
||||
plugins,
|
||||
setters,
|
||||
project,
|
||||
selection,
|
||||
/**
|
||||
* 注册一些全局的切面
|
||||
*/
|
||||
// hooks,
|
||||
/**
|
||||
* 全局的一些数据存储
|
||||
*/
|
||||
// store,
|
||||
hotkey,
|
||||
monitor,
|
||||
};
|
||||
|
||||
// TODO: build-plugin-component 的 umd 开发态没有导出 AliLowCodeEngine,这里先简单绕过
|
||||
(window as any).AliLowCodeEngine = {
|
||||
editor,
|
||||
editorHelper,
|
||||
skeleton,
|
||||
skeletonHelper,
|
||||
designer,
|
||||
designerHelper,
|
||||
plugins,
|
||||
setters,
|
||||
project,
|
||||
selection,
|
||||
/**
|
||||
* 注册一些全局的切面
|
||||
*/
|
||||
// hooks,
|
||||
/**
|
||||
* 全局的一些数据存储
|
||||
*/
|
||||
// store,
|
||||
hotkey,
|
||||
monitor,
|
||||
};
|
||||
|
||||
export async function init(container?: Element) {
|
||||
let engineContainer = container;
|
||||
if (!engineContainer) {
|
||||
engineContainer = document.createElement('div');
|
||||
document.body.appendChild(engineContainer);
|
||||
}
|
||||
engineContainer.id = 'engine';
|
||||
|
||||
await plugins.init();
|
||||
render(
|
||||
createElement(Workbench, {
|
||||
skeleton,
|
||||
className: 'engine-main',
|
||||
topAreaItemClassName: 'engine-actionitem',
|
||||
}),
|
||||
engineContainer,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
import './index';
|
||||
|
||||
const version = '{{VERSION_PLACEHOLDER}}';
|
||||
|
||||
console.log(
|
||||
`%c AliLowCodeEngine %c v${version} `,
|
||||
'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;',
|
||||
'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
|
||||
);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"entry": {
|
||||
"editor-preset-vision": "../editor-preset-vision/src/index.ts",
|
||||
"engine": "../engine/src/port.ts",
|
||||
"engine": "../engine/src/index.ts",
|
||||
"vision-polyfill": "../vision-polyfill/src/index.ts",
|
||||
"react-simulator-renderer": "../react-simulator-renderer/src/index.ts",
|
||||
"rax-simulator-renderer": "../rax-simulator-renderer/src/index.ts"
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"scripts": {
|
||||
"start": "build-scripts start",
|
||||
"version:update": "node ./scripts/version.js",
|
||||
"build": "tnpm run version:update && build-scripts build --skip-demo",
|
||||
"build": "build-scripts build --skip-demo",
|
||||
"cloud-build": "build-scripts build --skip-demo",
|
||||
"test": "build-scripts test --config build.test.json"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user