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

nextjs14-plop-templates

v1.0.3

Published

Plop templates for Next.js 14, supporting both TypeScript and JavaScript.

Downloads

11

Readme

Next.js Plop Templates

npm version

Plop templates for Next.js 14 , supporting both TypeScript and JavaScript.

Features

  • Templates for React components
  • Templates for Next.js API routes
  • Templates for Next.js pages
  • Support for both TypeScript and JavaScript
  • Dynamic route generation
  • Customizable component structure (atoms, molecules, organisms)

Installation

First, ensure you have Plop installed:

npm install --save-dev plop

Then, install this package in your project:

npm install --save-dev nextjs14-plop-templates

Usage

  1. Create a plopfile.js in your project root if you don't already have one.

  2. Add the following to your plopfile.js:

const nextjsGenerators = require("nextjs14-plop-templates");

module.exports = function (plop) {
  nextjsGenerators(plop);
};
  1. Run Plop in your terminal:
npm run plop
  1. Choose the generator you want to use:

    • Component
    • API
    • Page
  2. Follow the prompts to generate your files.

Compatibility

This package is compatible with:

  • Next.js 14
  • Next.js 15

The templates and generators provided by this package are designed to work with Next.js 14 and 15. They should continue to function correctly unless there are significant structural changes in future Next.js releases.

Generators

Component Generator

Creates a new React component.

Options:

  • Component name
  • Component type (atom, molecule, organism, or none)
  • TypeScript or JavaScript

Example output:

import { ReactElement } from "react";

type ButtonProps = {};

const Button = ({}: ButtonProps): ReactElement => {
  return <div>Button</div>;
};

export default Button;

API Route Generator

Creates a new Next.js API route.

Options:

  • Route name
  • HTTP methods (GET, POST, PUT, DELETE)
  • Dynamic routes

Example output (with dynamic route "id"):

import { NextRequest, NextResponse } from "next/server";

export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
  const id = params.id;
  // Your GET logic here
  return NextResponse.json({ message: `GET request for id: ${id}` });
}

export async function POST(request: NextRequest, { params }: { params: { id: string } }) {
  const id = params.id;
  // Your POST logic here
  return NextResponse.json({ message: `POST request for id: ${id}` });
}

// Add other methods (PUT, DELETE) as needed

Page Generator

Creates a new Next.js page.

Options:

  • Page name
  • Dynamic routes

Example output:

import { ReactElement } from "react";

export default function Page(): ReactElement {
  return (
    <div>
      <h1>Hello World</h1>
    </div>
  );
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.