Skip to content
 
 

Repository files navigation

jbang-npm - Java Script in your JavaScript

Install and use JBang from NPM based projects.

Lets you use your own local scripts, JBang AppStore alias or any network reachable jar or Maven artifact.

Table of Contents

Installation

npm i @jbangdev/jbang --save

Prefer installing the package globally if you want to use it as a CLI wrapper of JBang:

npm i -g @jbangdev/jbang

Usage

You can find the complete documentation about arguments you can pass to the jbang executable here: https://www.jbang.dev/documentation/guide/latest/cli/jbang.html.

As a library

const jbang = require('@jbangdev/jbang');

jbang is an object exposing the following.

exec(string)

The jbang.exec() function accepts a string that will be passed as the command-line arguments to the jbang executable.

Example:

jbang.exec('app install --name karate-core com.intuit.karate:karate-core:RELEASE:all');

exec(string)

Same as jbang.exec but use await to get result.

await jbang.execAsync('app install --name karate-core com.intuit.karate:karate-core:RELEASE:all');

As a CLI

Package preferably installed globally, you can run in a shell the command named jbang-npm. jbang-npm is a simple wrapper of the installed jbang executable which prevents you to manually add the command to your path.

Example:

jbang-npm app install --name karate-core com.intuit.karate:karate-core:RELEASE:all

You can also use npx:

npx jbang quarkus@quarkusio

Behind the scenes

This will look for jbang in path and if not available install it before executing jbang.

Using as a dependency

In most cases you should be able to use JBang directly in node scripts.

But if you want to provide more customization you can create your own "wrapper" NPM package. One of the advantages is that you can pre-install the library dependencies needed at the time of npm install (just by calling --help or a similar "no op" command) so that the user-experience when running the first command after install is better.

For an example, refer to the @karatelabs/karate NPM package.

About

Install and use jbang from npm based projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages