@infinum/plop-next-ts-generators

1.0.3 • Public • Published

Plop Next.js Generators

Installation

Install dependencies:

npm add plop @infinum/plop-next-ts-generators -D

Create plopfile.js in the root of your project:

touch plopfile.js

Register generators:

const init = require('@infinum/plop-next-ts-generators');

/**
 * @param {import("plop").NodePlopAPI} plop
 */
module.exports = function main(plop) {
  init(plop, { 
    // Base source code folder, defaults to `./src` but you can set it to `./`
    // baseUrl: './src',

    // For changing components folder URL or name, defaults to `./components` but you can set it to `./components/ui`
    // componentsUrl: './components'
  });
};

Add scripts to your package.json:

{
  "scripts": {
    "gen:component": "plop component",
    "gen:theme": "plop theme"
  }
}

ESLint note

You'll probably need to add this to your tsconfig.json file:

  "include": [
    "plopfile.js",
  ]

Component generator

To generate a new component, run the following command:

npm run gen:component

Theme generator

To generate a new theme, run the following command:

npm run gen:theme

Package Sidebar

Install

npm i @infinum/plop-next-ts-generators

Weekly Downloads

140

Version

1.0.3

License

MIT

Unpacked Size

55.4 kB

Total Files

43

Last publish

Collaborators

  • safo6m
  • fvoska
  • darkokukovec
  • infinumcom