Skip to content
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

Merged
merged 5 commits into from
Jan 14, 2019

Conversation

fenglai0802
Copy link
Contributor

  1. 移除scan-layout 中从远端获取数据的相关逻辑,只取项目本地的
  2. 创建页面时的下载区块逻辑和下载区块到页面的逻辑统一
  3. 移除commonBlock的判断:创建是都是传入true,没必要。

1. 移除scan-layout 中从远端获取数据的相关逻辑,只取项目本地的
2. 创建页面时的下载区块逻辑和下载区块到页面的逻辑统一
3. 移除commonBlock的判断:创建是都是传入true,没必要。
return depName.includes('@alifd/next');
});
return hasNext ? '1.x' : '0.x'

Copy link
Collaborator

@chenbin92 chenbin92 Jan 12, 2019

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';

Copy link
Collaborator

@imsobear imsobear Jan 13, 2019

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';

这样是不是更简单?

Copy link
Collaborator

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"
Copy link
Collaborator

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'];
Copy link
Collaborator

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;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@fenglai0802 fenglai0802 merged commit 9c7ce16 into iceworks/release-2.15.1 Jan 14, 2019
@delete-merged-branch delete-merged-branch bot deleted the iceworks/adapter-1.x branch January 14, 2019 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants