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

refactor(spm-package) resolve pkg dep from current to root #28

Merged
merged 1 commit into from Dec 22, 2014

Conversation

sorrycc
Copy link
Collaborator

@sorrycc sorrycc commented Dec 22, 2014

Close spmjs/spm#1100

依赖查找改成由下往上查找,感觉这样更合乎逻辑,多出来的性能消耗理论上应该是比较少的。

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 0122b60 on fix-deps-resolve into 92bb4a1 on master.

if (version || !pkg.father) {
break;
}
pkg = pkg.father;
Copy link
Owner

Choose a reason for hiding this comment

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

这块逻辑还是跟原来一样吧,现在扁平化的目录父级模块并不是上一层目录,所以只要两层判断就好了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

从上往下找还有个潜在的问题。问了邵帅,在他的使用中也是有些场景的。

以下依赖链:

a -> b -> c@0.1.0
   -> c@0.1.0

然后在 a 中 link b,在 b 中 link c 。如果从上往下找,那么 b 的依赖 c 会取 a 下面的 c ,则会出现 c 的修改在调试 b 时有效,而调试 a 时无效的问题。

Copy link
Owner

Choose a reason for hiding this comment

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

从下往上我同意,但只要两层就够了

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

逻辑这样?

从下往上找两层,然后如果不是 rootPkg 的话,再找一遍 rootPkg 的 spm_modules。

Copy link
Owner

Choose a reason for hiding this comment

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

是啊,把原来的顺序颠倒下

@sorrycc
Copy link
Collaborator Author

sorrycc commented Dec 22, 2014

逻辑更新了。

从下往上找两层,然后如果不是 rootPkg 的话,再找一遍 rootPkg 的 spm_modules。

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling c13c308 on fix-deps-resolve into 92bb4a1 on master.

@popomore
Copy link
Owner

+1

popomore added a commit that referenced this pull request Dec 22, 2014
refactor(spm-package) resolve pkg dep from current to root
@popomore popomore merged commit 82ef830 into master Dec 22, 2014
@popomore popomore deleted the fix-deps-resolve branch December 22, 2014 15:51
@popomore
Copy link
Owner

0.10.6

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.

spm link bug
3 participants