development_guide.md 3.09 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
3. Installing node build tools, as global dependencies:
   ```bash
30
      npm install -g yarn gulp@3.9.1 cordova@8.1.2 @ionic/cli@6.6.0 web-ext
31
   ```
32 33 34
   
## Get the source code and dependencies
   
35 36 37 38 39 40 41 42
1. Getting the source code:    
  ```bash
     git clone git@git.duniter.org:clients/cesium-grp/cesium.git
  ```
  
2. Install project dependencies:    
   ```bash
      cd cesium
Benoit Lavenier's avatar
Benoit Lavenier committed
43
      yarn
44
   ```
45

46 47
3. Installing Cordova plugins (required to build Android and iOS artifacts): 
   ```bash
48
      export JAVA_HOME=/path/to/jdk-8
Benoit Lavenier's avatar
Benoit Lavenier committed
49
      export PATH=$JAVA_HOME/bin:$PATH
50
      ionic cordova prepare
51
   ```
52

53
   This should create new directories `platforms/android` and `platforms/ios`.
54

Benoit Lavenier's avatar
Benoit Lavenier committed
55
   > As a reminder: check that your command line is configured correctly:
56
   > - You must place yourself in the directory of the application: `cd cesium`
Benoit Lavenier's avatar
Benoit Lavenier committed
57
   > - and working with NodeJs **v10**: `nvm use 10` (please check using the command `node --version`)
58
    
59

60
## Prepare Cesium default config
61

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

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

To compile and launch Cesium, run :
```bash
  yarn run start
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 105 106
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.
107

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