Merge pull request #40 from alibaba/feat/umd-ify-react-renderer-2

Feat/umd ify react renderer 2
This commit is contained in:
LeoYuan 袁力皓 2022-03-01 18:59:25 +08:00 committed by GitHub
commit f8cfdbb2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 2827 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,8 @@
"f2elint": "^2.0.1",
"husky": "^7.0.4",
"lerna": "^4.0.0",
"typescript": "^4.5.5"
"typescript": "^4.5.5",
"yarn": "^1.22.17"
},
"engines": {
"node": ">=14.17.0 <16"

View File

@ -5,83 +5,16 @@
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>LowCodeEngine Editor DEMO</title>
<link rel="shortcut icon" href="./favicon.png" />
<link rel="stylesheet" data-name="vs/editor/editor.main" href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.0/min/vs/editor/editor.main.css"/>
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script>
React.PropTypes = PropTypes;
</script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js,immutable/3.7.6/dist/immutable.min.js,natty-storage/2.0.2/dist/natty-storage.min.js,natty-fetch/2.6.0/dist/natty-fetch.pc.min.js,tinymce/4.2.5/tinymce-full.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<link rel="stylesheet" href="https://unpkg.alibaba-inc.com/@alifd/next@1.20.25/dist/next.min.css" />
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.20.25/dist/next.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/rax@1.1.3/dist/rax.js"></script>
<!-- <script src="http://192.168.0.106:8000/lc-engine.js"></script> -->
<script>
var require = { paths: { vs: 'https://g.alicdn.com/code/lib/monaco-editor/0.21.2/min/vs' } };
</script>
<script src="https://g.alicdn.com/code/lib/monaco-editor/0.21.2/min/vs/loader.min.js"></script>
<script src="https://g.alicdn.com/code/lib/monaco-editor/0.21.2/min/vs/editor/editor.main.nls.js"></script>
<script src="https://g.alicdn.com/code/lib/monaco-editor/0.21.2/min/vs/editor/editor.main.js"></script>
<link rel="stylesheet" href="/css/editor-preset-vision.css" />
<script>
window.pageConfig = {
env: 'release',
locale: 'zh_CN',
pageType: 'single',
deviceType: 'web',
appName: '基础包管理后台',
appType: 'legao_base_packages',
templateType: '',
pageId: 'FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V',
slug: 'test',
appMode: 'back',
isAppAdmin: 'y',
isSuperAdmin: 'n',
isBetaDeveloper: 'n',
formType: 'display',
title: { en_US: '测试', type: 'i18n', zh_CN: '测试' },
urlPrefix: 'https://go.alibaba-inc.com',
APIUrlPrefix: 'https://go.alibaba-inc.com',
devVersion: '0.1.0', // 这个是子应用的变更 id
subAppType: '0.1.0',
appKey: 'legao_base_packages',
RE_VERSION: '7.1.1',
appSource: '',
isDomainDefault: 'n',
useReleaseBundle: 'n',
isDomainPkg: 'n',
medusaAppName: '',
domainCode: 'kS6SyH',
aecp: {
mdcDomain: '',
projectId: '',
appCode: '',
},
designerConfigs: {},
navConfig:
'{"appName":{"en_US":"基础包管理后台","key":"","type":"i18n","zh_CN":"基础包管理后台"},"bgColor":"white","data":[{"children":[],"hidden":false,"icon":"","inner":true,"navUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","relateUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","slug":"test","targetNew":false,"title":{"en_US":"测试","type":"i18n","zh_CN":"测试"}}],"isFixed":"y","isFold":"y","isFoldHorizontal":"n","languageChangeUrl":{"en_US":"/common/account/changeAccountLanguage.json","type":"i18n","zh_CN":"/common/account/changeAccountLanguage.json"},"layout":"auto","navStyle":"orange","navTheme":"light","openSubMode":false,"showAppTitle":true,"showCrumb":true,"showIcon":false,"showLanguageChange":true,"showNav":true,"showSearch":"n","singletons":{"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V":{"isFixed":"n","isFold":"n","isFoldHorizontal":"n","showAppTitle":false,"showCrumb":false,"showLanguageChange":false,"showNav":false,"showSearch":"n","singleton":false},"test":{"$ref":"$.singletons.FORM\\-3KYJN7RV\\-DIOD8LLK1WGQ89S7NHA92\\-QJVH497K\\-V"}},"type":"top_fold"}',
historyType: 'HASH',
isSinglePage: 'n',
rhino: 'n',
isMiniApp: '',
taskId: '',
appSchema: 'V5',
openSubMode: 'n',
};
window.g_config = {};
</script>
</head>
<body>
<!-- lowcode engine globals -->
<div id="lce-container"></div>
<!-- vision 测试使用
-->
<script src="/js/editor-preset-vision.js"></script>
<script src="https://dev.g.alicdn.com/vision/visualengine-utils/5.0.0/engine-utils.js"></script>
<h1>
This project only provides engine resource files. For usage, go for
<a href="https://github.com/alibaba/lowcode-demo" target="_blank">Lowcode Demo</a>
</h1>
<h2>
For local debugging of lowcode engine, please visit
<a href="https://www.yuque.com/lce/doc/glz0fx#wi8rs" target="_blank">proxy documentation</a>
to get more information.
</h2>
</body>
</html>

View File

@ -0,0 +1,28 @@
{
"entry": {
"react-renderer": "src/index"
},
"sourceMap": true,
"library": "AliLowCodeReactRenderer",
"libraryTarget": "umd",
"externals": {
"react": "var window.React",
"react-dom": "var window.ReactDOM",
"prop-types": "var window.PropTypes",
"@alifd/next": "var Next",
"moment": "var window.moment"
},
"polyfill": false,
"outputDir": "dist",
"vendor": false,
"ignoreHtmlTemplate": true,
"plugins": [
"build-plugin-react-app",
["build-plugin-fusion", {
"externalNext": "umd"
}],
["build-plugin-moment-locales", {
"locales": ["zh-cn"]
}]
]
}

View File

@ -6,12 +6,14 @@
"module": "es/index.js",
"files": [
"lib",
"es"
"es",
"dist"
],
"scripts": {
"test": "build-scripts test --config build.test.json",
"start": "build-scripts start",
"build": "build-scripts build --skip-demo"
"build": "build-scripts build --skip-demo",
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json"
},
"keywords": [
"lowcode",

View File

@ -1,71 +0,0 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const process = require('process');
const { execSync } = require('child_process');
// eslint-disable-next-line prefer-const
let [owner, pkg] = process.argv.slice(2);
const packages_dir = path.join(__dirname, '..', 'packages');
function getPackageNames() {
const ls = fs.readdirSync(packages_dir, 'utf-8');
const packageNames = [];
ls.forEach((item) => {
if (item.charAt(0) === '.') {
return;
}
const packageJsonFile = path.join(packages_dir, item, 'package.json');
if (fs.existsSync(packageJsonFile)) {
const json = require(packageJsonFile);
if (!json.private && json.name) {
packageNames.push(json.name);
}
}
});
return packageNames;
}
const owners_file = path.join(__dirname, './owners.json');
const owners = require(owners_file);
function addPackageOwners(packageName) {
owners.forEach(setOwner => addOwner(packageName, setOwner));
}
function addOwner(packageName, setOwner) {
console.info(`addowner "${setOwner}" for "${packageName}"`);
try {
execSync(`tnpm owner add ${setOwner} ${packageName}`, {
encoding: 'utf-8',
});
console.info('OK');
} catch (e) {
console.info(e);
}
}
if (pkg) {
const packageJsonFile = path.join(packages_dir, pkg, 'package.json');
if (fs.existsSync(packageJsonFile)) {
const json = require(packageJsonFile);
if (!json.private && json.name) {
pkg = json.name;
}
}
if (owner === '-') {
addPackageOwners(pkg);
} else {
addOwner(pkg, owner);
}
} else if (owner) {
getPackageNames().forEach(packageName => {
addOwner(packageName, owner);
});
} else {
const pkgs = getPackageNames();
pkgs.forEach(packageName => {
addPackageOwners(packageName);
});
}

View File

@ -21,4 +21,5 @@ lerna run build:umd \
--scope @alilc/lowcode-engine \
--scope @alilc/lowcode-rax-simulator-renderer \
--scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-react-renderer \
--stream

View File

@ -1,39 +0,0 @@
#!/usr/bin/env bash
WORK_DIR=$PWD
BUILD_DEST=$1
if [ ! -d "$BUILD_DEST" ]; then
mkdir -p "$BUILD_DEST"
fi
tnpm i -g n
# 使用官方源有较大概率会 block
export N_NODE_MIRROR=https://npm.taobao.org/mirrors/node
echo "Switch node version to 14"
n 14.17.0
echo "Node Version"
node -v
echo "Deploy ${WORK_DIR} -> ${BUILD_DEST} ..."
echo "Clean"
tnpm run clean
echo "Setup"
tnpm run setup
# set source
# yarn config set registry https://registry.npm.alibaba-inc.com
lerna run cloud-build --stream
mv ./packages/react-simulator-renderer/dist/js/* $BUILD_DEST
mv ./packages/react-simulator-renderer/dist/css/* $BUILD_DEST
mv ./packages/rax-simulator-renderer/dist/js/* $BUILD_DEST
mv ./packages/rax-simulator-renderer/dist/css/* $BUILD_DEST
mv ./packages/engine/dist/js/* $BUILD_DEST
mv ./packages/engine/dist/css/* $BUILD_DEST
echo "Complete"

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
tnpm i -g lerna @ali/tyarn
rm -rf node_modules package-lock.json yarn.lock
lerna clean -y
find ./packages -type f -name "package-lock.json" -exec rm -f {} \;

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
tnpm i -g lerna @ali/tyarn
rm -rf node_modules package-lock.json yarn.lock
lerna clean -y
find ./packages -type f -name "package-lock.json" -exec rm -f {} \;