apache / cordova-lib

Apache Cordova Tooling Library
https://cordova.apache.org/
Apache License 2.0
221 stars 243 forks source link

fix(restore-util): consider long and short names when restoring platforms from package.json #880

Closed breautek closed 3 years ago

breautek commented 3 years ago

Platforms affected

All

Motivation and Context

Fixes #878

Description

Try platform name prefixed with cordova- for platform / spec mapping, before falling back to plain platform name.

Testing

Added a unit test to ensure that platforms are restored without config.xml engine entry, and from devDependency. All existing unit tests passes.

Manually tested in a repo project.

Checklist

breautek commented 3 years ago

Not sure if this is a safe assumption though.

Do we support custom platforms...? If so, then this PR would probably break custom platform restorations...

codecov-commenter commented 3 years ago

Codecov Report

Merging #880 (af36427) into master (dd872f0) will increase coverage by 0.04%. The diff coverage is 100.00%.

:exclamation: Current head af36427 differs from pull request most recent head 3d90574. Consider uploading reports for the commit 3d90574 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master     #880      +/-   ##
==========================================
+ Coverage   91.13%   91.18%   +0.04%     
==========================================
  Files          45       45              
  Lines        2053     2053              
==========================================
+ Hits         1871     1872       +1     
+ Misses        182      181       -1     
Impacted Files Coverage Δ
src/cordova/restore-util.js 93.33% <ø> (+0.83%) :arrow_up:
src/cordova/platform/addHelper.js 94.73% <100.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 dd872f0...3d90574. Read the comment docs.

erisu commented 3 years ago

I believe we always supported custom platforms, even though I am not sure if any exist.

breautek commented 3 years ago

Thanks Raphinesse for taking the initiative of adding the required change in this PR!

raphinesse commented 3 years ago

My pleasure!