Wednesday, September 20, 2017

Oracle Jet - preparing Oracle Linux for Oracle Jet Development

Oracle JavaScript Extension Toolkit (JET) empowers developers by providing a modular open source toolkit based on modern JavaScript, CSS3 and HTML5 design and development principles. Oracle JET is targeted at intermediate to advanced JavaScript developers working on client-side applications. It's a collection of open source JavaScript libraries along with a set of Oracle contributed JavaScript libraries that make it as simple and efficient as possible to build applications that consume and interact with Oracle products and services, especially Oracle Cloud services.

When developing Oracle Jet based solutions you can decide to use your local workstation for the development work, or you could opt to use virtual machine on your laptop. In this case we will be using a virtual Oracle Linux system which we created using vagrant and the Vagrant boxes provided by Oracle. To see a more detailed description on how to get Oracle Linux started with Vagrant you can refer to this specific blogpost.

Preparing your Oracle Jet Development system
To get started with Oracle Jet on a fresh Oracle Linux installation you will need to undertake a couple of steps outline below. The steps include;
  • Install Linux development tools
  • Install Node.JS
  • Install Yeoman
  • Install Grunt
  • Install Oracle JET Yeoman Generator

Install Linux development tools
for some of the Node.JS and Yeoman modules it i required to have a set of Linux development tools present at your machine. You can install them by using a simple YUM command as shown below:

yum install gcc-c++ make

Install Node.JS
The installation of Node.JS starts with ensuring you have the proper repositories in place. This can be done with a single command as shown below:

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

After this you can do the actual installation of Node.JS using yum as shown below:

yum -y install nodejs

Install Yeoman
After the installation of Node.JS you should have NPM on your system and you should be able to install Yeoman. Yeoman is a generic scaffolding system allowing the creation of any kind of app. It allows for rapidly getting started on new projects and streamlines the maintenance of existing projects. Yeoman is language agnostic. It can generate projects in any language (Web, Java, Python, C#, etc.) Yeoman by itself doesn't make any decisions. Every decision is made by generators which are basically plugins in the Yeoman environment.

You can install Yeoman with a single NPM command as shown below:
npm install -g yo

Install Grunt
After the installation of Node.JS you should have NPM on your system and you should be able to install Grunt. Grunt is a JavaScript task runner, a tool used to automatically perform frequently used tasks such as minification, compilation, unit testing, linting, etc. It uses a command-line interface to run custom tasks defined in a file (known as a Gruntfile). Grunt was created by Ben Alman and is written in Node.js.

You can install Grunt with a single NPM command as shown below:
npm install -g grunt-cli

Install Oracle JET Yeoman Generator
After the installation of Node.JS you should have NPM on your system and you should be able to install the Oracle JET Generator for Yeoman.

You can install the Oracle JET Yeoman Generator with a single NPM command as shown below:
npm install -g generator-oraclejet

Verify the installation
To verify the installation you can use the below command to see what is installed by NPM and you can try and run Yeoman.

To check what is installed you can use the NPM command in the way shown below:
[root@localhost ~]# npm list -g --depth=0
/usr/lib
├── generator-oraclejet@3.2.0
├── grunt-cli@1.2.0
├── npm@5.3.0
└── yo@2.0.0

[root@localhost ~]# 

After this you can try to start Yeoman in the way shown below (do not run yo as root).

[vagrant@localhost ~]$ yo
? 'Allo! What would you like to do? 
  Get me out of here! 
  ──────────────
  Run a generator
❯ Oraclejet 
  ──────────────
  Update your generators 
  Install a generator 
(Move up and down to reveal more choices)

If both are giving the result expected you should be ready to get started with your first Oracle Jet project.