apache / cordova-lib

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

GH-832: Look at devDeps for restoring platforms #835

Closed dpogue closed 4 years ago

dpogue commented 4 years ago

Platforms affected

N/A

Motivation and Context

Closes #832 where the cordova prepare restore process would not look at package.json devDependencies for platforms, and would restore platforms with the wrong versions.

Description

Make the platform restore process match the plugin restore process where both devDependencies and dependencies are taken into account.

This also includes fixes for writing package.json with the correct newlines, which should address the complaints raised in https://github.com/apache/cordova-cli/issues/353 and possibly https://github.com/apache/cordova-lib/issues/694.

It also changes the handling of promises when restoring platforms/plugins such that a failure to restore will return a rejecting promise rather than swallowing the error and continuing to build.

Testing

Unit tests pass

Checklist

codecov-commenter commented 4 years ago

Codecov Report

Merging #835 into master will decrease coverage by 0.07%. The diff coverage is 91.30%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #835      +/-   ##
==========================================
- Coverage   89.96%   89.89%   -0.08%     
==========================================
  Files          46       46              
  Lines        2133     2097      -36     
==========================================
- Hits         1919     1885      -34     
+ Misses        214      212       -2     
Impacted Files Coverage Δ
src/util/promise-util.js 100.00% <ø> (+16.66%) :arrow_up:
src/cordova/restore-util.js 92.50% <91.30%> (-1.46%) :arrow_down:

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 7a20be8...72d7807. Read the comment docs.