jdfekete / reorder.js

JavaScript library to reorder matrices
BSD 3-Clause "New" or "Revised" License
127 stars 29 forks source link

Modernize Distribution #8

Closed curran closed 3 years ago

curran commented 3 years ago

From a discussion in https://github.com/jdfekete/reorder.js/issues/1

User story: As a potential user of this library, I would like to see it have a modern and easy to consume distribution, so that I can use it in my project (either via NPM as a dependency, or via some CDN such as JSDelivr or UNPKG).

I suppose the ideal scenario would be a UMD bundle distribution that contains dependencies as well (science, tiny-queue).

curran commented 3 years ago

Suggested approach: replace Makefile with Rollup.

Reference example: https://github.com/rollup/rollup-starter-lib

curran commented 3 years ago

As I dig in a little bit, I am able to run make install and make test.

I notice that the tests are not all passing. Here is the output:

> reorder.js@1.0.7 test /home/curran/repos/reorder.js
> vows --nocolor; echo

·· ·· · ·· ·· ··· ··· · · ··· ·· ··· ·· ·····✗✗✗✗✗✗✗✗✗✗ ·· · ··· ·······  

    order 
      ✗ insert-simple 
      Invalid list, indices not sorted 

      ✗ insert-1 
      Invalid list, indices not sorted 

      ✗ insert-2 
      Invalid list, indices not sorted 

      ✗ insert-3 
      Invalid list, indices not sorted 

      ✗ insert-4 
      Invalid list, indices not sorted 

      ✗ insert-5 
      Invalid list, indices not sorted 

      ✗ insert-6 
      Invalid list, indices not sorted 

      ✗ insert-7 
      Invalid list, indices not sorted 

      ✗ insert-lesssimple 
      Invalid list, indices not sorted 

      ✗ insert-evenharder 
      Invalid list, indices not sorted 
  ✗ Errored » 45 honored ∙ 10 errored (0.604s) 

Is this expected? Or were the tests all passing in the past?

My gut feeling is that the first task should actually be to make sure all the tests pass, then only after that we can go about working on the distribution.

Also, a few notes from initial investigation:

The Makefile concatenates the source files together. Options for moving forward with Rollup include:

curran commented 3 years ago

Opened a separate issue for only fixing the tests: #9

jdfekete commented 3 years ago

I have merged the pull requests The new version compiles fine and passes the tests. I will update the README file and acknowledge your work, @curran!

Now, how should the html examples in the examples directory be changed to work again?

curran commented 3 years ago

Ah! The html examples in the examples directory can be made to work again by having them reference the UMD output in dist.

curran commented 3 years ago

Closing this issue as it's essentially done.

Opening a few more as follow-on tasks: