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

@iamendor/next-cli

v1.0.9

Published

A powerful CLI to create Next.js templates

Downloads

8

Readme

Next.js CLI

A powerful CLI to create Next.js templates

Version: 1.0.8

I created this tool, because my stack is Nest.js and Next.js, and I wanted to create a CLI tool for Next.js like Nest. Currently works as a standalone package, but I am planning to integrate the official next cli into this tool.

Documentation

Installation

npm install -g @iamendor/next-cli

Quick start

You can create a configuration file to configure the cli.

next init config

The CLI does not require to use the configuration file, but I recommend to configure it per project to configure the extension, styling and etc. See the example configuration file here.

Commands

Init

Config

Initialize configuration file

Generate

Generate Next.js templates, in every subcommand you have to specify a path and also you can specify extension, if you specify it in the command line, the configuration file arguments will be overriden. If you want to use typescript, specify --ts flag in command route and middleware or --tsx in command module, page, loading, error, layout, notfound and component

Module

next generate module <path>

Generate a Next.js module, this includes a page, loading, error, and not found pages, you can also include a layout file, creates a style file for every file.

Flags
  • --layout - create layout file
  • --error, --no-error - create error file
  • --loading, --no-loading - create loading file
  • --not-found, --no-not-found - create not found file
  • --style, --no-style - specify style files, available options: css, scss, or if you want to use tailwind specify --no-style flag, you can also specify --scss flag to use scss as styling
  • --merge-styles - create one style file
  • --type - specify the route type, available options: default, dynamic, parallel, intercepting, if you want to create these type of route specify it in the flag, do not use in the path, it gives an error, this can be a future feature. You can also specify it with prefixed flags like --dynamic, --parallel, --intercepting
  • --level - if you use --intercepting flag, specify the level of the interception, available options: 0, 1, 2, root

Page

next generate page <path>

Generate a page file

Flags

Layout

next generate layout <path>

Generate a layout file

Flags

Error

next generate error <path>

Generate an error file

Flags

Loading

next generate loading <path>

Generate an loading file

Flags

Not found

next generate notfound <path>

Generate a not found file

Flags

Component

next generate component <path>

Generate a component file, unlike the router components, this file is generated by the last part of the path, so if you provide g c foo/bar, this creates foo/Bar.jsx

Flags
  • --style, --no-style - see in module command
  • --type - see in module

Route

next generate route <path>

Generate a route file

Flags
  • --type - see in module, available options: default, dynamic, flag --dynamic is also available
  • --handlers - List of handlers to create, available options: GET, POST, PUT, PATCH, DELETE. You can also specify --GET, --POST flags to add these handlers
  • --single-handler - Create a global handler for route

Middleware

next generate middleware <path>

Generate a middleware file

Flags
  • --matcher - specify matcher for the middleware, see the usage here
  • --global - make the middleware global

Credits

iamendor