Skip to content

Commit

Permalink
Remove rST files to replace with Markdown.
Browse files Browse the repository at this point in the history
Currently (readthedocs/recommonmark#3)
the recommonmark bridge (which allows Sphinx to read
Markdown) does not support tables, so the directory structure
doc is now a bulleted list instead of a set of tables.
  • Loading branch information
brainwane committed May 15, 2016
1 parent c3d67cb commit f65cb7f
Show file tree
Hide file tree
Showing 10 changed files with 1,211 additions and 1,296 deletions.
481 changes: 481 additions & 0 deletions docs/code-style.md

Large diffs are not rendered by default.

522 changes: 0 additions & 522 deletions docs/code-style.rst

This file was deleted.

114 changes: 114 additions & 0 deletions docs/directory-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
Directory structure
===================

This page documents the Zulip directory structure and how to decide
where to put a file.

Scripts
-------

* `scripts/` Scripts that production deployments might run manually
(e.g., `restart-server`).

* `scripts/lib/` Scripts that are needed on production deployments but
humans should never run.

* `scripts/setup/` Tools that production deployments will only run
once, during installation.

* `tools/` Development tools.
---------------------------------------------------------

Bots
----

* `api/integrations/` Bots distributed as part of the Zulip API bundle.

* `bots/` Previously Zulip internal bots. These usually need a bit of
work.
-----------------------------------------------------

Management commands
-------------------

* `zerver/management/commands/` Management commands one might run at a
production deployment site (e.g. scripts to change a value or
deactivate a user properly)

-------------------------------------------------------------------------

Views
-----

* `zerver/tornadoviews.py` Tornado views

* `zerver/views/webhooks.py` Webhook views

* `zerver/views/messages.py` message-related views

* `zerver/views/__init__.py` other Django views

----------------------------------------

Jinja2 Compatibility Files
--------------------------

* `zproject/jinja2/__init__.py` Jinja2 environment

* `zproject/jinja2/backends.py` Jinja2 backend

* `zproject/jinja2/compressors.py` Jinja2 compatible functions of
Django-Pipeline

-----------------------------------------------------------------------

Static assets
-------------

* `assets/` For assets not to be served to the web (e.g. the system to
generate our favicons)

* `static/` For things we do want to both serve to the web and
distribute to production deployments (e.g. the webpages)

---------------------------------------------------------------

Puppet
------


* `puppet/zulip/` For configuration for production deployments

-------------------------------------------------------------------

Templates
---------

* `templates/zerver/ ` For Jinja2 templates for the backend (for zerver
app)

* `static/templates/` Handlebars templates for the frontend

-----------------------------------------------------------------------

Tests
-----

* `zerver/tests/` Backend tests

* `frontend_tests/node_tests/` Node Frontend unit tests

* `frontend_tests/casper_tests/` Casper frontend tests

-----------------------------------------------------------------------


Documentation
-------------

* `docs/` Source for this documentation
--------------------------------------------------------------

You can consult the repository's `.gitattributes file` to see exactly
which components are excluded from production releases (release
tarballs are generated using `tools/build-release-tarball`).
107 changes: 0 additions & 107 deletions docs/directory-structure.rst

This file was deleted.

73 changes: 73 additions & 0 deletions docs/front-end-build-process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Front End Build Process
=======================

This page documents additional information that may be useful when
developing new features for Zulip that require front-end changes. For a
more general overview, see the new-feature-tutorial. The code-style
documentation also has relevant information about how Zulip's code is
structured.

Primary build process
---------------------

Most of the existing JS in Zulip is written in IIFE-wrapped modules, one
per file in the static/js directory. When running Zulip in development
mode, each file is loaded seperately. In production mode (and when
creating a release tarball using tools/build-release-tarball),
JavaScript files are concatenated and minified.

If you add a new JavaScript file, it needs to be specified in the
JS\_SPECS dictionary defined in zproject/settings.py to be included in
the concatenated file.

Webpack/CommonJS modules
------------------------

New JS written for Zulip can be written as CommonJS modules (bundled
using [webpack](https://webpack.github.io/), though this will taken care
of automatically whenever `run-dev.py` is running). (CommonJS is the
same module format that Node uses, so see the Node
documentation \<https://nodejs.org/docs/latest/api/modules.html\> for
more information on the syntax.)

Benefits of using CommonJS modules over the
[IIFE](http://benalman.com/news/2010/11/immediately-invoked-function-expression/)
module approach:

- namespacing/module boilerplate will be added automatically in the
bundling process
- dependencies between modules are more explicit and easier to trace
- no separate list of JS files needs to be maintained for
concatenation and minification
- third-party libraries can be more easily installed/versioned using
npm
- running the same code in the browser and in Node for testing is
simplified (as both environments use the same module syntax)

The entry point file for the bundle generated by webpack is
`static/js/src/main.js`. Any modules you add will need to be required
from this file (or one of its dependencies) in order to be included in
the script bundle.

Adding static files
-------------------

To add a static file to the app (JavaScript, CSS, images, etc), first
add it to the appropriate place under `static/`.

- Third-party files should all go in `static/third/`. Tag the commit
with "[third]" when adding or modifying a third-party package.
- Our own JS lives under `static/js`; CSS lives under `static/styles`.
- JavaScript and CSS files are combined and minified in production. In
this case all you need to do is add the filename to PIPELINE\_CSS or
JS\_SPECS in `zproject/settings.py`. (If you plan to only use the
JS/CSS within the app proper, and not on the login page or other
standalone pages, put it in the 'app' category.)

If you want to test minified files in development, look for the
`PIPELINE =` line in `zproject/settings.py` and set it to `True` -- or
just set `DEBUG = False`.

Note that `static/html/{400,5xx}.html` will only render properly if
minification is enabled, since they hardcode the path
`static/min/portico.css`.
75 changes: 0 additions & 75 deletions docs/front-end-build-process.rst

This file was deleted.

Loading

0 comments on commit f65cb7f

Please sign in to comment.