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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cli-abstractor

v0.0.6

Published

This can be potentially be used by developers to create a CLI that would allow code reuse - and a CLI to prompt them for necessary information

Readme

cli-abstractor

This can be potentially be used by developers to create a CLI that would allow code reuse - and a CLI to prompt them for necessary information

Notes on how to create a CLI from the extractor:

  1. First we create a folder and two inside it - one for CLI and one for test
$ mkdir cli-container
$ cd cli-container
$ mkdir my-first-cli
$ mkdir cli-test-container
  1. Next we create an npm package that will be the CLI program and load relevant stuff into it
$ cd my-first-cli
$ npm init // or 'npm init -y' if you want to skip the prompt
$ npx https://github.com/Saljooq/cli-abstractor
  1. Next we will create a test file that can contain some code too and put it in a test.file and absorb it as default

$ echo hello {{name}} I bet you work as a {{ profession }} > test.file
$ npm run absorb

> [email protected] absorb
> node ./cli-abstractor-store/absorb.js

Here is the list of files that would be added
[ './test.file' ]
Do you want to continue
What's the answer?        y
What's the Flag?        default
INITIATING ABSORPTION UNDER FLAG -> default

+ absorbing -> ./test.file
  1. To test it from a completely new file location we use the test folder - after that we can upload it to git repo and run it as npx www.your-repo.com
$ cd ../cli-test-container
$ npx ../my-first-cli/
Need to install the following packages:
  file:../temp_test_delete_please
Ok to proceed? (y) y
only one flag available -> default
Processing it by default....
What's the name?        Sal
What's the profession?        Software Engineer
+ creating/writing to file ./test.file
$ ls
test.file
$ cat test.file 
hello Sal I bet you work as a Software Engineer
  1. If {{}} style of templating conflicts with your code go to cli-abstractor-store/regex.js and update the starting and ending sequences
export const closingSquence = '}}'
export const openingSequence = '{{'

GOAL FOR PHASE 1

  • create a .cli-ignore
  • read the ignore file and get a list of file/folder names
  • dont put the file or foldernames that match the list in the store file/folder list
  • make a copy of all the files in the store along with mapping - with the default flag
  • this should then auto create the index file that would help users access flags and dynamically
  • generate a prompt
  • STAGE 1 COMPLETE

GOAL FOR PHASE 2

  • investigate a single repo for all stages
  • dynamically get a list of all the files on the path - with the relevant ignored
  • generate a set of all the mappings that will be needed
  • create the relevant structure to store all the mappings + files' data in one place per module
  • enable a prompt to ask the user to choose a module
  • create all the files in the relevant module
  • STAGE 2 COMPLETE

GOAL FOR PHASE 3

  • update the logic to work within one repo
  • separate the logic for absorb and start
  • test generation of all the files in a module
  • make module more intuitive prompts
  • add colorings for warning and prompts - or important information
  • generate prompt to get the mappings to replace text
  • add logic to replace relevant text in the files
  • add logic to also enable name change of files themselves
  • update readme to indicate how the app will work
  • create a global store for the opening and closing sequence for replacement - this will enable auto-generation of code in with jinja brackets are valid code
  • test more thoroughly to make sure sequence of updates work

GOAL FOR PHASE 4

  • investingate upgrading to typescript - and if all the logic will still be backwards compatible
  • change flags to modules for easy understandability
  • change file's content to fileContent and file's name to fileName
  • add types - if possible - this will require time
  • add if-module feature
  • create gifs of videos to make the sequence of steps and what they produce more understandable

Sample of ./cli-abstractor-store.js:


const data = {
        project-name : "",
        description : "",
        content : [
            {
                flag : default
                content : [
                    { 
                        type: "file",
                        name : "index-client-module.js",
                        content : "Something something"

                    },
                    {
                        type: "file"
                        name : "README.md",
                        content : "Something something......"
                    },
                    {
                        type: "folder",
                        name: "main-logic"
                    }
                ]
                mappings : [ "var1", "var2" ]
            },

        ]
    }

export default data;