Can I have Composer or something else download a Git repo as a dependency of my contrib module? I'm working on a module and there is a sub module for scanning barcodes that requires this, quagga.
Currently you have to manually download the library and put it into the libraries dir. If I add this as a dependency to the module you cannot install it without doing this first.

Can I have composer or something download a git repo to the libraries when installing the submodule?

Edit:
libraries.yml

form:
  version: VERSION
  css:
    layout:
      css/commerce_pos_barcode_scanning.css: {}
  js:
    js/commerce_pos_barcode_scanning.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - commerce_pos/quagga
quagga:
  remote: https://github.com/serratus/quaggaJS.git
  version: 1.0.0
  license:
    name: MIT
    url: https://github.com/serratus/quaggaJS/blob/master/LICENSE
    gpl-compatible: yes
  js:
    /libraries/webrtc/adapter-latest.js: {}
    /libraries/quagga/quagga.min.js: {}



install.yml

function commerce_pos_barcode_scanning_requirements($phase) {
  $requirements = [];
  if ($phase == 'install' || $phase == 'runtime') {
    $path = 'libraries/quagga/quagga.min.js';
    if (!file_exists($path)) {
      $requirements['commerce_pos_barcode_scanning'] = [
        'title' =&gt; t('POS Barcode Scanning'),
        'description' =&gt; t('To scan barcodes, you need to install the quagga JavaScript library. &lt;a href="/modules/contrib/commerce_pos/modules/barcode_scanning/README.md"&gt;How To&lt;/a&gt;'),
        'severity' =&gt; REQUIREMENT_WARNING,
      ];
    }
    else {
      $requirements['commerce_pos_barcode_scanning'] = [
        'title' =&gt; t('POS Barcode Scanning'),
        'severity' =&gt; REQUIREMENT_OK,
        'value' =&gt; t('quagga JavaScript library has been configured.'),
      ];
    }
  }

  return $requirements;
}
You can edit file composer.js

find "web/libraries/{$name}": ["type:drupal-library"], change to

"web/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset",
                "vendor:npm-asset",
                "vendor:bower-asset",

            ],


add repositories

{
            "type": "package",
            "package": {
                "name": "serratus/quaggaJS",
                "version": "0.12.1",
                "type": "drupal-library",
                "source": {
                    "url": "https://github.com/serratus/quaggaJS.git",
                    "type": "git",
                    "reference": "master"
                },
                "dist": {
                    "url": "https://github.com/serratus/quaggaJS/zipball/master/serratus-quaggaJS-v0.12.1-14-g862df88.zip",
                    "type": "zip"
                },
                "require": {
                    "composer/installers": "^1.0.20"
                }
            }
        }


and run composer require "serratus/quaggaJS"