@nl-framework/cli
v0.3.5
Published
Command-line interface for generating Bun-native Nael Framework projects.
Readme
@nl-framework/cli
A Bun-native command-line interface for scaffolding Nael Framework services, feature modules, controllers, services, resolvers, models, and shareable libraries.
Usage
After building or installing the package, you can run the following commands:
Create a service
nl new my-serviceGenerates a new project in ./my-service with Bun scripts, TypeScript configuration, a starter HTTP controller, and a sample scheduler provider ready to customize. By default the CLI avoids overwriting existing files; use --force to permit regenerating files and --install to automatically run bun install.
Generate a feature module
nl g module usersCreates src/modules/users in the current workspace, including a UsersModule class, placeholder folders for controllers/services/resolvers/models, and an export entry in src/modules/index.ts. Use --force to regenerate an existing module directory.
Generate a service
nl g service users --module usersGenerates src/modules/users/services/users.service.ts, wires the service into the module's providers array, and re-exports it via src/modules/users/index.ts. Use --module (or -m) to target the destination module.
Generate a controller
nl g controller users --module usersCreates src/modules/users/controllers/users.controller.ts, registers the controller with the module, and exports it. Adjust the generated routes and inject services as needed.
Generate a resolver
nl g resolver users --module usersProduces src/modules/users/resolvers/users.resolver.ts, adds the resolver to the module providers, and re-exports it from src/modules/users/index.ts. Extend the resolver with fields, queries, or mutations and inject services as required.
Generate a model
nl g model user --module usersCreates src/modules/users/models/user.model.ts with a default id field decorated for GraphQL, adds an index export in src/modules/users/models/index.ts, and leaves the module primed for further field additions.
Generate a shared library
nl g lib shared-utilsCreates ./libs/shared-utils with a TypeScript-ready build, README, and an initial feature module (exported via src/modules/index.ts). Pass --force to overwrite existing files if the directory is not empty.
Development
bun install
bun run --cwd packages/cli dev -- --help
bun run --cwd packages/cli buildThe build command compiles TypeScript output to dist/ so the nl binary can be executed directly.
