dependencies.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/theming.rst">Edit me on GitHub</a></div>
  3. .. _`development`:
  4. ============================
  5. Setting up a dev environment
  6. ============================
  7. Installing the 3rd party dependencies
  8. =====================================
  9. To develop and customize Converse, you'll first need to check out Converse's Git
  10. repository:
  11. ::
  12. git clone https://github.com/conversejs/converse.js.git
  13. cd converse.js
  14. We use development tools which depend on Node.js and NPM (the Node package manager).
  15. It's recommended that you use `NVM <https://github.com/nvm-sh/nvm>`_ (the Node version manager)
  16. to make sure you have the right version of Node.
  17. Refer to the `NVM Github page <https://github.com/nvm-sh/nvm#install--update-script>`_ for instructions on how to install it.
  18. Once NVM is installed, you can run the following inside your checkout of the Converse Git repository:
  19. ::
  20. nvm install
  21. .. note::
  22. You will always have to first run ``nvm install`` in a new terminal session before working on Converse.
  23. To set up the Converse development environment, you now run ``make dev``.
  24. ::
  25. make dev
  26. Alternatively, if you're using Windows, or don't have GNU Make installed, you can run the
  27. following:
  28. ::
  29. npm install
  30. npm run lerna
  31. This will install the Node development tools and Converse's dependencies.
  32. The front-end dependencies are those JavaScript files on which
  33. Converse directly depends and which will be loaded in the browser as part of
  34. the bundle in ``dist/converse.js`` (or ``dist/converse.min.js``).
  35. To see the 3rd party dependencies (not just the front-end dependencies, but
  36. also ones necessary for development tasks like making builds), take a look at
  37. the list under the ``devDependencies`` in `package.json <https://github.com/jcbrand/converse.js/blob/master/package.json>`_.
  38. .. note::
  39. After running ```make dev```, you should now have a new *node_modules* directory
  40. which contains all the external dependencies of Converse.
  41. If this directory does NOT exist, something must have gone wrong.
  42. Double-check the output of ```make dev``` to see if there are any errors
  43. listed. For support, you can ask in our chatroom: `dicuss@conference.conversejs.org <xmpp:discuss@conference.conversejs.org>`_.
  44. If you don't have an XMPP client installed, follow this link to
  45. `conversejs.org <https://conversejs.org/fullscreen#converse/room?jid=discuss@conference.conversejs.org>`_
  46. where you can log in and be taken directly to the chatroom.
  47. .. _`dependency-libsignal`:
  48. Libsignal
  49. ---------
  50. If you want OMEMO encryption, you need to load `libsignal <https://github.com/signalapp/libsignal-protocol-javascript>`_ separately in your page.
  51. For example::
  52. <script src="3rdparty/libsignal-protocol-javascript/dist/libsignal-protocol.js"></script>
  53. The reason libsignal needs to be loaded separately is because it's released
  54. under the `GPLv3 <https://github.com/signalapp/libsignal-protocol-javascript/blob/master/LICENSE>`_
  55. which requires all other dependent JavaScript code to also be open sourced under the same
  56. license. You might not be willing to adhere to those terms, which is why you
  57. need to decide for yourself whether you're going to load libsignal or not.
  58. .. _`webserver`:
  59. Setting up a webserver
  60. ======================
  61. When making changes to Converse, either development or theming changes,
  62. you'll want to preview them in your browser.
  63. For this, you'll need to serve the development files via a web server,
  64. so that you can see your local changes in the browser.
  65. Manually starting a web server
  66. ------------------------------
  67. To both set up the development environment and also start up a web browser to
  68. serve the files for you, you can run::
  69. make serve
  70. .. note::
  71. To run the "make" commands, you'll need `GNUMake <https://www.gnu.org/software/make>`_
  72. installed on your computer. If you use GNU/Linux or \*BSD, it should be installed or
  73. available via your package manager. For Mac, you'll need to install XCode and in
  74. Windows you can use `Chocolatey <https://chocolatey.org/>`_.
  75. After running ``make serve`` you can open http://localhost:8000 in your webbrowser to see the Converse website.
  76. When developing or changing the theme, you'll want to load all the
  77. unminified JS and CSS resources as separate files. To do this, open http://localhost:8000/dev.html instead.
  78. You might want to open `dev.html <https://github.com/conversejs/converse.js/blob/master/dev.html>`_ in your text editor or IDE as well, to see
  79. how ``converse.initialize`` is called and to potentially change any of the
  80. settings.
  81. Starting a web server with live reloading
  82. -----------------------------------------
  83. Alternatively, if you want to have live reloading whenever any of the source files change, you
  84. can run ``make devserver`` (which will use `webpack-dev-server <https://github.com/webpack/webpack-dev-server>`_).
  85. Instead of ``dev.html`` being used, `webpack.html <https://github.com/conversejs/converse.js/blob/master/webpack.html>`_
  86. is now being used as the HTML template, and you'll need to modify that file if
  87. you want to change the settings passed to ``converse.initialize``.
  88. If you're running ``make devserver``, you need to open http://localhost:8080.