mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-10 18:03:01 +00:00
chore: add new cdn support
This commit is contained in:
parent
3fe9882f9d
commit
b3938b69a1
@ -27,8 +27,8 @@ $ yarn build
|
||||
1. npm run build
|
||||
2. npm publish # 记得改下版本号,比如 1.0.1
|
||||
|
||||
# 发布完后执行 tnpm sync
|
||||
3. tnpm sync
|
||||
# 发布完后执行 tnpm syncOss 同步到 uipaas CDN
|
||||
3. tnpm syncOss
|
||||
|
||||
4. 更新 diamond 版本 1.0.1
|
||||
5. lowcode-engine.cn 站点生效
|
||||
@ -37,10 +37,9 @@ $ yarn build
|
||||
|
||||
## 功能
|
||||
- [x] 支持本地离线搜搜
|
||||
- [x] 版本化文档管理
|
||||
- [x] 版本化文档管理
|
||||
- [x] 离线静态部署
|
||||
- [x] 主题(fork 宜搭开发者中心)
|
||||
|
||||
## 使用文档
|
||||
https://docusaurus.io/zh-CN/docs/docs-introduction
|
||||
|
||||
|
||||
@ -80,7 +80,9 @@ sidebar_position: 0
|
||||
<!-- 低代码引擎官方扩展的主包 -->
|
||||
<script crossorigin="anonymous" src="https://alifd.alicdn.com/npm/@alilc/lowcode-engine-ext@latest/dist/js/engine-ext.js"></script>
|
||||
```
|
||||
> 注:如果 unpkg 的服务比较缓慢,您可以使用 alicdn 来获得确定版本的低代码引擎,如对于引擎的 1.0.1 版本,可用 [https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.1/dist/js/engine-core.js](https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.1/dist/js/engine-core.js)
|
||||
> 注:如果 unpkg 的服务比较缓慢,您可以使用 alicdn 来获得确定版本的低代码引擎,如对于引擎的 1.0.18 版本,可用以下官方 cdn 替代
|
||||
> - [https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js](https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js)
|
||||
> - [https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js](https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js)
|
||||
|
||||
|
||||
### 配置打包
|
||||
|
||||
@ -70,9 +70,10 @@ sidebar_position: 2
|
||||
```bash
|
||||
npm run pub
|
||||
```
|
||||
5. 同步到 tnpm 源 & alifd CDN(此步骤将发布在 npm 源的包同步到阿里内网源,因为 alifd cdn 将依赖内网 npm 源)
|
||||
5. 同步到 tnpm 源 & alifd CDN & uipaas CDN(此步骤将发布在 npm 源的包同步到阿里内网源,因为 alifd cdn 将依赖内网 npm 源)
|
||||
```bash
|
||||
tnpm run sync
|
||||
tnpm run syncOss
|
||||
```
|
||||
6. 更新[发布日志](https://github.com/alibaba/lowcode-engine/releases)
|
||||
7. 合并 release/x.x.x 到 main 分支
|
||||
@ -102,9 +103,10 @@ sidebar_position: 2
|
||||
```bash
|
||||
npm run pub:preminor
|
||||
```
|
||||
5. 同步到 tnpm 源 & alifd CDN
|
||||
5. 同步到 tnpm 源 & alifd CDN & uipaas CDN
|
||||
```bash
|
||||
tnpm run sync
|
||||
tnpm run syncOss
|
||||
```
|
||||
|
||||
#### 发某 z 位版本首个 beta,如 1.0.1-beta.0
|
||||
@ -129,9 +131,10 @@ sidebar_position: 2
|
||||
```bash
|
||||
npm run pub:prepatch
|
||||
```
|
||||
5. 同步到 tnpm 源 & alifd CDN
|
||||
5. 同步到 tnpm 源 & alifd CDN & uipaas CDN
|
||||
```bash
|
||||
tnpm run sync
|
||||
tnpm run syncOss
|
||||
```
|
||||
|
||||
#### 发某版本非首个 beta,如 1.0.1-beta.0 -> 1.0.1-beta.1
|
||||
@ -151,9 +154,10 @@ sidebar_position: 2
|
||||
```bash
|
||||
npm run pub:prerelease
|
||||
```
|
||||
5. 同步到 tnpm 源 & alifd CDN
|
||||
5. 同步到 tnpm 源 & alifd CDN & uipaas CDN
|
||||
```bash
|
||||
tnpm run sync
|
||||
tnpm run syncOss
|
||||
```
|
||||
|
||||
|
||||
@ -173,9 +177,10 @@ sidebar_position: 2
|
||||
```bash
|
||||
npm publish --tag beta
|
||||
```
|
||||
4. 同步到 tnpm 源 & alifd CDN
|
||||
4. 同步到 tnpm 源 & alifd CDN & uipaas CDN
|
||||
```bash
|
||||
tnpm run sync
|
||||
tnpm run syncOss
|
||||
```
|
||||
|
||||
**官网生效**
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
"typecheck": "tsc",
|
||||
"syncOss": "node ./scripts/sync-oss.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^2.2.0",
|
||||
|
||||
48
docs/scripts/sync-oss.js
Normal file
48
docs/scripts/sync-oss.js
Normal file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
const http = require('http');
|
||||
const package = require('../package.json');
|
||||
const { version, name } = package;
|
||||
const options = {
|
||||
method: 'PUT',
|
||||
// 暂时使用 日常环境的 uipaas-node,上线后可切换成线上环境 https://uipaas-node.alibaba-inc.com
|
||||
hostname: 'uipaas-node.alibaba.net',
|
||||
path: '/staticAssets/cdn/packages',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: 'locale=en-us',
|
||||
},
|
||||
maxRedirects: 20,
|
||||
};
|
||||
|
||||
const onResponse = function (res) {
|
||||
const chunks = [];
|
||||
res.on('data', (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
res.on('end', (chunk) => {
|
||||
const body = Buffer.concat(chunks);
|
||||
console.table(JSON.stringify(JSON.parse(body.toString()), null, 2));
|
||||
});
|
||||
|
||||
res.on('error', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
|
||||
const req = http.request(options, onResponse);
|
||||
|
||||
const postData = JSON.stringify({
|
||||
packages: [
|
||||
{
|
||||
packageName: name,
|
||||
version,
|
||||
},
|
||||
],
|
||||
// 可以发布指定源的 npm 包,默认公网 npm
|
||||
useTnpm: false,
|
||||
});
|
||||
|
||||
req.write(postData);
|
||||
|
||||
req.end();
|
||||
@ -32,7 +32,8 @@
|
||||
"test": "lerna run test --stream",
|
||||
"test:snapshot": "lerna run test:snapshot",
|
||||
"watchdog:build": "node ./scripts/watchdog.js",
|
||||
"sync": "./scripts/sync.sh"
|
||||
"sync": "./scripts/sync.sh",
|
||||
"syncOss": "node ./scripts/sync-oss.js"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@ -97,26 +97,33 @@ init(document.getElementById('lce'));
|
||||
### cdn 可选方式:
|
||||
#### 方式 1(推荐):alifd cdn
|
||||
```html
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### 方式 2:unpkg
|
||||
#### 方式 2(推荐):uipaas cdn
|
||||
```html
|
||||
https://unpkg.com/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://uipaas-assets.com/prod/npm/@alilc/lowcode-react-simulator-renderer/1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### 方式 3:jsdelivr
|
||||
#### 方式 3:unpkg
|
||||
```html
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://unpkg.com/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### 方式 4:使用自有 cdn
|
||||
#### 方式 4:jsdelivr
|
||||
```html
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### 方式 5:使用自有 cdn
|
||||
将源码中 packages/engine/dist 和 packages/(react|rax)-simulator-renderer/dist 下的文件传至你的 cdn 提供商
|
||||
|
||||
## 🔗 相关链接
|
||||
|
||||
@ -97,26 +97,33 @@ init(document.getElementById('lce'));
|
||||
### cdn optional method:
|
||||
#### Method 1: alifd cdn
|
||||
```html
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### Method 2: unpkg
|
||||
#### Method 2: uipaas cdn
|
||||
```html
|
||||
https://unpkg.com/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://uipaas-assets.com/prod/npm/@alilc/lowcode-react-simulator-renderer/1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### Method 3: jsdelivr
|
||||
#### Method 3: unpkg
|
||||
```html
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
|
||||
https://unpkg.com/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
|
||||
https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### Method 4: Use your own cdn
|
||||
#### Method 4: jsdelivr
|
||||
```html
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js
|
||||
|
||||
https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js
|
||||
```
|
||||
|
||||
#### Method 5: Use your own cdn
|
||||
Pass the files under packages/engine/dist and packages/(react|rax)-simulator-renderer/dist in the source code to your cdn provider
|
||||
|
||||
## 🔗 Related Links
|
||||
|
||||
48
scripts/sync-oss.js
Normal file
48
scripts/sync-oss.js
Normal file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
const http = require('http');
|
||||
const package = require('../packages/engine/package.json');
|
||||
const { version, name } = package;
|
||||
const options = {
|
||||
method: 'PUT',
|
||||
// 暂时使用 日常环境的 uipaas-node,上线后可切换成线上环境 https://uipaas-node.alibaba-inc.com
|
||||
hostname: 'uipaas-node.alibaba.net',
|
||||
path: '/staticAssets/cdn/packages',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: 'locale=en-us',
|
||||
},
|
||||
maxRedirects: 20,
|
||||
};
|
||||
|
||||
const onResponse = function (res) {
|
||||
const chunks = [];
|
||||
res.on('data', (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
res.on('end', (chunk) => {
|
||||
const body = Buffer.concat(chunks);
|
||||
console.table(JSON.stringify(JSON.parse(body.toString()), null, 2));
|
||||
});
|
||||
|
||||
res.on('error', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
|
||||
const req = http.request(options, onResponse);
|
||||
|
||||
const postData = JSON.stringify({
|
||||
packages: [
|
||||
{
|
||||
packageName: name,
|
||||
version,
|
||||
},
|
||||
],
|
||||
// 可以发布指定源的 npm 包,默认公网 npm
|
||||
useTnpm: false,
|
||||
});
|
||||
|
||||
req.write(postData);
|
||||
|
||||
req.end();
|
||||
Loading…
x
Reference in New Issue
Block a user