Setting up a Git repo for Profound.js Modules on IBM i

Setting up a Git repo for Profound.js Modules on IBM i

Overview

Maintaining versions of your code is important in a modern development environment. Profound.js modules are ordinary files in the modules directory of the installation, so they can be kept in a Git repository like any other source.

This guide covers two approaches:

  1. Develop on the IBM i - A single non-bare repository over the Profound.js modules folder, where developers make individual commits from that same folder;

  2. Develop locally - A remote repository hosted on a cloud service or local-network server, where developers work on their own machines and commit to the remote repository, and the IBM i pulls the changes down. Some cloud services provide private repositories.

Git must be installed on the IBM i before following this guide. On current IBM i releases, Git is delivered through the open source package management (yum) – the same package manager used to install Node.js (see Installing Node.js for IBM i).

Option 1 - Develop on the IBM i

This option is the easiest to set up. From a PASE shell:

  1. Change to your Profound.js modules folder, or one of its subfolders:

    cd /profoundjs/modules
  2. Create the non-bare Git repository:

    git init
  3. If there are existing files in the folder, index, stage, and commit them:

    git add --all git commit -m "YOUR MESSAGE HERE"

As people create, delete, or modify files, each individual makes commits for the files they change.

Video Tutorial

Option 2 - Develop Locally With a Remote Repository

This option is best for distributed development. First set up either a local-network repository or use a cloud hosting service such as GitHub or Bitbucket.

  1. Create the repository on your local network or on a cloud service;

  2. Install Profound.js on your local machine;

  3. Clone the repository into the Profound.js installation on your local machine. Passing modules as the final parameter clones directly into the modules folder:

    git clone https://github.com/user/myproductmodules.git modules
  4. Follow Step 1 and Step 2 of the Profound.js Debugging with VS Code guide to run the code locally;

  5. Make commits back to the repository as normal.

The git clone ... modules form only works when modules does not already exist or is empty. If the clone fails, change into the modules folder first and clone there instead – note that this creates the repository in a subfolder of modules rather than over modules itself:

cd /profoundjs/modules git clone https://github.com/user/myproductmodules.git

Pulling the Changes Onto Your IBM i

  • Clone the repository into the Profound.js installation on the IBM i, again passing modules as the final parameter so it clones into the modules folder:

    git clone https://github.com/user/myproductmodules.git modules
  • Run git pull whenever you want to bring new commits down to the IBM i.

Profound.js also has built-in Git integration for module source control, controlled by the gitSupport and gitPath configuration options.