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

setup-cli-app

v1.1.0

Published

The easiest way to set up a modern CLI app by running one command.

Downloads

8

Readme

The easiest way to start a modern cli app. It supercharges your development workflow, allowing you to quickly scaffold resources for your cli application with best practices in mind.

Features

  • Efficient CLI Setup: Start building your CLI app within minutes with a well-structured template and easy-to-use commands.
  • Scoped Debug Logs: Debug logs are scoped to their names: bin, config:mgr and commands:start.
  • Modular Architecture: Built with a modular architecture, allowing for easy customization and extension as your project grows.
  • Configuration Management: Manage your application configurations effortlessly. Customize your app's behavior by modifying the configuration settings.
  • Error Handling: Robust error handling mechanisms ensure smooth execution and graceful recovery from unexpected errors.
  • Build scripts: Integrated build scripts for easy development workflow management.
    • clean: Removes the 'dist' directory.
    • prebuild: Executes 'clean' script before the build.
    • build: Builds the application using 'tsup'.
    • preversion: Executes 'build' script before versioning.
    • postversion: Pushes tags to the repository after versioning.

🏎️ Usage

  1. Run npx setup-cli-app init. Follow the instructions. This scaffolds your project.
  2. Set your config and schema at src/config. (check schema.json) Upon building this TypeScript project, priority is given to configurations specified within the package.json file. Consequently, removing configurations from package.json will prompt the tool to adopt the new settings from the tool.config.js file.

It looks for a config file in the dir of the user who installs/uses it.

{
  // Default configuration
  "properties": {
    "port": {
      "type": "number"
    }
  }
}

Therefore, the user, who installs or utilizes the CLI tool, must include the following property within their package.json:

// package.json
"tool": {
  "port": 9999
}

In the event that it is not specified in package.json, the user must provide a separate file named tool.config.js.

  1. To see debug logs. Set a DEBUG environment variable.
  2. On bumping the package version. The project is build automatically and tags are pushed to remote repo.Or build manually with pnpm build
  3. Run with args setup-cli-app --start.

Commands

All commands are run from the root of the project, from a terminal:

| Command | Action | | :------------- | :-------------------- | | pnpm install | Installs dependencies |

Under the Hood:

  • arg: Handles command-line arguments intuitively.
  • cosmiconfig: Simplifies configuration management from various sources, including the current directory, user's home directory, and project-specific locations.
  • Ajv: Ensures robust data validation with JSON schema support.
  • better-ajv-errors: Provides clear and actionable error messages when encountering configuration issues.
  • chalk: Enhances the user experience with colorful command-line output.
  • tsup: Efficient and fast TypeScript module bundler for building your CLI app.
  • rimraf: Cross-platform utility to remove files and directories, commonly used for cleaning build artifacts before rebuilding.