Deno Command Cheatsheet
Formatting/Linting
deno fmt
Testing
Run all tests
deno test
Run specific test file
deno test ./src/main_test.ts
Run specific test case in a file
deno test ./src/main_test.ts --filter "calling logging middleware"
Dependencies
Producing a lockfile
deno cache --lock=lock.json --lock-write ./src/deps.ts
Download project dependencies from lockfile
deno cache -r --lock=lock.json ./src/deps.ts
Refetch dependencies from the network
deno run --reload ./src/main.ts
Vendoring dependencies
DENO_DIR=./deno_dir deno cache ./src/deps.ts
Running with vendored dependencies
DENO_DIR=./deno_dir deno test ./src/main.ts
Inspecting dependency tree
deno info https://deno.land/std@0.52.0/http/file_server.ts
Bundling
Bundle project in to a single file containing all dependencies
deno bundle ./src/main.ts
Debugging
Run with debugging
deno run --inspect-brk https://deno.land/std/examples/cat.ts
Permissions
Allow all filesystem access
deno run --allow-read https://deno.land/std/examples/cat.ts /etc/passwd
Allow specific filesystem access
deno run --allow-read=/etc https://deno.land/std/examples/cat.ts /etc/passwd
Allow all network access
deno run --allow-net fetch.ts
Specify network host access
deno run --allow-net=github.com,deno.land fetch.ts
Tagged
- [deno]