Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix D — Command Cheat Sheet: dotnet CLI to npm/pnpm/gh/nest CLI

Commands are organized by category. The third column flags gotchas or behavioral differences worth noting. All pnpm commands assume a pnpm-workspace.yaml monorepo unless noted.


Project Management

dotnet CLIJS/TS EquivalentNotes
dotnet new console -n MyAppmkdir my-app && cd my-app && pnpm initNo single scaffold command for plain Node. Use tsx src/index.ts to run TS directly.
dotnet new webapi -n MyApipnpm dlx @nestjs/cli new my-apiCreates a full NestJS project with module/controller/service scaffold.
dotnet new react -n MyApppnpm create vite my-app -- --template react-tsVite is the standard React scaffold. create-next-app for full-stack.
dotnet new nextjspnpm dlx create-next-app@latest my-appPrompts for TypeScript, Tailwind, App Router, src directory.
dotnet new nuxtpnpm dlx nuxi@latest init my-appOfficial Nuxt scaffold CLI.
dotnet new sln -n MySolutionpnpm-workspace.yaml (manual creation)Add workspace globs: packages: ['apps/*', 'packages/*'].
dotnet sln add MyProjectAdd path to pnpm-workspace.yaml packages globNo CLI command — edit the YAML file directly.
dotnet sln remove MyProjectRemove path from pnpm-workspace.yamlEdit the YAML file directly.
dotnet new gitignorenpx gitignore nodeUses the gitignore npm package to fetch GitHub’s official .gitignore template.
dotnet new editorconfigCopy .editorconfig from templateNo scaffold command. ESLint + Prettier replace most EditorConfig concerns in JS.
nest new project-namepnpm dlx @nestjs/cli new project-nameNestJS equivalent of dotnet new webapi. Prompts for package manager.
nest generate module usersnest g module usersGenerates users.module.ts and updates app.module.ts.
nest generate controller usersnest g controller usersGenerates controller with route stubs and test file.
nest generate service usersnest g service usersGenerates injectable service and test file.
nest generate resource usersnest g resource usersGenerates full CRUD module: module, controller, service, DTOs, entity. Closest to dotnet scaffold.
nest generate middleware loggernest g middleware loggerGenerates NestJS middleware class.
nest generate guard authnest g guard authGenerates a NestJS guard (equivalent of ASP.NET Core authorization policy).
nest generate interceptor loggingnest g interceptor loggingGenerates a NestJS interceptor (equivalent of ASP.NET Core action filters).
nest generate pipe validationnest g pipe validationGenerates a NestJS pipe (equivalent of model binders + validators).

Building

dotnet CLIJS/TS EquivalentNotes
dotnet buildpnpm buildRuns the build script in package.json. Typically tsc for libraries, vite build for frontends.
dotnet build --configuration ReleaseNODE_ENV=production pnpm buildSet NODE_ENV before the build command. Vite and Next.js tree-shake based on this.
dotnet build --no-restorepnpm build (install is separate)In JS, restore (install) and build are always separate commands.
dotnet publishpnpm build then deploy artifactNo single “publish” command. Build outputs dist/ or .next/. Deploy from there.
dotnet publish -c Release -o ./outpnpm build && cp -r dist/ out/Configure output directory in vite.config.ts (build.outDir) or tsconfig.json (outDir).
dotnet cleanrm -rf dist .next .nuxt node_modules/.cacheNo single clean command. Add a clean script to package.json: "clean": "rimraf dist .next".
tsc (TypeScript compiler)pnpm tsc or pnpm exec tsctsc --noEmit for type-checking only without producing output.
tsc --watchpnpm tsc --watchType-checks incrementally on file change.
dotnet formatpnpm lint:fix + pnpm formatESLint with --fix for lint errors; Prettier for formatting. These are separate tools in JS.
(MSBuild target)package.json scripts sectionThe scripts block in package.json is the equivalent of MSBuild targets.

Testing

