Fix detection of dropzonejs dist files for versions < 6

Created on 1 March 2024, 10 months ago
Updated 19 March 2024, 9 months ago

Problem/Motivation

The dropzonejs version 6 release changed the filename of the dist file from dropzone/dist/min/dropzone.min.js to dropzone/dist/min/dropzone-min.js.

Steps to reproduce

Install dropzonejs < 6 via npm-asset/dropzone or enyo/dropzone using composer.
Get an error on install:

  Dropzone library missing:<br /><br />Dropzonejs requires the dropzone.min.j  
  s library.                                                                   
          Download it (https://github.com/dropzone/dropzone) and place it in   
  the                                                                          
          libraries folder (/libraries)

Proposed resolution

This module should support all available versions or announce a proper dependency constraint.
Align js_candidates to be more resilient.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany volkerk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @volkerk
  • Pipeline finished with Failed
    10 months ago
    Total: 203s
    #108132
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Ah, I see. I don't think dropzone/dist/min/dropzone-min.js is needed, as you can see, that's inconsistent between the requirements check and the library alter.

    Probably enough to align it.

    The difference is whether or not you keep the dist folder, actually. See the output from CI with version 5:

    ```
    $ curl -L https://github.com/dropzone/dropzone/releases/download/$DROPZONE_VERSION/dist.zip -o dropzone.zip --silent
    $ unzip dropzone.zip
    Archive: dropzone.zip
    creating: dist/
    inflating: dist/basic.css
    inflating: dist/dropzone.js
    inflating: dist/dropzone-amd-module.js
    creating: dist/min/
    inflating: dist/min/dropzone.min.css
    inflating: dist/min/basic.min.css
    inflating: dist/min/dropzone-amd-module.min.js
    inflating: dist/min/dropzone.min.js
    inflating: dist/dropzone.css
    $ mv dist dropzone
    ```

    this then doesn't move dist inside dropzone, it renames it. That's also what you get when using the new recommended composer repositories.

    I would suggest adjusting your build process to that, but it was definitely my intention to provide BC for the existing path and I failed at that.

  • Status changed to Needs review 10 months ago
  • πŸ‡©πŸ‡ͺGermany volkerk

    Ah, I see. Aligned the MR to use only the variant with dist and dot

  • Pipeline finished with Failed
    10 months ago
    Total: 197s
    #108278
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    I'm not sure what's up with the test fail, can't reproduce locally.

  • πŸ‡ΏπŸ‡¦South Africa alabandit

    this patch seems to work. thank you!

  • πŸ‡¦πŸ‡ΊAustralia amjad1233 Brisbane

    Good old patch!

  • πŸ‡«πŸ‡·France nicodh

    I suggest to allow more options: I try to install using composer require npm-asset/dropzone, and library is not detected.
    Attach a patch that fixes also js / css detection in library alter (not only in requirements check).

  • Pipeline finished with Failed
    10 months ago
    Total: 211s
    #110191
  • Pipeline finished with Failed
    10 months ago
    #110204
  • Pipeline finished with Failed
    10 months ago
    #110205
  • Pipeline finished with Failed
    10 months ago
    Total: 194s
    #110207
  • Pipeline finished with Failed
    10 months ago
    #110217
  • Pipeline finished with Success
    10 months ago
    #110227
  • πŸ‡©πŸ‡ͺGermany volkerk

    Added check for libraries/dropzone/dist/min/dropzone.min.js in the test.
    I am not sure for which library version / distribution libraries/dropzone/dropzone-min.js is applicable.

    The module folder is concatenated with issue number in mr tests, therefore removed relevant part. See https://git.drupalcode.org/issue/dropzonejs-3424947/-/jobs/973387#L209

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Ah yes, the module folder, that makes sense, so it wasn't caused by this change, would happen with any issue/fork merge request. Strange that I didn't get that when I tested it initially, that was also a fork.

    Will commit and release an update asap.

  • Pipeline finished with Skipped
    10 months ago
    #110913
  • Status changed to Fixed 10 months ago
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Merged.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    @rkcreation: I missed your patch between all the other comments. Contributions must be done as merge requests now. I suggest you create a new issue to extend the options.

  • πŸ‡«πŸ‡·France nicodh

    My patch works with `composer require npm-asset/dropzone:^6@beta`: we needs 'dropzone/dist/dropzone-min.js' and 'dropzone/dist/dropzone.css'.

    I also try with merge-plugin, merging plugin's composer.libraries.json, so installing enyo/dropzone (5.7.2).

    * merge-plugin composer.libraries.json (enyo/dropzone 5.7.2) : OK
    * repositories of root composer.json + enyo/dropzone 5.7.2 : OK
    * npm-asset/dropzone:^6@beta : NOK
    * npm-asset/dropzone:^5 (5.9.3) : OK

    IMHO, I prefer npm-asset/* method, it seems more friendly for updates etc. See https://www.drupal.org/project/select2 β†’ for example.

    I will try to find some time to do a merge request.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    @rkcreation: I'm not saying your change isn't useful, I really just missed it and as mentioned, contributions need to be merge requests now (I've disabled DrupalCI on this project and it will soon be disabled for all projects) it especially shouldn't be mixed in the same issue.

    It also didn't help that it was posted next to #8, which is just the current MR as a patch for composer-patches (don't do that, use a local file). Doing that creates extra work for maintainers to sort out real contributions and set the credits correctly.

    Note1: merge-plugin is no longer recommended and removed from the documentation, you're also comparing different versions.
    Note2: asset-packagist is a project backed by single company based in Kiev, Ukraine. It is neat and convenient, but given the current situation (it was down for a day or so 1-2 years ago and nobody knew if it would come back), we and many others decided to not rely on it anymore. If it is gone, you are not deploying anymore until you switch to different approaches which might take quite some time.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024