Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jbangdev/jbang

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jbangdev/jbang

NPM for JBang - Java Script in your JavaScript

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-23.86%
Maintainers
1
Weekly downloads
 
Created
Source

jbang-npm - Java Script in your JavaScript

Install and use JBang from npm based projects

Usage

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

Given this script test.js:

#! /usr/bin/env node
const jbang = require('@jbangdev/jbang');
jbang.exec('properties@jbangdev');

And in package.json:

{
  "scripts": {
    "test": "node test.js"
  },
  "devDependencies": {
    "@jbangdev/jbang": "^0.1.0"
  }
}

Now you can invoke the test script from the command-line:

npm run test

You can easily pass command-line arguments around:

let args = process.argv.slice(2).join(' ');
jbang.exec('com.myco.mylib:RELEASE ' + args);

So now if you run npm run test arg1 arg2, arg1 arg2 will be appended to the command executed.

Behind the scenes

When you run npm install - JBang and other dependencies will be installed via the npm preinstall hook. This uses the app setup command.

Opening a new terminal or shell may be required to be able to use the jbang command from the system PATH.

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.

Keywords

FAQs

Package last updated on 31 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc