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

clapi-bb

v1.0.22

Published

CLI app to build the boiler plate API routes & SQL schema for REST APIs build in the express framework.

Downloads

7

Readme

Clapi

Clapi is a cli app to build the boiler plate code for our standard applications be it whole applications or individual pieces such as servers, routes, or other single components.

Clapi has an opinionated file system that allows for smooth user input and fast automation. There are sets of commands that configured in the terminal by the user. When a user completes their configuration, the code executes and it generates the boiler plate code for whatever component they selected.

Instructions

Clapi should be installed as a dev dependency in your project and only used to scaffold components of your project such as starting a new microservice or just creating a single file.

npm i clapi-bb --save-dev

clapi

Available Commands

  • Route
    • Generate a route file
    • Arguments: name, path, includeTypes

Under the hood

Commands

Commands are the generation logic/files and are comprised of two things:

  • Execution file including a default export
    • Command files should be created as src/commads/{Command}.ts
      • Command files should use the command name as the file name
      • Command files must have a default export that executes the logic of the command
        • The default export must adhere to the ExecutableCommand type.
  • A Validator

Validators

  • There are two options when creating a validator, you may create your own validator file in the validators directory or export it from the command file itself. We recommend creating your own Validator so it can be individually searched if needed.

    • Validators should be created as src/validators/{Command}Validator.ts
    • All validators must adhere to the ValidatorOptions type
    • Validators can include some descriptive information by using the argDetails property that adheres to the ArgDetail type
    • As an alternative, you may export a Validator as the default from your Command file that adheres to the types mentioned above. View the code example below `const {CommandName}Validator = { // validation rules }

    export default {CommandName}Validator`;

    • If you do not create a Validator with your command, it will not be loaded into the command selections presented to the user.

Clapi

When you initialize Clapi with the command clapi the code follows this structure:

  1. Load all of the commands from the command directory
    1. Load all of the validators and assign them to their respectively named Commands
  2. Present the commands to the user
  3. User selects a command
  4. Present available and required command arguments to the user
  5. Assemble them and set them as process.argv items
  6. Validate and parse arguments with src/lib/utils/argHandler.ts
  7. Execute the command

All of the requirements should be controlled by the Validator, presented by Clapi, and executed by the Command