Skip to content

TPZF/ngEO

Repository files navigation

ngEO-WebC

ngEO-WebC Web client is the front end of the ngEO project. It is used with the backend end ngeo project named ngEO-QS (https://github.com/TPZF/ngEO-LWS)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

TBD

Installation

You should install

  • node.js version 7.5.0
  • npm version 4.1.2 (for windows installation it is already contained in)
  • brunch (npm install -g brunch)
  • Create a repository where you want to place your dev folder
  • CD to this repository
  • Retrieve the project git in your repository by typing git clone https://github.com/TPZF/ngEO.git
  • Then do npm install and that is it as the package.json file contains already all required libraries

Build dev version

ngEO is written in CommonJS format, so the client code must be built(concatenated in one file) before launching. To do the build in the development mode run: brunch build

or if you want to build automatically your code on each modification just run: `brunch watch

Results will be found at output-dev folder

There are some warnings that are displayed in the console because brunch process some files that are not used for the final build (for examaple some less files that are used only on other less files on import purpose)

Build production version

To build client app in production mode (minified one) launch brunch build --production

Results will be found at output-opt folder (you can change it on file brunch-config.coffee if you want it to be build somewhere elese)

There are some many warning that are displayed in the console because brunch process some files that are not used for the final build (for exmaple some less files that are used only on other less files on import purpose)

Debug

To debug the web-client javascript use DevTools? of Chrome browser or another tool of your favourite browser.

To debug the stub_server, run stub_server with "node-debug" instead of "node" command. If not installed, install globally "node-inspector" with npm.

Difference between "source code" and "generated" code

ngEO is written in CommonJS format, so the code need to be "compiled" to register modules.

There are two ways to ensure the registration of modules:

  • Source code + templates generated by brunch

In this case, you need to add "commonjs" preprocessor to "compile" the source code. The drawback is that I hadn't found karma preprocessor to "complie" templates so we use the compiled templates coming from "output-dev/js/main-templates.js" (this one has been compiled with brunch processor.

  • Fully brunch generated code

Use the code already generated by brunch in : "output-dev/js/**/*.js" No problem with code/templates, but source map aren't recognized by Karma and coverage generation is also made on concatenated code.

By default I will leave source code + templates made-in-brunch, but this issue need to be handled properly later..

Scripts

To build & deploy at once, just launch the "deployNGEO.sh NGEO_DIRECTORY WEBC_VERSION WEBC_DATE" Example:

  • sh deployNGEO.sh ngEOV2 2.12 20150507
  • sudo node /usr/local/ngeo/webclient-testserver/app.js

Test polygon with OpenLayers