@melodicdev/cli
v1.2.3
Published
Scaffolding and code generation for Melodic apps and monorepos.
Maintainers
Readme
Melodic CLI
A lightweight scaffolding and code generation tool for Melodic apps and monorepos.
Install
npm install -g @melodicdev/cli
melodic --helpLocal dev build:
npm --workspace @melodicdev/cli run build
node packages/cli/dist/index.js --helpQuick Start
melodic init my-app
cd my-app
npm install
npm run devCommands
melodic init <directory> [--monorepo] [--app-name <name>]
Create a new Melodic project.
Single app:
melodic init my-appMonorepo with
apps/andlibs/:melodic init my-repo --monorepo --app-name webUses
tsconfig.build.jsonfortsc -bbuilds and keeps references updated when you runmelodic add app/lib.Apps generated by the CLI set
build.targettoes2022in Vite so top-level await works in production builds.
melodic create is an alias of melodic init.
melodic add app <name> [--dir apps]
Add a new app folder (useful inside a monorepo).
melodic add app admin
melodic add app marketing --dir appsmelodic add lib <name> [--dir packages]
Add a new shared library folder.
melodic add lib shared
melodic add lib ui --dir packagesmelodic add testing [--path .]
Add a basic Vitest + happy-dom test setup to an existing project.
melodic add testing --path apps/webmelodic generate component <name> [--path src/components]
Create a component with .component.ts, .template.ts, and .styles.ts.
melodic generate component user-card
melodic generate component user-card --path apps/web/src/componentsmelodic generate directive <name> [--path src/directives]
Create a template directive.
melodic generate directive auto-focusmelodic generate attribute-directive <name> [--path src/directives]
Create and register an attribute directive.
melodic generate attribute-directive tooltipmelodic generate service <name> [--path src/services]
Create an injectable service.
melodic generate service authmelodic generate interceptor <name> [--path src/http/interceptors]
Create HTTP request/response interceptors.
melodic generate interceptor authmelodic generate class <name> [--path src]
Create a plain TypeScript class.
melodic generate class user
melodic generate class user --path src/modelsTemplates
The CLI uses built-in templates and replaces placeholders automatically:
app-basic: single app scaffoldmonorepo-basic: repo withapps/+packages/and a default applib-basic: minimal shared library scaffold
Template notes:
- App templates include
vite-plugin-melodic-styles.ts, asrc/styles/global.csssample, and a<link melodic-styles>entry inindex.html.
Placeholders:
__APP_NAME____REPO_NAME____LIB_NAME__
Behavior Notes
- The CLI writes files only if the target directory is empty.
- Existing files are never overwritten.
- Use
--pathand--dirto target specific subfolders.
