@rtw_np/dash-cli
v0.0.2
Published
CLI tool for scaffolding Next.js dashboard templates with MUI
Readme
dash-cli
CLI for scaffolding Next.js dashboard projects with MUI, then generating resource pages (list, add-new, edit) from in-project sample templates.
Features
- Initialize a dashboard project from a local template folder or remote git template
- Generate list pages with table/filter wrappers
- Generate add-new pages with form wrappers
- Generate edit pages with form wrappers and dynamic
[id]route - Name conversion built in (
user-profile->UserProfile,userProfile,user-profile)
Requirements
- Node.js 18+
- npm
git(only required when using a remote template source)
Install
Install from npm
npm install -g @rtw_np/dash-cliThen run:
dash-cli --helpUsage
dash-cli <command> [options]Commands
init
Initialize a new dashboard project.
dash-cli initOptions:
-t, --template <url>: Use a remote git repo URL as template source-l, --local <path>: Use a local template directory path
Examples:
# interactive project name prompt
dash-cli init
# clone from remote template
dash-cli init --template https://github.com/your-org/your-template-repo.git
# copy from local template folder
dash-cli init --local ../rtw_dashBehavior notes:
- Prompts for
Project name(default:my-dashboard) - Accepts
.to scaffold into the current directory - If target exists and is non-empty, prompts for confirmation before overwrite
- For remote templates,
.gitis removed after clone - For local templates,
.gitandnode_modulesare skipped during copy
add:list <name>
Add a list page and corresponding template wrapper files.
dash-cli add:list userCreates:
src/components/templates/<PascalName>List/src/app/<kebab-name>/page.tsx
add:new <name>
Add a create page and corresponding template wrapper files.
dash-cli add:new userCreates:
src/components/templates/<PascalName>AddNew/src/app/<kebab-name>/add-new/page.tsx
add:edit <name>
Add an edit page and corresponding template wrapper files.
dash-cli add:edit userCreates:
src/components/templates/<PascalName>Edit/src/app/<kebab-name>/edit/[id]/page.tsx
Important Project Structure Assumptions
add:* commands must be run inside an initialized project that contains:
package.jsonsrc/components/src/components/sample-templates/with:SampleResourceListSampleResourceAddNewSampleResourceEdit
If these sample template folders are missing, generation fails.
Template Source Configuration
Default template source behavior is configured in src/commands/init.ts:
TEMPLATE_SOURCETEMPLATE_LOCAL_PATHTEMPLATE_REPO_URL
Precedence order at runtime:
--local--templateTEMPLATE_SOURCEdefaults
Development
npm install
npm run devBuild:
npm run buildRun tests:
npm testLicense
ISC
