E Oracle JET CLI API for CI/CD

Oracle JET provides a public, programmatic API for the Oracle JET CLI.

This API enables execution of the following tasks in CI/CD pipelines, such as the pipelines provided by Oracle Visual Builder Studio.

Note:

In most circumstances calling the Oracle JET CLI as a shell task in the pipeline should provide sufficient functionality, but this API is available for advanced use cases.
  1. ojet build
  2. ojet restore
  3. ojet strip
  4. ojet package
  5. ojet publish

You create a new instance of the API as follows:

const Ojet = require("@oracle/ojet-cli");
const ojet = new Ojet({ cwd: "path/to/invoke/ojet/from" });

Note:

Use npm link @oracle/ojet-cli from your project if you are using a globally-installed Oracle JET CLI (npm install -g @oracle/ojet-cli).

The following options are supported when you create a new instance of the API.

Option Type Description
cwd string Path from where you invoke the Oracle JET CLI.
logs boolean Controls ojet logging.

Properties

Name Type Description
version string

Version of @oracle/ojet-cli

Method

The Oracle JET CLI API for CI/CD pipelines exposes one method, execute, that executes a CLI task and returns a promise which resolves to undefined on success and failure. The execute method supports the following options.

Option Type Description
task "build" | "restore" | "strip" | "package" | "publish"

Name of the task to execute.

scope "app" | "component" | "pack" Scope of the task to execute.
parameters string[] Parameters of the task to execute.
options object Options to execute the task with.

Examples

Example Code
ojet build
try {
  await ojet.execute({ task: "build" });
} catch {}
ojet build --release
try {
   await ojet.execute({ 
    task: "build", 
    options: {
      release: true
    } 
  });
} catch {}
ojet restore
try {
   await ojet.execute({ task: "restore" });
} catch {}
ojet strip
try {
   await ojet.execute({ task: "strip" });
} catch {}
ojet package component <component>
try {
  await ojet.execute({ 
    task: "package", 
    scope: "component"
    parameters: ["<component>"]
    options: {
      "pack": "<pack>"
    }
  });
} catch {}
ojet package pack <pack>
try {
  await ojet.execute({ 
    task: "package", 
    scope: "pack"
    parameters: ["<pack>"]
  });
} catch {}
    
ojet publish component <component> --username=<username> --password=<password> --secure=<true|false> --path=<path>
try {
  await ojet.execute({ 
    task: "publish", 
    scope: "component"
    parameters: ["<component>"],
    options: {
      username: "<username>",
      password: "<password>",
      secure: <true|false>,
      path: "<path>
    }
  });
} catch {}
ojet publish pack <pack> --username=<username> --password=<password> --secure=<true|false>
try {
  await ojet.execute({ 
    task: "publish", 
    scope: "pack"
    parameters: ["<pack>"],
    options: {
      username: "<username>",
      password: "<password>",
      secure: <true|false>
    }
  });
} catch {}