dotnet CLIJS/TS EquivalentNotes
dotnet testpnpm testRuns the test script. Typically vitest run or jest under the hood.
dotnet test --watchpnpm test --watch or vitestVitest interactive watch mode: vitest (no flags). Re-runs affected tests on change.
dotnet test --filter "TestName"vitest run --reporter=verbose -t "test name"-t filters by test name string or regex. Also: vitest run path/to/file.test.ts.
dotnet test --filter "Category=Unit"vitest run --project unitVitest workspaces allow named projects with separate configs.
dotnet test --collect:"Code Coverage"vitest run --coverageRequires @vitest/coverage-v8 or @vitest/coverage-istanbul installed.
dotnet test --logger "trx"vitest run --reporter=junitJUnit XML output for CI integration. Configure in vitest.config.ts.
dotnet test -vvitest run --reporter=verboseShows individual test names and results.
xunit [Fact]it('...', () => {})Single test case.
xunit [Theory][InlineData]it.each([...])('...', (...) => {})Parameterized tests.
xunit [BeforeAfterTest]beforeEach() / afterEach()Setup/teardown hooks.
Mock<T>() (Moq)vi.fn() / vi.mock('module')vi.fn() creates a spy. vi.mock() replaces an entire module with mocks.
new InMemoryDbContext()In-memory SQLite / prisma.$use() middleware mockPrisma has no official in-memory mode. Use SQLite with Prisma for integration tests.
dotnet test --no-buildvitest run --no-run-all-specsNot a direct equivalent. Vitest does not require a prior build step — it uses Vite’s transform pipeline.
(Playwright) dotnet playwright testpnpm exec playwright testRuns E2E tests. Configure in playwright.config.ts.
playwright codegen https://urlpnpm exec playwright codegen https://urlRecords a browser session and generates test code.
playwright show-reportpnpm exec playwright show-reportOpens the HTML test report in the browser.

Package Management

dotnet CLIJS/TS EquivalentNotes
dotnet restorepnpm installInstalls all dependencies declared in package.json.
dotnet add package Newtonsoft.Jsonpnpm add package-nameAdds to dependencies in package.json.
dotnet add package --version 13.0.1pnpm add package-name@13.0.1Pin exact version with @version.
dotnet add package xunit (dev dep)pnpm add -D package-name-D adds to devDependencies. Dev deps are not installed in production builds.
dotnet remove package Newtonsoft.Jsonpnpm remove package-nameRemoves from package.json and updates lockfile.
dotnet list packagepnpm listLists installed packages. Add --depth Infinity for the full tree.
dotnet list package --outdatedpnpm outdatedLists packages with newer versions available.
dotnet list package --vulnerablepnpm auditChecks for known CVEs. Also run snyk test for deeper SCA.
dotnet update packagepnpm updateUpdates all packages to latest within declared ranges.
dotnet update package PackageNamepnpm update package-nameUpdates a single package.
(NuGet pack)pnpm packCreates a .tgz tarball of the package for publishing.
(NuGet push)pnpm publishPublishes the package to npm. Requires --access public for scoped packages.
dotnet tool install -g dotnet-efpnpm add -g @nestjs/cliGlobal tool install. Note: prefer pnpm dlx for one-off tool use to avoid global pollution.
(workspace reference)pnpm add @myorg/shared --workspaceAdds a local workspace package as a dependency using workspace:* protocol.
dotnet new nuget.config.npmrc filePer-project npm configuration: registry, auth tokens, workspace settings.

Database / Migrations

Prisma

