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

fix: service.resolvePackage not working properly while APP_ROOT specified #4044

Merged
merged 2 commits into from
Mar 3, 2020
Merged

fix: service.resolvePackage not working properly while APP_ROOT specified #4044

merged 2 commits into from
Mar 3, 2020

Conversation

leftstick
Copy link
Contributor

Checklist

  • npm test passes
  • tests are included
  • commit message follows commit guidelines
Description of change

While env APP_ROOT is specified, service.resolvePackageI() returns info incorrectly.

Check my repo: hosts-master

@umijs/plugin-model will not be discovered properly

@netlify
Copy link

netlify bot commented Mar 3, 2020

Ant Design Pro preview using the current branch umi

Built with commit fd4313b

https://deploy-preview-4044--pro-pre-umijs.netlify.com

@codecov
Copy link

codecov bot commented Mar 3, 2020

Codecov Report

Merging #4044 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4044      +/-   ##
=========================================
+ Coverage   83.87%   83.9%   +0.02%     
=========================================
  Files         127     128       +1     
  Lines        2524    2528       +4     
  Branches      635     631       -4     
=========================================
+ Hits         2117    2121       +4     
- Misses        398     399       +1     
+ Partials        9       8       -1
Impacted Files Coverage Δ
packages/core/src/Service/Service.ts 96.09% <100%> (ø) ⬆️
packages/umi/src/utils/getPkg.ts 100% <100%> (ø)
packages/core/src/Config/Config.ts 60.97% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9746d03...fd4313b. Read the comment docs.

Copy link
Member

@sorrycc sorrycc left a comment

Choose a reason for hiding this comment

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

逻辑放外面吧,Service 还是精简点好,有 APP_ROOT 时,在外面 resovle 好 pkg 传给 Service。

@leftstick
Copy link
Contributor Author

逻辑放外面吧,Service 还是精简点好,有 APP_ROOT 时,在外面 resovle 好 pkg 传给 Service。

那service里的resolvePackage还要么?还是说,如果有传入的pkg就用传入的,没有的话,走原逻辑resolvePackage?

@sorrycc
Copy link
Member

sorrycc commented Mar 3, 2020

如果有传入的pkg就用传入的,没有的话,走原逻辑resolvePackage?

是的。

@sorrycc sorrycc merged commit 2c44406 into umijs:master Mar 3, 2020
@@ -9,6 +11,7 @@ const args = yParser(process.argv.slice(2));
process.env.NODE_ENV = 'development';
const service = new Service({
cwd: getCwd(),
pkg: getPkg(process.cwd()),
Copy link
Member

Choose a reason for hiding this comment

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

不对,有 APP_ROOT 的时候,是不是也应该先找 APP_ROOT 下的 package.json,再找根节点的?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

有道理

Copy link
Contributor Author

@leftstick leftstick Mar 3, 2020

Choose a reason for hiding this comment

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

@sorrycc 我又做了一些改动,你再看看? 另外的pr #4052

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

2 participants