Match-id-bb74986eff163d2fe265b8aac9796fe992faf803

This commit is contained in:
* 2022-03-08 11:44:48 +08:00 committed by *
parent ea68846de7
commit 885af8cb79
4 changed files with 15 additions and 67 deletions

View File

@ -2,45 +2,20 @@
## 工程编译:
Horizon采用monorepo方式管理项目意思是在版本控制系统的单个代码库里包含了许多项目的代码
monorepo工具采用yarn
### yarn配置
1. yarn1推荐
``` shell
// 先安装yarn
npm i yarn -g
```
`C:\Users\[工号]\.yarnrc`无相应文件需要新建
加入yarn配置
```shell
registry "http://szxy1.artifactory.cd-cloud-artifact.tools.huawei.com/artifactory/api/npm/sz-npm-public"
no-proxy .huawei.com
lastUpdateCheck 1646381423295
strict-ssl false
```
2. yarn2
由于yarn2+有不兼容更新安装方式依赖node 16+的corepack功能安装参考 [yarn官网](https://yarnpkg.com/getting-started/install)
`C:\Users\[工号]\.yarnrc.yml`加入yarn配置无相应文件需要新建
加入yarn配置
```shell
npmRegistryServer "http://szxy1.artifactory.cd-cloud-artifact.tools.huawei.com/artifactory/api/npm/sz-npm-public"
```
注意yarn2配置文件和字段都存在大量不兼容参考[详细配置](https://yarnpkg.com/configuration/yarnrc#npmRegistryServer)
monorepo工具采用npm workspaces **npm版本需要大于7.x**
### 工程命令
#### 安装
```shell
yarn
npm install
```
> 需要使用yarn安装monorepo的依赖才能正确安装到node_modules
> 需要使用npm7.x以后版本安装monorepo的依赖才能正确安装到node_modules
#### 打包
```shell
yarn run build
npm run build
```
#### 全局单元测试
```shell
yarn run test
npm run test
```
#### 发布包:

View File

@ -30,7 +30,7 @@ function isValidKey(key) {
}
function mergeDefault(sourceObj, defaultObj) {
Object.keys(defaultObj).forEach((key) => {
Object.keys(defaultObj).forEach(key => {
if (sourceObj[key] === undefined) {
sourceObj[key] = defaultObj[key];
}
@ -44,10 +44,10 @@ function buildElement(isClone, type, setting, children) {
const props = isClone ? { ...type.props } : {};
let vNode = isClone ? type.belongClassVNode : getProcessingClassVNode();
if (setting != null) {
if (setting !== null) {
const keys = Object.keys(setting);
const keyLength = keys.length;
for(let i = 0; i < keyLength; i++) {
for (let i = 0; i < keyLength; i++) {
const k = keys[i];
if (isValidKey(k)) {
props[k] = setting[k];
@ -81,5 +81,5 @@ export function cloneElement(element, setting, ...children) {
// 检测结构体是否为合法的Element
export function isValidElement(element) {
return !!(element && element.vtype === TYPE_COMMON_ELEMENT);
return (element && element.vtype === TYPE_COMMON_ELEMENT);
}

View File

@ -59,14 +59,9 @@
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"chalk": "^3.0.0",
"clean-webpack-plugin": "^4.0.0-alpha.0",
"concurrently": "^6.2.0",
"confusing-browser-globals": "^1.0.9",
"copy-webpack-plugin": "5.0.4",
"core-js": "^3.6.4",
"coveralls": "^3.0.9",
"cross-env": "^7.0.3",
"css-loader": "3.4.2",
"danger": "^9.2.10",
"ejs": "^3.1.6",
"error-stack-parser": "^2.0.6",
@ -80,46 +75,25 @@
"eslint-plugin-no-function-declare-after-return": "^1.0.0",
"eslint-plugin-react": "^6.7.1",
"eslint-webpack-plugin": "^3.0.1",
"express": "^4.17.1",
"filesize": "^6.0.1",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"gzip-size": "^5.1.1",
"html-webpack-plugin": "4.4.1",
"jest": "^25.5.4",
"jest-cli": "^25.2.7",
"jest-diff": "^25.2.6",
"jest-environment-jsdom-sixteen": "^1.0.3",
"jest-react": "^0.12.0",
"jest-snapshot-serializer-raw": "^1.1.0",
"minimatch": "^3.0.4",
"minimist": "^1.2.3",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"object-assign": "^4.1.1",
"pacote": "^10.3.0",
"power-assert": "^1.6.1",
"prettier": "1.19.1",
"prop-types": "^15.6.2",
"random-seed": "^0.3.0",
"react-lifecycles-compat": "^3.0.4",
"regenerator-runtime": "^0.13.9",
"resemblejs": "^4.0.0",
"rimraf": "^3.0.0",
"semver": "^7.1.1",
"style-loader": "1.0.0",
"targz": "^1.0.1",
"through2": "^3.0.1",
"tmp": "^0.1.0",
"tslint": "^6.0.0",
"typescript": "^3.9.7",
"url-loader": "^4.1.1",
"wait-on": "^6.0.0",
"webpack": "^4.46.0",
"webpack-cli": "^4.7.2",
"yargs": "^15.3.1"
"webpack-cli": "^4.7.2"
},
"devEngines": {
"node": "8.x || 9.x || 10.x || 11.x || 12.x || 13.x || 14.x"
"engines": {
"node": ">=10.x",
"npm": ">=7.x"
}
}

View File

@ -1,7 +1,6 @@
'use strict';
const path = require('path');
const libPath = path.join(__dirname, '../../libs');
const libPath = path.join(__dirname, '../../libs/horizon');
const baseConfig = {
entry: path.resolve(libPath, 'index.ts'),
module: {
@ -10,7 +9,7 @@ const baseConfig = {
test: /\.(js)|ts$/,
exclude: /node_modules/,
use: [
{
{
loader: 'babel-loader'
}
]