Closed cmrd-senya closed 5 years ago
Thanks for starting work on this and for explaining the mechanics behind the change.
You make a compelling case and I think splitting things up with Lerna makes sense and holds a lot of promise.
I've invited you to the conversejs organisation and the developers team. Feel free to create your banches inside this organisation. Perhaps you would also be willing to move your converse-with-vue repo into this org?
Starting tomorrow I'm taking a two weeks break during which I'll be offline most of the time and won't be working. Afterwards I'll be back at work, continuing working on the http-file-upload branch.
I'll also spend some time splitting the MUC code more cleanly into views and models (related to your PR).
Furthermore, I'll work on some of the above mentioned tasks as time allows.
I'm a big proponent of taking baby steps towards a goal, maintaining functionality while doing so, instead of trying to do a massive rewrite/reorg that bogs one down for weeks or months.
So, for example, simply moving the modules from src/
to packages/*/
is already a win in my book.
Hey!
I just pushed lerna branch in my fork: https://github.com/cmrd-senya/converse.js/tree/use-lerna
You may want to take a look.
I managed to build current Converse.js bundle with it, though I didn't run any actual tests. I'll do some tests and when everything works as expected I'll open a PR.
Hi @cmrd-senya, you might be interested to know that I've just merged my webpack
branch.
Converse now uses webpack to make its builds.
Implemented in #1246
Let's discuss if it is a good direction for us to move to using Lerna.
I've created a branch of Converse.js which partially moves structure on Lerna (and breaks everything else). So basically I created
/packages/
directory in the repository root and createdchatboxes/ chatview/ core/ disco/ headless/ mam/ muc/ ping/ vcard/
packages there and moved respective source code to the packages. I didn't finish with muc and template related files because it quickly became too much work at once, so I stayed at supporting onlyheadless
module and everything it depends on.New NPM packages are scoped with the
@converse
scope, so the names are@converse/core
,@converse/chatboxes
,@converse/disco
, etc (just like recent Babel versions being named). I used private NPM repository for testing so it's not published on real NPM, but it's ready for that (in terms of packaging, but not in terms of production source code of course).After packages are published it becomes possible to depend on converse modules via NPM and install them this way, e.g.:
And then just require them from a ES6 module like:
Currently new packages can be published to NPM using
I used this with a private NPM repository and it worked totally fine for me.
Also I created a demo application with Vue.js and Webpack: https://github.com/cmrd-senya/converse.js-vue-example
I was too lazy to write a proper demo, so it only capable of getting input (jid, password) and logging into XMPP account (without any proper rendering, sorry, so the only possible way to see that it works is via developer tools). I'll make a proper demo application, just didn't want to put too much efforts there at the moment since I want to have some feedback first. It is actually possible to replace front end completely by another one written in Vue (or whatever) and use Converse.js for XMPP managing purpose.
In any case, the demo shows that it can use Converse with nice dependency management and consistent Webpack bundling.
TODOs:
src/
topackages/*/
converse.js
NPM package) to be built from new packages using Webpack