@nathapp/na-cli
v1.0.4
Published
The Nathapp CLI is a development utility designed to scaffold projects from templates and manage environment variable conversions between `.env` and YAML formats.
Downloads
395
Readme
Nathapp CLI (na-cli) Documentation
The Nathapp CLI is a development utility designed to scaffold projects from templates and manage environment variable conversions between .env and YAML formats.
Installation & Setup
If installed as a global package:
na --helpCommands
1. Project Generation (generate, gen)
Scaffold a new project from a pre-defined template.
Interactive Mode (Default)
Simply run the command and follow the prompts:
na genNon-Interactive / Flag Mode
You can provide answers directly via command-line flags. If both --template and --name are provided, the CLI enters Silent Mode, suppressing all interactive prompts and using professional defaults for missing values.
Common Flags:
-t, --template: Name of the template (e.g.,nestjs-api,k8s-helm-chart).-n, --name: The name of the new project folder/package.--author: Project author name (defaults tona-cli).-i, --install: (Boolean) Runnpm installafter generation. No value needed (default:false).
Template-Specific Flags:
- NestJS API (
nestjs-api):--nestjs_api_platform: Chooseexpressorfastify(default:fastify).
- Database Schema (
db-schema):--db_master: The master database name (default:master).
- K8s Helm Chart (
k8s-helm-chart):--k8s_chart_registry_host:aliyun,aws,dockerhub, orcustom.--k8s_image_name: Full image name (default:bitnami/kafka).--k8s_image_version: Version tag (default:1.0.0).--k8s_chart_kind:Deployment,StatefulSet, orCronJob(default:Deployment).--k8s_chart_registry_region: (For Aliyun/AWS) default:ap-southeast-3.--k8s_chart_aws_account_id: (For AWS) default:123456789.
Example:
na gen -t nestjs-api -n my-backend -i2. Smart Pathing (K8s)
The CLI understands the relationship between infrastructure projects and services. When generating a k8s-helm-chart inside a directory created by k8s-deployment, it will automatically detect and nest the new chart in the appropriate sub-folder:
services/charts/[name](Highest priority)resources/charts/[name]services/[name]resources/[name]
This allows you to manage modular services within a master deployment project without manually navigating to sub-folders.
3. Environment Variable Conversion
.env to YAML (env-yml)
Convert a standard dotenv file into a Nathapp-compatible YAML configuration.
na env-yml -i .env -o config.yaml-i, --input: Input path (default:.env).-o, --output: Output path (default:config.yaml).
YAML to .env (yml-env)
Convert a YAML configuration back into a standard dotenv file.
na yml-env -i config.yaml -o .env-i, --input: Input path (default:config.yaml).-o, --output: Output path (default:.env).
Available Templates
The CLI currently supports the following project types:
db-schema: Database migration and schema projects.k8s-deployment: Basic Kubernetes manifests.k8s-helm-chart: Comprehensive Helm chart bootstrapping.mxw-base-api-express: Express-based API boilerplate.ts-library: TypeScript library project.nestjs-api: Professional NestJS setup with platform choices.vuexy-portal: Frontend portal based on the Vuexy template.
