Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: 优化生成引擎版本号的逻辑
  • Loading branch information
LeoYuan committed Feb 16, 2022
commit b9288e3321a21f37e3755ecc80caa2e7eab6cb2f
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,21 @@ init(document.getElementById('lce'));
```

### cdn 可选方式:
#### 方式 1:unpkg
#### 方式 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-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```

#### 方式 2:unpkg
```html
https://unpkg.com/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js

https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```

#### 方式 2:jsdelivr
#### 方式 3:jsdelivr
```html
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js

Expand Down Expand Up @@ -127,10 +134,12 @@ $ npm run setup
$ npm start
```

> 📢 npm 访问速度较慢,阿里员工可以使用 tnpm,其他同学建议使用 cnpm 或者指定镜像 registry。

lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 项目做调试,文件代理规则参考这里。

## 🤝 参与共建

请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/docs/react/contributing-cn).
请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/?docs#/doc?url=contributing).

> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
21 changes: 14 additions & 7 deletions packages/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

[npm-image]: https://img.shields.io/npm/v/@alilc/lowcode-engine.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@alilc/lowcode-engine
[github-action-image]: https://github.com/ant-design/ant-design/workflows/%E2%9C%85%20test/badge.svg
[github-action-url]: https://github.com/ant-design/ant-design/actions?query=workflow%3A%22%E2%9C%85+test%22

[download-image]: https://img.shields.io/npm/dm/@alilc/lowcode-engine.svg?style=flat-square
[download-url]: https://npmjs.org/package/@alilc/lowcode-engine
[help-wanted-image]: https://flat.badgen.net/github/label-issues/ant-design/ant-design/help%20wanted/open
[help-wanted-image]: https://flat.badgen.net/github/label-issues/alibaba/lowcode-engine/help%20wanted/open
[help-wanted-url]: https://github.com/alibaba/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
[discussions-image]: https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square
[discussions-url]: https://github.com/ant-design/ant-design/discussions
[discussions-url]: https://github.com/alibaba/lowcode-engine/discussions

[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
[issues-helper-url]: https://github.com/actions-cool/issues-helper
Expand Down Expand Up @@ -92,14 +90,21 @@ init(document.getElementById('lce'));
```

### cdn 可选方式:
#### 方式 1:unpkg
#### 方式 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-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```

#### 方式 2:unpkg
```html
https://unpkg.com/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js

https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```

#### 方式 2:jsdelivr
#### 方式 3:jsdelivr
```html
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js

Expand Down Expand Up @@ -129,10 +134,12 @@ $ npm run setup
$ npm start
```

> 📢 npm 访问速度较慢,阿里员工可以使用 tnpm,其他同学建议使用 cnpm 或者指定镜像 registry。

lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 项目做调试,文件代理规则参考这里。

## 🤝 参与共建

请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/docs/react/contributing-cn).
请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/?docs#/doc?url=contributing).

> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
11 changes: 10 additions & 1 deletion packages/engine/build.plugin.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const fse = require('fs-extra');
// read from lerna
const lernaConfig = JSON.parse(fse.readFileSync('../../lerna.json', 'utf8'));
const { version } = lernaConfig;

module.exports = ({ onGetWebpackConfig }) => {
module.exports = ({ context, onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.resolve
.plugin('tsconfigpaths')
.use(TsconfigPathsPlugin, [{
configFile: './tsconfig.json',
}]);
config
.plugin('define')
.use(context.webpack.DefinePlugin, [{
VERSION_PLACEHOLDER: JSON.stringify(version),
}]);
config.plugins.delete('hot');
config.devServer.hot(false);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start": "build-scripts start",
"version:update": "node ./scripts/version.js",
"build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --skip-demo",
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json && npm run version:update",
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json",
"test": "build-scripts test --config build.test.json --jest-passWithNoTests"
},
"license": "MIT",
Expand Down Expand Up @@ -41,7 +41,7 @@
"build-plugin-fusion": "0.1.17-beta.0",
"build-plugin-moment-locales": "^0.1.0",
"build-plugin-react-app": "^1.8.0",
"fs-extra": "^9.0.1",
"fs-extra": "^10.0.0",
"prop-types": "^15.7.2",
"tsconfig-paths-webpack-plugin": "^3.2.0"
},
Expand Down
7 changes: 3 additions & 4 deletions packages/engine/src/engine-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ export {
})();

let engineInited = false;
export const version = '{{VERSION_PLACEHOLDER}}';
const DEFAULT_VERSION = '1.0.0';
const runtimeVersion = version.indexOf('VERSION_PLACEHOLDER') > -1 ? DEFAULT_VERSION : version;
engineConfig.set('ENGINE_VERSION', runtimeVersion);
// @ts-ignore webpack Define variable
export const version = VERSION_PLACEHOLDER;
engineConfig.set('ENGINE_VERSION', version);
export async function init(
container?: HTMLElement,
options?: EngineOptions,
Expand Down
9 changes: 9 additions & 0 deletions packages/ignitor/build.plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const fse = require('fs-extra');
// read from lerna
const lernaConfig = JSON.parse(fse.readFileSync('../../lerna.json', 'utf8'));
const { version } = lernaConfig;

module.exports = ({ context, onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
Expand All @@ -7,6 +11,11 @@ module.exports = ({ context, onGetWebpackConfig }) => {
configFile: './tsconfig.json',
},
]);
config
.plugin('define')
.use(context.webpack.DefinePlugin, [{
VERSION_PLACEHOLDER: JSON.stringify(version),
}]);
config.plugins.delete('hot');
config.devServer.hot(false);
if (context.command === 'start') {
Expand Down
3 changes: 2 additions & 1 deletion packages/ignitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"license": "MIT",
"devDependencies": {
"@alib/build-scripts": "^0.1.18"
"@alib/build-scripts": "^0.1.18",
"fs-extra": "^10.0.0"
}
}