npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jji

v5.1.3

Published

Just a simple Jumper clI tool. This tool aims to make an easy menu system to organize your cli workflow.

Downloads

37

Readme

jji

Just a simple Jumper clI tool.

This tool aims to make an easy menu system to organize your cli workflow.

Just run jj if you have jj.js file or *.jj.js files in the current folder.

Install

npm i -g jji

How menu structure works

  • every menu item has name: module.export.test
  • every menu item has command which can be: ss - simple script, ff - featured function or null
  • every menu item optionally can have a description. in this case the definition change to array where description is on the first place: module.exports.run = ["run simple", ss("echo hello")]
  • every menu item can have sub menu which can be after description or after command (it called as group)
    • after description: module.exports.group_name = ["group description", {...}]
    • after command: module.exports.group_name = ["group description", ss("echo hello"), {...}]
  • every group can have a group command which can be: ss - simple script
  • when one item selected, all group command and item command going to be concatenated into one string and executed in node spawn shell
  • there are 3 extra type of menu item:
    • lazy load menu - ff.lazy.do(async (resolve)=>{...}), which means when you enter into the menu the Promise start after the select
    • slow menu - ff.menu.do(async (resolve)=>{...}), which means the Promise start after the program start
    • read only - null, not selectable menu item

Examples

Menu control keys

  • arrow-up/down and tab: up/down in the menu
  • select: enter
  • one level up: esc
  • on top level: esc equals exit
  • terminate: ctrl+c
  • clear screen: ctrl+l
  • fly mode start: ctrl+space or text start with space

Features

  • possible to run script from jj.js or *.jj.js
  • if the working folder contains *.jj.js possible to sort with number. ex. *.0.jj,js *.1.jj,js
  • prompt base sub menu system, please check the example/demo/jj.js#L1
  • search in the menu and in descriptions
  • all script runs inside a node spawn
  • provided global functions, which means you do not need to import anything for use in your *.jj.js file:
    • ss - simple script
    • ff - featured function
    • jj - just jump extra functions

Global functions

ss - simple script
ff - featured function
jj - just jump extra functions

jj for a jj global function access. In your javascript code you can use the followings:

  • 'jj.home()' which will reopen the menu on the top (root) level after the function finish

  • 'jj.stay()' which will reopen the menu on the same level after the function finish

  • 'jj.rl': const rl = await jj.rl('Type your name') which will read a line from stdin. One parameter is the question.

  • 'jj.err': jj.err('Something went wrong!') this will print an error msg if exist and exit the program.

  • 'jj.mkdir': await jj.mkdir('/path/to') this will create a folder recursively.

  • 'jj.rm': await jj.rm('/path/to') this will remove a folder recursively.

  • jj.cl*.do which run a simple script:

    • global control properties for jji workflow:
      • process.env.__shell [boolean] true means all spawn command will be executed in shell.
    • 'jj.cl.do': which run a simple script with inherited stdio. The output simple printed:jj.cl.do(`echo hello wold`) . possible to combine with fix parameter between array. jj.cl.do(``docker exec alpine sh -c``, [``ls -al``]); or jj.cl.do(``docker exec alpine sh -c``, [``ls -al``], ``/usr``, [``/path with space``]);
    • 'jj.cli.do' which run a simple script. same as jj.cl, but output is not printed and parsed. Example:const a = await jj.cli.do(`echo other done other`); console.log(a). [default]: no split. Possible to add extra parameters (option object place in the arguments list no matter):
      • splitByLine: the output will not be split: await jj.cli.splitByLine.do(``echo ${false}``, 'other'); example/demo/jj.js#L76
      • splitAll: the output will be split by line and split lines by [space and tab]: await jj.cli.splitAll.do(``echo ${false}``, ); example/demo/jj.js#L84
      • hideErr: the output will not contains stderr output: await jj.cli.hideErr.do(``echo ${false}``, 'other');. [default]: include
      • wd: set the current directory: await jj.cli.wd('/path/to').do(``echo ${false}``, 'other');. [default]: undefined
      • eol: set end of line characters: await jj.cli.eol('\r\n').do(``echo ${false}`` 'other');. [default]: \n
  • 'ff.lazy.do' for a lazy load menu, which means when you enter into the menu the Promise start after the enter. First parameter is a promise call back function, the second is a description, the third is a command. Example:ff.lazy.do(async (res)=>{}, {options})

  • '$' for a option extend, which means extra options extends the original function. Example:$$$((res, rej)=>{}, {options})

  • all command which are functions, can have options:

    • __noPrintOnSelect [boolean] true means when execute the command no header will be printed after the selection. example/real/jj.js#L50. [default]: false
    • __needInput [boolean] true if you want to use 'jj.rl' function. you can also manage manually inside yor function with process.stdin.pause() or process.stdin.resume(). example/demo/jj.js#L14. [default]: false
    • __showLoadingAfter [number] ms works only with lazy menu example/real/jj.js#L31. [default]: 100
    • __resetMenuPos [boolean] true if you want a repositioned menu. if you print anything to screen during the menu build, the default work flow clears back last menu size. works only with lazy menu example/demo/jj.js#L114. [default]: false
    • __printSelect [boolean] true if you want a selection on menu enter. works only with lazy menu example/demo/jj.js#L20. [default]: false
    • __header [function] returns string print message before menu execute example/real/jj.js#L25. you can use jj.term.colorCode* src/term.js#L237
    • __footer [function] returns string print message after menu execute example/real/jj.js#L26. you can use jj.term.colorCode* src/term.js#L237
    • __keyHandler [function] when returns true menu can handle that key. not implemented yet [default]: undefined
  • all boolean property is available on global scope because of shorter definition. example: await __(``hi ${false}``, { __splitByLine: true }, 'other'); ==> await __(``hi ${false}``, { __splitByLine }, 'other');

Usage

| command | description| | ------------- |:-------------| | jj | it gives a nice choices menu | | jj -h | gives a standard help manual|

Status

  • [x] support menu for select a script
  • [x] fly mode