CLI tool for creating route segments in NextJs projects.
Run the command at the root of your project.
npx next-dir [directory-name]
Or if you prefer installing it globally
npm i -g next-dir
next-dir [directory-name]
This command will create a directory with the following files inside the app directory.
├── page.tsx
├── layout.tsx
└── loading.tsx # Optional, specify using the --lg flag
-
directory-name
: Defines the folder name. -
--lg
: Optional flag for includingloading.tsx
file.