Skip to content

Commit

Permalink
Merge pull request RocketChat#350 from RocketChat/feature/readme
Browse files Browse the repository at this point in the history
Update readme with install issues
  • Loading branch information
engelgabriel authored Feb 10, 2017
2 parents 6ea243b + 114d7d5 commit 533f32f
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ npm start

## Structure of the project

The application is split between two main folders...
The sources is located in the `src` folder. Everything in this folder will be built automatically when running the app with `npm start`.

`src` - this folder is intended for files which need to be transpiled or compiled (files which can't be used directly by Electron).

`app` - contains all static assets (put here images, css, html etc.) which don't need any pre-processing.
Stylesheets are written in `less` and are located in `src/stylesheets`. They will be build into a single `main.css` in the `app` folder.

The build process compiles all stuff from the `src` folder and puts it into the `app` folder, so after the build has finished, your `app` folder contains the full, runnable application.

Treat `src` and `app` folders like two halves of one bigger thing.


## The build pipeline

Build process is founded upon [gulp](https://github.com/gulpjs/gulp) task runner and [rollup](https://github.com/rollup/rollup) bundler. There are two entry files for your code: `src/background.js` and `src/app.js`. Rollup will follow all `import` statements starting from those files and compile code of the whole dependency tree into one `.js` file for each entry point.
Expand All @@ -51,17 +46,42 @@ Side note: If the module you want to use in your app is a native one (not pure J

## Working with modules

Thanks to [rollup](https://github.com/rollup/rollup) you can (and should) use ES6 modules for all code in `src` folder. But because ES6 modules still aren't natively supported you can't use them in the `app` folder.
Thanks to [rollup](https://github.com/rollup/rollup) you can (and should) use ES6 modules for most code in `src` folder.

Use ES6 syntax in the `src` folder like this:
```js
import myStuff from './my_lib/my_stuff';
```

But use CommonJS syntax in `app` folder. So the code from above should look as follows:
The exception is in `src/public`. ES6 will work inside this folder, but it is limited to what Electron/Chromium supports. The key thing to note is that you cannot use `import` and `export` statements. Imports and exports need to be done using CommonJS syntax:

```js
var myStuff = require('./my_lib/my_stuff');
const myStuff = require('./my_lib/my_stuff');
const { myFunction } = require('./App');
```

## Issues with Install

### node-gyp
Follow the installation instruction on [node-gyp readme](https://github.com/nodejs/node-gyp#installation).

#### Ubuntu Install
You will need to install:
```sh
build-essential
libevas-dev
libxss-dev
```
### Fedora Install
You will need to install:
```sh
libX11
libXScrnSaver-devel
gcc-c++
```

#### Windows 7
On Windows 7 you may have to follow option 2 of the [node-gyp install guide](https://github.com/nodejs/node-gyp#installation) and install Visual Studio

# Testing

Expand Down

0 comments on commit 533f32f

Please sign in to comment.