2020-03-12 19:33:59 -04:00
|
|
|
# deno
|
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
> A secure runtime for JavaScript, TypeScript, and WebAssembly.
|
|
|
|
> Includes dependency management using `npm` or `jsr`, and tooling like bench, bundle, doc, and coverage.
|
|
|
|
> More information: <https://docs.deno.com/runtime/reference/cli>.
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
- Start a REPL (interactive shell, also known as Read-Eval-Print Loop):
|
|
|
|
|
|
|
|
`deno`
|
|
|
|
|
|
|
|
- Start a new project named sample and test it:
|
|
|
|
|
|
|
|
`deno init sample && cd sample && deno test`
|
|
|
|
|
|
|
|
- Run a file securely. It will ask (if needed) to allow net, read, etc:
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2021-02-18 08:07:05 -05:00
|
|
|
`deno run {{path/to/file.ts}}`
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
- Run a file with explicit permissions or allow all (only if you trust the source):
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
`deno run {{[--allow-env|--allow-net|--allow-write|--allow-all]}} {{jsr:@deno/deployctl}}`
|
|
|
|
|
|
|
|
- List and run tasks from `deno.json` or scripts from `package.json`:
|
|
|
|
|
|
|
|
`deno task`
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
- Install dependencies listed in `deno.json` or `package.json` (also lock files):
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
`deno install`
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
- Check types, format, and lint (fix if possible):
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
`deno check && deno fmt && deno lint --fix`
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
- Compile the script, imported dependencies, and runtime into a self contained executable:
|
2020-03-12 19:33:59 -04:00
|
|
|
|
2025-07-11 16:58:06 -03:00
|
|
|
`deno compile {{path/to/file.ts}}`
|