-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 根据项目的package.json中的依赖判断区块下载版本 #1313
Conversation
fenglai0802
commented
Jan 12, 2019
- 移除scan-layout 中从远端获取数据的相关逻辑,只取项目本地的
- 创建页面时的下载区块逻辑和下载区块到页面的逻辑统一
- 移除commonBlock的判断:创建是都是传入true,没必要。
1. 移除scan-layout 中从远端获取数据的相关逻辑,只取项目本地的 2. 创建页面时的下载区块逻辑和下载区块到页面的逻辑统一 3. 移除commonBlock的判断:创建是都是传入true,没必要。
return depName.includes('@alifd/next'); | ||
}); | ||
return hasNext ? '1.x' : '0.x' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasBase 和 haseNext 看起来可以简化一下
const hasBase = depNames.some( depName => {
return depName.includes('@icedesign/base');
});
if (hasBase) {
return '0.x';
}
const hasNext = depNames.some( depName => {
return depName.includes('@alifd/next');
});
return hasNext ? '1.x' : '0.x'
=>
if ( depNames. includes('@icedesign/base') ) return '0.x';
if ( depNames. includes('@alifd/next') ) return '1.x';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const hasFdNext = dependencies['@alifd/next'];
const hasIceDesignBase = dependencies['@icedesign/base'];
return hasIceDesignBase ? '0.x' : '1.x';
这样是不是更简单?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 上面 hasFdNext 声明了没使用
return dependencies['@icedesign/base'] ? '0.x' : '1.x';
@@ -7,15 +7,22 @@ | |||
* { | |||
"type": "npm", | |||
"npm": "@icedesign/foo-block", | |||
"version": "0.1.5", | |||
"version": "1.0.0", | |||
"version-o.x": "0.1.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version-o.x
=> version-0.x
return new Promise((resolve, reject) => { | ||
let version = source.version; | ||
|
||
if (projectVersion === '0.x') { | ||
version = source['version-0.x']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里要兼容下 version = source['version-0.x'] || source.version;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok