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

next-utils-cli

v2.0.0

Published

Streamline route, page, and component creation in the new Next.js App router with the next-utils CLI tool.

Downloads

234

Readme

Next Utils CLI

Test GitHub license

Next Utils CLI is a command-line tool exclusively designed for the new Next.js App router, streamlining the creation of routes, pages, components, and server actions in your Next.js application. It also allows you to clean up the boilerplate code from the home page and initialize a configuration file.

Features

  • Quickly generate Next.js routes, pages, components, and server actions.
  • Create routes with various HTTP methods (GET, POST, PUT, PATCH, DELETE, OPTIONS).
  • Choose between different function types for components.
  • Option to opt in to client rendering for components and pages.
  • Easily customize the path and name for your files.
  • Recursive directory creation for an organized codebase.
  • Initialize a project-specific configuration file with the init command.
  • Clean up the boilerplate code from the home page with the clean-home-page command.
  • Server action generation for enhanced server-side capabilities.

Installation

You can install Next Utils CLI globally using npm:

npm install -g next-utils-cli

Usage

To use Next Utils CLI, simply run the desired command:

next-utils page
next-utils route
next-utils component
next-utils clean-home-page
next-utils init
next-utils action

Available Commands

page

Generate a new page in the App router.

route

Generate a new route in the App router. Allows selecting multiple HTTP methods.

component

Generate a new component with options to customize the type and rendering mode.

clean-home-page

Removes boilerplate code from the default Next.js home page.

init

Creates a next-utils-cli.json configuration file in the root of your project. This file will store your project-specific preferences for page, route, and component commands.

action

Generate a new server action file to handle server-side logic seamlessly.

Additional Information

  • Configuration: Run the init command to generate a next-utils-cli.json file, which stores your project preferences, making subsequent commands faster and more consistent.
  • Component & Page Options: Choose between arrow function and function declaration styles.
  • Route Flexibility: Specify HTTP methods when creating a route.
  • Conflict Handling: Prompts you before overwriting existing directories or files.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributions

Contributions are welcome! If you have ideas for improvements or encounter issues, please open an issue or submit a pull request.

How to Contribute

  1. Fork the Repository: Click the "Fork" button on the GitHub page to create your copy of the project.

  2. Clone Your Fork: In your terminal, run the following command, replacing [your-username] with your GitHub username:

    git clone https://github.com/[your-username]/next-utils-cli.git
  3. Install Dependencies:

    npm install
  4. Make Changes: Create a new branch for your changes, make improvements or fixes, and commit your work:

    git checkout -b my-fix
    # or
    git switch -c my-fix
  5. Run the Project:

Run the following command to make sure project is running properly:

npm run next-utils -- -h

If you want to test in another directory:

npm run build test

npm link

# In your test directory
npm link next-utils-cli

# Then run the command
next-utils [command]
  1. Add Tests (if necessary) and Run Them:

    npm run test
  2. Push Your Changes to GitHub: Commit your changes and push them to GitHub. Then, open a pull request against the main branch.

    git add .
    git commit -m "Fix: Describe your fix or feature"

Links

TODO

  • [ ] Add examples to README.md