dotnet CLI / EF CorePrisma EquivalentNotes
dotnet ef migrations add InitialCreatepnpm prisma migrate dev --name initial-createCreates a new migration file in prisma/migrations/. Also applies it in dev.
dotnet ef database updatepnpm prisma migrate deployApplies pending migrations. Use in CI/CD and production — does not prompt.
dotnet ef migrations removepnpm prisma migrate resetResets dev DB and re-applies all migrations. Destructive — dev only.
dotnet ef database droppnpm prisma migrate resetDrops and recreates the database in dev.
dotnet ef dbcontext scaffoldpnpm prisma db pullIntrospects existing database and generates schema.prisma.
(generate client)pnpm prisma generateRegenerates the Prisma Client after schema changes. Required after every schema.prisma edit.
(open database browser)pnpm prisma studioOpens Prisma Studio GUI at localhost:5555.
(seed database)pnpm prisma db seedRuns the seed script defined in package.json under prisma.seed.
dotnet ef migrations listpnpm prisma migrate statusShows applied and pending migrations.
(validate schema)pnpm prisma validateChecks schema.prisma for syntax and relation errors.
(format schema)pnpm prisma formatAuto-formats schema.prisma.

Drizzle ORM

dotnet CLI / EF CoreDrizzle EquivalentNotes
dotnet ef migrations addpnpm drizzle-kit generateGenerates SQL migration files from schema changes. Does not apply them.
dotnet ef database updatepnpm drizzle-kit migrateApplies pending generated migration files to the database.
dotnet ef dbcontext scaffoldpnpm drizzle-kit introspectGenerates Drizzle schema TypeScript file from existing database.
(push schema without migration)pnpm drizzle-kit pushPushes schema directly to DB without migration files. Dev/prototyping only.
(open database browser)pnpm drizzle-kit studioOpens Drizzle Studio GUI.

Running & Debugging

dotnet CLIJS/TS EquivalentNotes
dotnet runpnpm devStarts the dev server with hot reload. Typically vite, next dev, nuxt dev, or nest start --watch.
dotnet run --project MyApipnpm --filter my-api devIn a pnpm monorepo, --filter targets a specific workspace package.
dotnet run --launch-profile httpspnpm dev --httpsFramework-dependent. Vite: add server.https to vite.config.ts. Next.js: --experimental-https.
dotnet watch runpnpm dev (already watching)Dev servers in JS watch by default. No separate watch subcommand needed.
dotnet run --environment ProductionNODE_ENV=production node dist/main.jsSet NODE_ENV and run the compiled output. Never use ts-node in production.
(attach debugger)node --inspect dist/main.jsOpens a Chrome DevTools debugging port. VS Code Node debugger attaches via launch.json.
dotnet run --urls https://localhost:7001PORT=7001 pnpm devMost dev servers read PORT from env. NestJS: app.listen(process.env.PORT ?? 3000).
(REPL)node / ts-node / tsxInteractive REPL. tsx runs TypeScript directly without a compile step.
(environment variables).env file + dotenv / t3-envdotenv is loaded explicitly in Node. Next.js and Nuxt load .env automatically.

Deployment

dotnet CLIJS/TS EquivalentNotes
dotnet publish -c Releasepnpm buildProduces the deployable artifact. For Node services: compiles TS to dist/.
(Docker build)docker build -t my-app .Write a Dockerfile. Use multi-stage builds: install deps, build, copy dist/ to final image.
(Docker run)docker run -p 3000:3000 my-appMap container port to host port.
(Azure deploy)gh workflow run deploy.ymlTrigger a GitHub Actions deployment workflow.
(Render deploy)Automatic on git push to mainRender detects pushes via GitHub webhook and deploys automatically if configured.
(environment config)Set env vars in Render dashboard / GitHub SecretsNever ship .env files. Use platform environment variable management.
(health check endpoint)GET /health routeNestJS: @nestjs/terminus for health checks. Next.js: app/api/health/route.ts.
(rollback)git revert HEAD && git push / Render manual rollbackRender retains previous deploys and supports one-click rollback via the dashboard.

Git & Version Control

