Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13992

Remove dependency-ls or provide option to skip npm checks

    XMLWordPrintableJSON

Details

    Description

      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.

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zbarbuto Zak
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: