Jump to: navigation, search

Orion/JavaScript/Build

Warning2.png
Building the API
This page describes an unofficial build process to bundle the JavaScript tools API, and is not guaranteed to be used in any release of Orion. This build is currently not part of the official builds for Orion.


Building the API

Before we jump in to building the API, we have to perform a bit of configuration for Nodejs.

Webpack Setup

To build the Orion JavaScript tools, we are using Webpack. So the first thing to do is to install it: npm install -g webpack Once it is done installing, we have to add in two loaders that we need to make sure we can build the Orion source with JSON loading and NLS support.

The first loader is json-loader:

npm install json-loader

The second is amdi18n-loader:

npm install amdi18n-loader

That allows us to run the build, but now we have to make a small change to one of the loaders to make sure it can understand the shape of the NLS files used in Orion.

The changes will be made to the amdi18n-loader module.

navigate to your node_modules folder in the root of your user directory - for example /Users/currentuser/node_modules find the amdi18n-loader folder and open it up open the index.js file in there and copy / paste the code out of mrennie/amdi18n-loader into your local index.js now save and close the file.

Run a build

With everything done from the #Webpack Setup, lets run a build:

Open your favorite command line navigate to the javascript bundle in the Orion client git repo (make sure you have the orion client repo cloned)

cd /git/org.eclipse.orion.client/bundles/org.eclipse.orion.client.javascript

make sure the file webpack.config.js is in the directory (if not pull from the repo) run the following command for a simple build:

webpack --progress

there should now be a built version of the tools in the folder ./built-js. The version built with the above command will produce an unminified, very large file (around 4.1MB). If we want to make it awesomer, run the following command:

webpack -p --progress

After the build completes, you should also see the source map in the ./built-js directory.