development_guide.md 2.98 KB
Newer Older
1 2 3 4 5 6
# Development Guide

## Prerequisite  

To build Cesium, you will have to: 
 
7 8 9 10
1. Installing build tools:
   ```bash
      sudo apt-get install git wget curl unzip build-essential software-properties-common ruby ruby-dev ruby-ffi gcc make
   ```
11

12
2. Installing node.js v10 :
13

14 15 16 17
  * First, install [nvm](https://github.com/nvm-sh/nvm) (Node Version Manager) :    
    ```bash
       wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
    ```
Martin Delille's avatar
Martin Delille committed
18

19
    > Alternatively, if you are using `fish shell`, there is a [dedicated plugin](https://github.com/jorgebucaran/fish-nvm).
20

21 22 23 24 25 26
  * Then, reload your terminal (for instance by executing the command `bash`);

  * Configure nvm to use the expected version: (**WARNING**: upper version will NOT work !) 
    ```bash
       nvm install 10
    ```
27
      
28 29 30 31
3. Installing node build tools, as global dependencies:
   ```bash
      npm install -g yarn gulp cordova ionic
   ```
32 33 34
   
## Get the source code and dependencies
   
35 36 37 38 39 40 41 42 43 44
1. Getting the source code:    
  ```bash
     git clone git@git.duniter.org:clients/cesium-grp/cesium.git
  ```
  
2. Install project dependencies:    
   ```bash
      cd cesium
      yarn install
   ```
45

46 47 48 49
3. Installing Cordova plugins (required to build Android and iOS artifacts): 
   ```bash
      ionic cordova preapre
   ```
50

51
   This should create new directories `platforms/android` and `platforms/ios`.
52

53 54 55 56
   > To remind: check that your command line is configured:
   > - You must place yourself in the directory of the application: `cd cesium`
   > - and be configured for NodeJs v10: `nvm use 10` (please check using the command `node --version`)
    
57

58
## Prepare Cesium default config
59

60
Configure Cesium default settings :
61
 
62
1. Add your environment config into `app/config.json`
63
   
64 65 66 67
2. Update default configuration, using the command:    
   ```bash
      gulp config --env <your_env_name> 
   ```
68

69
  This will update a configuration file `www/js/config.json`.
70
 
71 72 73 74 75
## Compile and launch

To compile and launch Cesium, run :
```bash
  yarn run start
76 77
```

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
or alternative: `npm start` or `ionic serve` 

The application should be running at [localhost:8100](http://localhost:8100)!


## Build artifacts 

Cesium can be build:
- [as an unhosted web applicationa](build_web.md);
- [for Android](build_android.md);
- [for iOS](build_ios.md);
- [as a Web extension](build_web_extension.md) for Mozilla Firefox or Chrome/Chomium;
- [as a Desktop application](build_desktop.md) for Linux (`.deb`), Windows and MacOSx;

You may also [use Docker image](./build_docker.md) to simplify this task;   


## Time to code !

### Pull request

For each pull request, please create a issue first.

### Best practices for development

Cesium could be run on phone devices. Please read [performance tips on AgularJS + Ionic ](http://julienrenaux.fr/2015/08/24/ultimate-angularjs-and-ionic-performance-cheat-sheet/)
before starting to contribute.
105

106
Read also [Angular performance for large applicatoins](https://www.airpair.com/angularjs/posts/angularjs-performance-large-applications).