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. npm install
  22. npm run serve &
  23. npm run watch
  24. Alternatively, if you have GNU Make installed, you can run:
  25. ::
  26. make serve_bg
  27. make watch
  28. Then go to http://localhost:8000/dev.html to load Converse.
  29. Modify `dev.html <https://github.com/conversejs/converse.js/blob/master/dev.html>`_
  30. so that `converse.initialize()` is called with the relevant settings.
  31. Webpack will "watch" the source files and automatically recreate the build if they
  32. are modified. So you don't have to do anything to rebuild whenever you've
  33. change something in a file but you will have to manually reload the browser tab
  34. to see the changes in the browser.
  35. Live reloading
  36. --------------
  37. If you want to have live reloading whenever any of the source files change, you
  38. can run ``make devserver`` (or ``npm run devserver``) which uses `webpack-dev-server <https://github.com/webpack/webpack-dev-server>`_.
  39. Then go to http://localhost:8080.
  40. Instead of ``dev.html``, `webpack.html <https://github.com/conversejs/converse.js/blob/master/webpack.html>`_
  41. is now being used as the served HTML file, and you'll need to modify that file to
  42. change the settings passed to ``converse.initialize``.
  43. Troubleshooting
  44. ---------------
  45. After running ``make watch``, you should now have a new *node_modules* directory
  46. which contains all the external dependencies of Converse.
  47. If this directory does NOT exist, something must have gone wrong.
  48. Double-check the output of ``make watch`` to see if there are any errors
  49. listed.
  50. For support, you can ask in our chatroom: `dicuss@conference.conversejs.org <xmpp:discuss@conference.conversejs.org>`_.
  51. If you don't have an XMPP client installed, follow this link to
  52. `conversejs.org <https://conversejs.org/fullscreen#converse/room?jid=discuss@conference.conversejs.org>`_
  53. where you can log in and be taken directly to the chatroom.
  54. .. _`dependency-libsignal`:
  55. libsignal
  56. ---------
  57. If you want OMEMO encryption, you need to load `libsignal <https://github.com/signalapp/libsignal-protocol-javascript>`_ separately in your page.
  58. For example::
  59. <script src="3rdparty/libsignal-protocol-javascript/dist/libsignal-protocol.js"></script>
  60. The reason libsignal needs to be loaded separately is because it's released
  61. under the `GPLv3 <https://github.com/signalapp/libsignal-protocol-javascript/blob/master/LICENSE>`_
  62. which requires all other dependent JavaScript code to also be open sourced under the same
  63. license. You might not be willing to adhere to those terms, which is why you
  64. need to decide for yourself whether you're going to load libsignal or not.