development_guide.md 3.32 KB
Newer Older
1 2
# Development Guide

3 4 5
## In a post-it

```bash
Benoit Lavenier's avatar
Benoit Lavenier committed
6
# Install NodeJS v12
7
nvm use 12
Benoit Lavenier's avatar
Benoit Lavenier committed
8 9 10
npm install -g yarn 

# Clone and compile from source
11 12 13
git clone git@git.duniter.org:clients/cesium-grp/cesium.git
cd cesium
yarn
Benoit Lavenier's avatar
Benoit Lavenier committed
14 15

# Run the App !
16 17 18 19 20 21 22
yarn run start
```


## Step by step

### Prerequisite  
23 24 25

To build Cesium, you will have to: 
 
26 27 28 29
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
   ```
30

31
2. Installing node.js v12 :
32

33 34 35 36
  * 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
37

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

40 41 42 43
  * 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
44
       nvm install 12
45
    ```
46
      
47 48
3. Installing node build tools, as global dependencies:
   ```bash
49
      npm install -g yarn gulp cordova@10.0.0 @ionic/cli web-ext
50
   ```
51
   
52
### Get the source code and dependencies
53
   
54 55 56 57 58 59 60 61
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
62
      yarn
63
   ```
64

65 66
3. Installing Cordova plugins (required to build Android and iOS artifacts): 
   ```bash
67
      export JAVA_HOME=/path/to/jdk-8
Benoit Lavenier's avatar
Benoit Lavenier committed
68
      export PATH=$JAVA_HOME/bin:$PATH
69
      ionic cordova prepare
70
   ```
71

72
   This should create new directories `platforms/android` and `platforms/ios`.
73

74
   > As a reminder: check that your command line is well configured:
75
   > - You must place yourself in the directory of the application: `cd cesium`
76
   > - and working with NodeJs **v12**: `nvm use 12` (please check using the command `node --version`)
77
    
78

79
### Prepare configuration file
80

81
Configure Cesium default settings :
82
 
83
1. Add your environment config into `app/config.json`
84
   
85 86 87 88
2. Update default configuration, using the command:    
   ```bash
      gulp config --env <your_env_name> 
   ```
89

90
  This will update a configuration file `www/js/config.json`.
91
 
92
### Compile and launch
93

94
To compile and launch Cesium, run:
95 96
```bash
  yarn run start
97 98
```

99 100 101 102 103
or alternative: `npm start` or `ionic serve` 

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


104
### Build artifacts 
105 106 107 108 109 110 111 112

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;

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


116
### Time to code !
117

118
#### Pull request
119

120
For each pull request, please create an issue first.
121

122
#### Best practices for development
123

124
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/)
125
before starting to contribute.
126

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