Updating the setup.py
to include that information is only the first step so that the linkage from that Python package to that JavaScript package on npm is established. The tool to acquire those dependencies onto your development environment (i.e. installing that into node_modules
) is done, and there is already a way (a not so good one that I am looking to improve). So right now it won't do what you want, but I want to get there. The example I also linked in the previous thread shows what currently can be done, basically using the declarations (in the current adhoc format) along with the JavaScript included within the various Python modules to create a complete (or partial) AMD bundle for consumption by some user agent through the implemented integration layers (plain Python CGI, or Sanic - Plone to follow at some point, hopefully).
Originally I really aimed to solve this issue is at the packaging level - I want to be able to have the standard python setup.py bdist_wheel
command to also extract the require bits from the node_modules
directory and put everything into the right place so the final Python wheel will include it, along with option to build/bundle the artifact(s) into the wheel, specifically the package's metadata sections (i.e. package's egg-info
or dist-info
directory). Given that Plone package doesn't do this to aid zcml declarations, I will need to do this when I get around to do the Plone support/integration bit.
If that part is done, and say if we can have entry points defined like this as per your use case:
'plone.bundle.node_modules': [ # or maybe collective.bundle.node_modules
'lazysizes/lazysizes-umd.js = collective.lazysizes.static',
'lazysizes/lazysizes-umd.min.js = collective.lazysizes.static',
'lazysizes/plugins/twitter/ls.twitter.js = collective.lazysizes.static',
'lazysizes/plugins/twitter/ls.twitter.min.js = collective.lazysizes.static',
],
And a command can be created to put them into the right places - this is something I had considered doing, but I need to put that new registry together and the functionality together. While it might not address all your issues this might help with building the wheels a bit easier (i.e. without having to manually copy those four JS files every time a new release is made), and users of the package will basically get the copy from the wheel.
For development and situations where a user want complete control over the artifact generation (i.e. using calmjs.rjs
), the other declaration will be needed so that, so that their generated artifact for use with collective.lazysizes
outside of the Plone managed JavaScript/resource registry can also be done more easily.
Thank you for your question, it is giving me ideas on how I can make this better for everyone, even though right now it can't quite be used for what you want to do.