setup_dev_environment.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/setup_dev_environment.rst">Edit me on GitHub</a></div>
  3. .. _`setup_dev_environment`:
  4. ============================
  5. Setting up a dev environment
  6. ============================
  7. .. _`webserver`:
  8. Installing the 3rd party dependencies
  9. =====================================
  10. To develop and customize Converse, you'll first need to check out Converse's Git
  11. repository:
  12. ::
  13. git clone https://github.com/conversejs/converse.js.git
  14. cd converse.js
  15. We use development tools which depend on Node.js and NPM (the Node package manager).
  16. It's recommended that you use `NVM <https://github.com/nvm-sh/nvm>`_ (the Node version manager)
  17. to make sure you have the right version of Node.
  18. Refer to the `NVM Github page <https://github.com/nvm-sh/nvm#install--update-script>`_ for instructions on how to install it.
  19. To set up a Converse development environment, you now run the following:
  20. ::
  21. make serve_bg
  22. make watch
  23. Alternatively, if you're using Windows, or don't have GNU Make installed, you can run the
  24. following:
  25. ::
  26. npm install
  27. npm run serve &
  28. npm run watch
  29. Then go to http://localhost:8000/dev.html to load Converse.
  30. Modify `dev.html <https://github.com/conversejs/converse.js/blob/master/dev.html>`_
  31. so that `converse.initialize()` is called with the relevant settings.
  32. Webpack will "watch" the source files and automatically recreate the build if they
  33. are modified. So you don't have to do anything to rebuild whenever you've
  34. change something in a file but you will have to manually reload the browser tab
  35. to see the changes in the browser.
  36. Live reloading
  37. --------------
  38. If you want to have live reloading whenever any of the source files change, you
  39. can run ``make devserver`` (or ``npm run devserver``) which uses `webpack-dev-server <https://github.com/webpack/webpack-dev-server>`_.
  40. Then go to http://localhost:8080.
  41. Instead of ``dev.html``, `webpack.html <https://github.com/conversejs/converse.js/blob/master/webpack.html>`_
  42. is now being used as the served HTML file, and you'll need to modify that file to
  43. change the settings passed to ``converse.initialize``.
  44. Troubleshooting
  45. ---------------
  46. After running ``make watch``, you should now have a new *node_modules* directory
  47. which contains all the external dependencies of Converse.
  48. If this directory does NOT exist, something must have gone wrong.
  49. Double-check the output of ``make watch`` to see if there are any errors
  50. listed.
  51. For support, you can ask in our chatroom: `dicuss@conference.conversejs.org <xmpp:discuss@conference.conversejs.org>`_.
  52. If you don't have an XMPP client installed, follow this link to
  53. `conversejs.org <https://conversejs.org/fullscreen#converse/room?jid=discuss@conference.conversejs.org>`_
  54. where you can log in and be taken directly to the chatroom.
  55. .. _`dependency-libsignal`:
  56. libsignal
  57. ---------
  58. If you want OMEMO encryption, you need to load `libsignal <https://github.com/signalapp/libsignal-protocol-javascript>`_ separately in your page.
  59. For example::
  60. <script src="3rdparty/libsignal-protocol-javascript/dist/libsignal-protocol.js"></script>
  61. The reason libsignal needs to be loaded separately is because it's released
  62. under the `GPLv3 <https://github.com/signalapp/libsignal-protocol-javascript/blob/master/LICENSE>`_
  63. which requires all other dependent JavaScript code to also be open sourced under the same
  64. license. You might not be willing to adhere to those terms, which is why you
  65. need to decide for yourself whether you're going to load libsignal or not.