The JavaScript ecosystem is very volatile and very unpredictable. The result is that what seemed few years (or months ago) as a stable and standard library may become obsolete and unmaintained.
This is the case for many sao dependencies. We have two kinds of dependencies. The libraries that are used directly by the client code in the browser. And those that are used for building the web application.
Let’s first start with the direct dependencies.
bootstrap
We are stuck on the version 3. We should no more wait too long to migrate to the version 4. But we are mainly blocked by other dependencies. So it will be possible only once others are solved.
moment
It is being slowly retired. We should probably switch to Luxon but again we are blocked by other dependencies.
gettext.js
It is still maintained but it is frankly only 200LOC.
c3
It is still maintained even if it uses D3.js version 5 when the version 6 is already there. But it is not a big deal as the graph view are mainly independent.
papaparse
It is maintained by @pokoli so we have no maintenance issue here.
fullcalendar
We are stuck with version 3 (instead of version 5). This is mainly because we need an ES6 build system.
mousetrap
Correctly maintained so no problem.
bootstrap-rtl-ondemand
It is linked to bootstrap3 so we will need to change for Bootstrap 4 RTL when updating bootstrap.
Sortable
Maintained so no problem.
tempusdominus-bootstrap-3
It is linked to bootstrap3. We need to hack it a lot to make it functional. It has unneeded features and uses moment.
The problem is that it is the best option we have found for now. So I think we should have our own implementation especially because we have already our own parsing method (based on moment). So it is mainly about displaying a popup (using Popper.js) with a calendar inside.
popper.js
We need to use unpkg to install it from bower.
Now let’s see the building dependencies:
npm (node)
This seems to stay the only common place for the JavaScript ecosystem. It is used by almost all our dependencies.
bower
It is no more recommended and not all libraries are available on it. Also it adds a second dependency management in concurrence with node.
grunt
It is a tasks runner (still maintained) but we have need many plugins to make it works and some of them are no more maintained like grunt-xgettext
or grunt-po2json
. Also currently we can not transform code which will be needed if we want to use only node modules.
I think we must change for a tool that provides all we need in place.
So as we can see we should change the bower/grunt couple for something simpler but providing also code transformation (to support ES6). I think Parce correspond the best to our needs. But to use it we need to change the structure of all the code as we will no more need to manually manage the Sao
global namespace. The problem is to limit the changes in the code to keep maintenance easy. For now all the code is always intended by 4 spaces because of the (function() { 'use strict' }())
hack to prevent global variables.
By using Parcel we will only need to have some scripts in package.json
to build all the source code including the css. Also the published release will contain the full application with all the dependencies, this will simplify the deployment as it will no more required to have node installed.
In summary, we must:
- replace tempusdominus-bootstrap-3 by our own implementation.
- replace gettext.js
- migrate to import statement
- update to Bootstrap 5
- update fullcalendar
- replace moment by Luxon