You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Zak (JIRA)" <ji...@apache.org> on 2018/03/20 03:06:00 UTC

[jira] [Created] (CB-13992) Remove dependency-ls or provide option to skip npm checks

Zak created CB-13992:
------------------------

             Summary: Remove dependency-ls or provide option to skip npm checks
                 Key: CB-13992
                 URL: https://issues.apache.org/jira/browse/CB-13992
             Project: Apache Cordova
          Issue Type: Wish
          Components: cordova-cli, cordova-fetch
    Affects Versions: 8.0.0
            Reporter: Zak


I noticed that our CI builds of cordova projects are very slow when adding the platforms - the stage where plugins are added taks a few minutes for each build. I did some digging around and profiling and eventually found that the slowest part is where `cordova-fetch` uses the `dependency-ls` module to list all installed dependencies of the project before and after installing each plugin.

This dependency runs `npm list --depth=0` under the hood which is slow (~5 seconds per run on a relatively small Ionic project). You can test this by running this small script:

{{var depls = require('dependency-ls')}}
{{return depls(process.cwd())}}
{{.then(function(result) {}}
{{  console.log(result)}}
{{})}}

Note also that the dependency runs twice for each plugin in the project adding 10 seconds per plugin. This means it can take a few minutes just to add a platform to the project - although this is much slower in CI/Docker build environments.

However, this step seems pretty redundant since the plugins are likely already installed via npm since they are now saved in the package.json file. I made a fork of cordova-fetch which removes this step completely and just uses the existing plugins in `node_modules` and the time to add platform drops down to ~7 seconds (down from minutes) with no change to the actual result since the plugins are already there.

https://github.com/NextFaze/cordova-fetch/tree/fix/speed

Since plugins now install via npm and save to package.json by default it would be nice to at least provide the option to skip this npm step for plugins for cases where they already exist in node modules, if it can't be removed completely.

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org