nest-rs-cli 0.2.1

Scaffolding CLI for nestrs — new projects, feature generators, and project health checks.
//! Files shared by standalone and workspace scaffolds (env cascade, gitignore, …).

pub const RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "1.95"
"#;

/// `db.just` — shipped in every project so the database verbs are present from
/// day one, whether or not the project has a database yet. Recipes follow the
/// nestrs convention: a `migrations` crate (the `migrate` bin) and a `seed` crate.
/// They start working once you add those — see the database docs.
pub const DB_JUSTFILE: &str = r#"# Database lifecycle, exposed as `nestrs run db <verb>` (see `mod db` in the
# Justfile). Recipes assume the nestrs `migrations` + `seed` crates.

# Bare `nestrs run db` lists these instead of running the first recipe.
_default:
    @just --list db

# Apply all pending migrations.
up:
    cargo run -p migrations --bin migrate -- up

# Roll back the last applied migration.
down:
    cargo run -p migrations --bin migrate -- down

# Drop every table and re-apply all migrations from scratch.
fresh:
    cargo run -p migrations --bin migrate -- fresh

# Show which migrations are applied vs. pending.
status:
    cargo run -p migrations --bin migrate -- status

# Seed demo data (idempotent).
seed:
    cargo run -p seed --bin seed

# Clean slate: drop, re-migrate, then reseed.
reset: fresh seed
"#;

pub const GITIGNORE: &str = r#"/target
**/*.rs.bk

# Coverage (cargo-llvm-cov)
*.profraw
*.profdata
/coverage

# Local secrets (see `.env.example`)
.env.local
.env.*.local

# Editor / OS
.idea/
*.swp
.DS_Store
"#;

pub const DOCKERIGNORE: &str = r#"target/
.git/
.env.local
.env.*.local
"#;

pub const ENV: &str = r#"# {{env_label}} — committed base config (`.env` cascade).
#
# Only overrides live here; omitted keys use in-code defaults. Real environment
# variables always win. Per-machine secrets go in `.env.local` (git-ignored);
# see `.env.example`.
#
# Precedence (highest first):
#   real env  >  .env.<NESTRS_ENV>.local  >  .env.local  >  .env.<NESTRS_ENV>  >  .env

# HTTP server listen port (default: 3000).
NESTRS_HTTP__PORT=3000
"#;

/// Workspace root `.env` — no HTTP port; each app pins its port in `module.rs`.
pub const ENV_WORKSPACE: &str = r#"# {{env_label}} — committed base config (`.env` cascade).
#
# HTTP listen ports live in each app's root `module.rs`
# (`HttpConfig { port: …, ..Default::default() }`), not here.
#
# Precedence (highest first):
#   real env  >  .env.<NESTRS_ENV>.local  >  .env.local  >  .env.<NESTRS_ENV>  >  .env
"#;

pub const ENV_DEVELOPMENT: &str = r#"# {{env_label}} — development-only overrides (NESTRS_ENV=development, the default).
# Committed; layered on top of `.env`, below `.env.local` and the real environment.

# Verbose, human-readable logs while developing.
NESTRS_OPENTELEMETRY__LOG_LEVEL=debug
NESTRS_OPENTELEMETRY__LOG_FORMAT=text
"#;

pub const ENV_EXAMPLE: &str = r#"# Copy to `.env.local` for machine-specific or secret-shaped settings:
#
#   cp .env.example .env.local
#
# Uncomment when you add a database (https://nestrs.dev/configuration/).

# NESTRS_DATABASE__URL=postgres://user:pass@localhost:5432/{{kebab}}
# NESTRS_QUEUE__URL=redis://localhost:6379
"#;