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: handle APP_ROOT scenario in getPkg.ts #4056

Merged
merged 2 commits into from
Mar 4, 2020
Merged

refactor: handle APP_ROOT scenario in getPkg.ts #4056

merged 2 commits into from
Mar 4, 2020

Conversation

leftstick
Copy link
Contributor

@leftstick leftstick commented Mar 3, 2020

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

handle APP_ROOT scenario properly in getPkg.ts.

related to #4044

@netlify
Copy link

netlify bot commented Mar 3, 2020

Ant Design Pro preview using the current branch umi

Built with commit 95e6e2f

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

@codecov
Copy link

codecov bot commented Mar 3, 2020

Codecov Report

Merging #4056 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4056      +/-   ##
==========================================
+ Coverage   83.90%   83.91%   +0.01%     
==========================================
  Files         128      128              
  Lines        2528     2530       +2     
  Branches      640      631       -9     
==========================================
+ Hits         2121     2123       +2     
- Misses        398      399       +1     
+ Partials        9        8       -1     
Impacted Files Coverage Δ
packages/core/src/Config/Config.ts 60.97% <0.00%> (ø)

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 d904b0f...95e6e2f. Read the comment docs.

@sorrycc
Copy link
Member

sorrycc commented Mar 3, 2020

为啥我觉得在入口那里把 getPkg(process.cwd()) 改成 getPkg(getCwd()) || getPkg(process.cwd()) (getCwd() 返回值复用下)就好了。。

@leftstick
Copy link
Contributor Author

为啥我觉得在入口那里把 getPkg(process.cwd()) 改成 getPkg(getCwd()) || getPkg(process.cwd()) (getCwd() 返回值复用下)就好了。。

我试试啊,昨天写的时候记得复用getCwd有问题才改成这样的,但这会又想不起来了。。。。

@leftstick
Copy link
Contributor Author

@sorrycc 想起来了,getCwd里在没有APP_ROOT的情况下,默认返回cwd的值,有个ut不改cwd是跑不过的。因为ut直接从umi的根目录下也能找到package.json,不符合ut的预期。ut我改了下,还是调整下cwd,afterEach之后再还原就好了

@sorrycc sorrycc merged commit 88c9124 into umijs:master Mar 4, 2020
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