dotnet CLI / VS toolinggh CLI / git EquivalentNotes
(clone repo)gh repo clone owner/repoClones and sets upstream automatically.
(create repo)gh repo create my-repo --publicCreates on GitHub and clones locally.
(create PR)gh pr create --title "..." --body "..."Opens a PR from the current branch to the base branch.
(view PRs)gh pr listLists open PRs for the current repo.
(checkout PR)gh pr checkout 123Checks out a PR branch locally by PR number.
(view PR status)gh pr view 123Shows PR details, checks, and review status.
(merge PR)gh pr merge 123 --squashMerges with squash strategy. Also --merge or --rebase.
(create issue)gh issue create --title "..." --body "..."Creates a GitHub issue from the CLI.
(view issues)gh issue listLists open issues. Add --assignee @me to filter.
(view CI checks)gh run listLists recent GitHub Actions workflow runs.
(view run logs)gh run view <run-id> --logStreams the log of a specific Actions run.
(re-run failed CI)gh run rerun <run-id> --failedRe-runs only the failed jobs in a workflow run.
(release tag)gh release create v1.0.0 --generate-notesCreates a GitHub Release with auto-generated changelog from merged PRs.
(browse repo)gh browseOpens the current repo in the browser.
(set secret)gh secret set MY_SECRETSets a GitHub Actions repository secret. Prompts for value.

Monorepo-Specific pnpm Commands

TaskCommandNotes
Run script in all packagespnpm -r run build-r (recursive) runs in every workspace package.
Run script in one packagepnpm --filter my-api run build--filter targets by package name from package.json.
Run script in changed packagespnpm --filter '...[HEAD~1]' run testOnly packages changed since the last commit. Requires Turborepo or manual setup.
Install dep in one packagepnpm --filter my-api add expressAdds to the specific package, not the root.
Install dep in rootpnpm add -w typescript-w (workspace root) installs at the monorepo root level.
List all workspace packagespnpm ls -r --depth -1Lists all declared workspace packages.
Run with Turborepopnpm turbo run buildTurborepo adds dependency graph-aware caching and parallelism to pnpm workspaces.

Miscellaneous / Environment

dotnet CLIJS/TS EquivalentNotes
dotnet --versionnode --version / pnpm --versionCheck runtime and package manager versions.
dotnet --list-sdksnvm list / fnm listfnm (Fast Node Manager) manages Node versions. Similar to nvm but faster.
dotnet new --listpnpm dlx create-next-app --helpNo unified template list. Each framework has its own scaffold CLI.
dotnet nuget sources.npmrc registry configurationSet registry=https://registry.npmjs.org/ or a private registry URL in .npmrc.
dotnet dev-certs httpsmkcert localhostmkcert generates locally-trusted TLS certificates for development.
dotnet user-secrets set.env.local fileNext.js loads .env.local automatically and git-ignores it by convention.
dotnet format --verify-no-changespnpm lint && pnpm format --checkUsed in CI to assert code is formatted. Prettier’s --check flag exits non-zero if changes needed.
dotnet ef --helppnpm prisma --help / pnpm drizzle-kit --helpTop-level help for the ORM CLI tool.

Quick Reference: Script Conventions in package.json

The following script names are conventional — not enforced — but used consistently across the ecosystem.

Script NameTypical Commanddotnet Analog
devvite / next dev / nest start --watchdotnet watch run
buildtsc / vite build / next builddotnet build -c Release
startnode dist/main.js / next startdotnet run (production)
testvitest run / jestdotnet test
test:watchvitestdotnet test --watch
test:e2eplaywright testdotnet test (Playwright)
linteslint src/(Roslyn analyzers)
lint:fixeslint src/ --fixdotnet format
formatprettier --write .dotnet format
format:checkprettier --check .dotnet format --verify-no-changes
typechecktsc --noEmit(implicit in dotnet build)
db:generateprisma generate / drizzle-kit generate(no analog)
db:migrateprisma migrate dev / drizzle-kit migratedotnet ef database update
db:studioprisma studio / drizzle-kit studio(no analog — use SSMS / Azure Data Studio)
db:seedtsx prisma/seed.ts(custom EF Core seed method)
cleanrimraf dist .nextdotnet clean

Last updated: 2026-02-18