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

n_shell

v0.6.2

Published

A node REPL with ShellJS loaded by default

Downloads

26

Readme

n_shell

npm version npm downloads

A node REPL with ShellJS loaded by default.

This was inspired by (and forked from) n_.

Like it?

Give it a star on Github

Installation:

$ npm install -g n_shell

Usage:

Invoking n_shell starts a node REPL with ShellJS required globally, with shell-like output:

bash $ n_shell
shelljs $ ls()
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ pwd()
/path/to/dir

But I don't want to use shelljs/global

No problem:

bash $ n_shell --no_global
shelljs $ typeof ls // not in the global namespace
'undefined'
shelljs $ shell.ls() // uses 'shell' prefix
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ shell.pwd()
/path/to/dir

But I want to use a different namespace

You're covered:

bash $ n_shell --no_global=$
shelljs $ $.ls() // now uses '$' as the prefix
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ $.pwd()
/path/to/dir

But I want to use a different version of ShellJS

Just install that version locally (npm install shelljs) and start up n_shell with the --path option:

bash $ n_shell --path=node_modules/shelljs
shelljs $

But I want plain JavaScript output

bash $ n_shell --noinspect
shelljs $ ls()
[ 'LICENSE',
  'README.md',
  'index.js',
  'node_modules',
  'package.json',
  stdout: 'LICENSE\nREADME.md\nindex.js\nnode_modules\npackage.json\n',
  stderr: null,
  code: 0,
  to: [Function],
  toEnd: [Function],
  cat: [Function],
  head: [Function],
  sed: [Function],
  sort: [Function],
  tail: [Function],
  grep: [Function],
  exec: [Function] ]

Available commands

This supports any command that ShellJS supports. It also adds some extra commands, for convenience. So far, this adds:

Options

  • --global: Start a node REPL with the equivalent of require('shelljs/global'). This is the default behavior.
  • --no_global [PREFIX], --local [PREFIX], -n [PREFIX]: Start a node REPL with the equivalent of var PREFIX = require('shelljs'). PREFIX defaults to shell, if not specified.
  • --use_strict: enforce strict mode (default is false)
  • --prompt <FORMAT>: use this format to generate the REPL prompt. Default is "shelljs %v%l $ "
    • %%: a literal % sign
    • %v: show the current version (from package.json)
    • %l: show [local] if this is using a local version of ShellJS
    • Want more format options? Let me know or send me a PR
  • --noinspect: disable the default --inspect behavior. This provides less-readable REPL output, but behaves just as a standard Node REPL would.
  • --path=path/to/shelljs/: the argument should be a path to a folder containing a ShellJS package.
  • --inspect (default): an experimental switch to add a .inspect() method to the output of each command. The return values are still ShellStrings, but appear more readable and shell-like. Also, commands with no arguments can be invoked without parentheses, such as shell.pwd and shell.ls. Recommended for ShellJS v0.7+. Credit for the idea goes to piranna.

History

Similarly to n_, n_shell stores REPL history under ~/.n_shell_history.