Skip to content

Commit 96709ff

Browse files
authored
docs: deduplicate guide and reference content for the runtime docs (#3212)
1 parent 45038d2 commit 96709ff

11 files changed

Lines changed: 111 additions & 196 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,17 @@ files in their respective content directories.
134134
Static files (like screenshots) can be included directly in the `runtime`,
135135
`deploy`, or `kv` folders, and referenced by relative URLs in your markdown.
136136

137+
### Guides teach, reference enumerates
138+
139+
A topic's depth lives in exactly one place. Guide pages (like `/runtime/test/`
140+
or `/runtime/packages/`) teach the opinionated path with minimal flags and link
141+
out for detail; reference pages (under `/runtime/reference/`) enumerate every
142+
flag, field, and option exhaustively. Don't repeat flag or option documentation
143+
in a guide: link to the reference instead. A guide may include at most one
144+
summary table when it links to the full reference. When the same material exists
145+
in both kinds of page, move the depth to the reference and keep the narrative in
146+
the guide.
147+
137148
## Reference docs
138149

139150
The reference docs served at `/api` are generated via the `deno doc` subcommand.

runtime/fundamentals/node.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,13 @@ to your private registry. The `.npmrc` file must be in the project root or
797797
798798
```sh
799799
@mycompany:registry=http://mycompany.com:8111/
800-
//mycompany.com:8111/:_auth=secretToken
800+
//mycompany.com:8111/:_authToken=secretToken
801801
```
802802
803803
Replace `http://mycompany.com:8111/` with the actual URL of your private
804-
registry and `secretToken` with your authentication token.
804+
registry and `secretToken` with your authentication token. `_authToken` is the
805+
standard bearer-token form; registries that use legacy `_auth` credentials are
806+
also supported (see the `.npmrc` features list below).
805807
806808
Then update Your `deno.json` or `package.json` to specify the import path for
807809
your private package. For example:

runtime/fundamentals/typescript.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -379,47 +379,3 @@ use the `compilerOptions` field in
379379

380380
See the
381381
[full list of supported compiler options](/runtime/reference/ts_config_migration/#ts-compiler-options).
382-
383-
## Using `tsconfig.json` with Deno
384-
385-
If you're migrating a TypeScript project from Node.js, your existing
386-
`tsconfig.json` files work with Deno's type checker and LSP out of the box. Deno
387-
automatically discovers `tsconfig.json` files in directories that also contain a
388-
`deno.json` or `package.json`.
389-
390-
```
391-
my-project/
392-
├── deno.json
393-
├── tsconfig.json # ← discovered automatically
394-
├── src/
395-
│ └── main.ts
396-
└── packages/
397-
└── lib/
398-
├── package.json
399-
└── tsconfig.json # ← also discovered
400-
```
401-
402-
Deno supports the standard `tsconfig.json` fields: `extends`, `files`,
403-
`include`, `exclude`, `references`, and `compilerOptions`.
404-
405-
:::note
406-
407-
For Deno-first projects, prefer `compilerOptions` in `deno.json` over a separate
408-
`tsconfig.json`. The `tsconfig.json` compatibility exists primarily to ease
409-
migration of existing Node.js projects.
410-
411-
:::
412-
413-
### Precedence rules
414-
415-
When both `deno.json` and `tsconfig.json` exist:
416-
417-
1. `compilerOptions` in a parent `deno.json` take precedence over any
418-
`tsconfig.json`.
419-
2. A `tsconfig.json` reference takes precedence over its referrer.
420-
3. For root references, a more deeply nested `tsconfig.json` takes precedence
421-
(e.g. `foo/bar/tsconfig.json` over `foo/tsconfig.json`).
422-
423-
For the full details on `tsconfig.json` compatibility, compiler options, and
424-
library configuration, see the
425-
[Configuring TypeScript](/runtime/reference/ts_config_migration/) reference.

runtime/getting_started/command_line_interface.md

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
last_modified: 2026-05-28
33
title: Command line interface
4-
description: "A comprehensive guide to using Deno's command-line interface (CLI). Learn about running scripts, managing permissions, using watch mode, and configuring Deno's runtime behavior through command-line flags and options."
4+
description: "Practical patterns for Deno's command-line interface: passing script arguments, runtime flag ordering, watch mode and its exclusions, and hot module replacement."
55
oldUrl:
66
- /manual/getting_started/command_line_interface
77
- /runtime/manual/getting_started/command_line_interface/
@@ -16,31 +16,10 @@ standalone binaries, and a lot more. Each subcommand (`run`, `test`, `fmt`,
1616
`deno <subcommand> --help` to see them.
1717

1818
For the complete list of subcommands and flags, see the
19-
[CLI reference](/runtime/reference/cli/). This page covers the patterns you'll
20-
hit early on: how to run code, how to pass arguments, and how to use watch mode.
21-
22-
## Running scripts
23-
24-
You can run a local TypeScript or JavaScript file by specifying its path
25-
relative to the current working directory:
26-
27-
```shell
28-
deno run main.ts
29-
```
30-
31-
Deno supports running scripts directly from URLs. This is particularly useful
32-
for quickly testing or running code without downloading it first:
33-
34-
```shell
35-
deno run https://docs.deno.com/examples/scripts/hello_world.ts
36-
```
37-
38-
You can also run a script by piping it through standard input. This is useful
39-
for integrating with other command-line tools or dynamically generating scripts:
40-
41-
```shell
42-
cat main.ts | deno run -
43-
```
19+
[CLI reference](/runtime/reference/cli/). For the basics of running code (files,
20+
URLs, stdin, tasks, the permission flags), see the
21+
[Running code guide](/runtime/run/). This page covers the patterns that trip
22+
people up early: passing arguments, flag ordering, and watch mode's details.
4423

4524
## Passing script arguments
4625

runtime/migrate/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,3 @@ installed side by side.
172172
supported (`node:` built-ins, npm packages, globals) and the known gaps.
173173
- **[Migrating your tsconfig.json](/runtime/reference/ts_config_migration/).**
174174
Map `tsconfig.json` options onto `deno.json`.
175-
- Already on Deno and upgrading a major version? See the
176-
**[Deno 1.x to 2.x migration guide](/runtime/reference/migration_guide/)**.

runtime/reference/cli/test.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,32 @@ Run tests matching a glob pattern:
3434
deno test src/*.test.ts
3535
```
3636

37-
Run tests whose name matches a string or pattern:
37+
Skip type-checking:
3838

3939
```sh
40-
deno test --filter "database"
41-
deno test --filter "/^connect.*/"
40+
deno test --no-check
4241
```
4342

44-
Skip type-checking:
43+
## Filtering
44+
45+
Run only the tests whose name matches a string or a pattern with `--filter`:
4546

4647
```sh
47-
deno test --no-check
48+
# Run tests whose name contains "database"
49+
deno test --filter "database"
50+
51+
# Run tests whose name matches a regular expression
52+
deno test --filter "/^connect.*/"
4853
```
4954

55+
Wrap the filter value in forward slashes (`/`) to treat it as a regular
56+
expression, like JavaScript's regex literal syntax. Filtering does not affect
57+
test steps: when a test's name matches the filter, all of its steps run.
58+
59+
To control which test files are collected in the first place, set `test.include`
60+
and `test.exclude` in your config file. See
61+
[include and exclude](/runtime/reference/deno_json/#include-and-exclude).
62+
5063
## Permissions
5164

5265
Tests run with the same [permission model](/runtime/fundamentals/security/) as
@@ -103,14 +116,20 @@ deno coverage --lcov coverage/ > coverage.lcov
103116

104117
## Reporters
105118

106-
Choose an output format with `--reporter`:
119+
Choose an output format with `--reporter`. Four reporters are built in:
120+
121+
- `pretty` (default): detailed, human-readable output
122+
- `dot`: one character per test, for a concise overview
123+
- `junit`: JUnit XML format, for CI systems
124+
- `tap`: [Test Anything Protocol](https://testanything.org/) output
107125

108126
```sh
109127
deno test --reporter=dot
110128
deno test --reporter=tap
111129
```
112130

113-
Write a JUnit XML report for CI systems:
131+
Write a JUnit XML report to a file while keeping the human-readable `pretty`
132+
output in the terminal:
114133

115134
```sh
116135
deno test --junit-path=report.xml

runtime/reference/deno_json.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ sharing code.
358358
:::
359359

360360
If you’re migrating from Node.js, your existing `tsconfig.json` files work out
361-
of the box with Deno. See
362-
[Using tsconfig.json with Deno](/runtime/fundamentals/typescript/#using-tsconfigjson-with-deno)
363-
for details.
361+
of the box with Deno. See the
362+
[tsconfig.json compatibility reference](/runtime/reference/ts_config_migration/)
363+
for the supported fields and precedence rules.
364364

365365
For the full list of supported compiler options, library configuration, and
366366
advanced settings, see

runtime/reference/migration_guide.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ oldUrl:
77
- /runtime/reference/migrate_deprecations/
88
---
99

10+
:::note Historical document
11+
12+
This guide covers the one-time migration from Deno 1.x to Deno 2.x and is no
13+
longer actively updated. If you're coming to Deno from Node.js, see
14+
[Migrate from Node.js](/runtime/migrate/) instead.
15+
16+
:::
17+
1018
While we’ve accomplished a ton in Deno 1.x, the next major version is focused on
1119
using Deno **at scale**. This means seamless interoperability with Node.js and
1220
npm JavaScript infrastructure and supporting a wider range of projects and
@@ -60,15 +68,9 @@ mind. These teams work on complex codebases, sharing internal code, often using
6068
private registries.
6169

6270
With Deno 2 your team can leverage private npm registries the same way you'd do
63-
with Node.js and npm, using an `.npmrc` file:
64-
65-
```js title=".npmrc"
66-
@mycompany:registry=http://mycompany.com:8111/
67-
mycompany.com:8111/:_authToken=token
68-
```
69-
70-
Learn more about private registry configuration
71-
[on `npm packages` page](/runtime/fundamentals/node/#private-registries).
71+
with Node.js and npm, using an `.npmrc` file. See
72+
[private registries](/runtime/fundamentals/node/#private-registries) for the
73+
configuration details.
7274

7375
Deno 2 has workspace support, allowing you to mix Deno-first and Node-first
7476
packages in the same monorepo, making incremental adoption fast and

runtime/reference/ts_config_migration.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,28 @@ You may be forced to use a `tsconfig.json` file when, for example, the required
7979
granularity for [`include`](https://www.typescriptlang.org/tsconfig/#include)
8080
cannot be represented with `deno.json` workspaces and directory scopes.
8181

82+
## Migrating compilerOptions from Node.js
83+
84+
Most of a typical Node.js `tsconfig.json` exists to configure compilation output
85+
and module interop. Deno runs TypeScript directly and never emits JavaScript, so
86+
most of those options have no effect and can be deleted. Deno warns about
87+
ignored options when they appear in a `tsconfig.json`; moving your remaining
88+
options into `deno.json`'s `compilerOptions` suppresses the warning.
89+
90+
| Option in your `tsconfig.json` | In Deno |
91+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
92+
| `target`, `outDir`, `outFile`, `rootDir` | Delete. Deno never emits: code runs directly on the latest V8, and `deno check` type-checks without producing output. |
93+
| `declaration`, `declarationMap`, `emitDeclarationOnly` | Delete. No emit. Use [`deno doc`](/runtime/reference/cli/doc/) for API documentation. |
94+
| `sourceMap`, `inlineSourceMap`, `inlineSources` | Delete. Stack traces map to your TypeScript sources automatically. |
95+
| `esModuleInterop`, `allowSyntheticDefaultImports` | Delete. Deno is ESM-native and handles CommonJS interop in the runtime. |
96+
| `importHelpers`, `noEmitHelpers`, `downlevelIteration` | Delete. No downleveling happens, so no helpers are emitted. |
97+
| `resolveJsonModule` | Delete. Import JSON with an attribute instead: `import data from "./data.json" with { type: "json" }`. |
98+
| `skipLibCheck` | Delete. Deno does not type-check dependencies by default (`deno check --all` opts in). |
99+
| `module`, `moduleResolution` | Usually delete. Deno defaults to `nodenext`; the supported values are listed in the table below. |
100+
| `lib`, `types` | Usually delete. Deno's defaults cover its runtime; keep `lib` only for cross-runtime code (see ["lib" property](#using-the-lib-property)). |
101+
| `strict`, `noImplicit*`, `noUnused*`, other check flags | Keep the ones you want, in `deno.json`'s `compilerOptions`. Note Deno's defaults are already strict (table below). |
102+
| `paths`, `baseUrl` | Keep if needed for type-time path mapping, or replace with [import maps](/runtime/fundamentals/modules/), which also work at runtime. |
103+
82104
## TS Compiler Options
83105

84106
Here is a table of compiler options that can be changed, their default in Deno
@@ -179,8 +201,8 @@ using any APIs exclusive to one or the other. In such cases, a typical
179201

180202
This should allow most code to be type checked properly by Deno.
181203

182-
If you expect to run the code in Deno with the `--unstable` flag, then you
183-
should add that library to the mix as well:
204+
If your code uses APIs that are gated behind one of the `--unstable-*` flags,
205+
add the `deno.unstable` library to the mix as well:
184206

185207
```json title="deno.json"
186208
{

runtime/run/index.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,19 @@ access to the network, filesystem, environment, or subprocesses** until you
3030
grant it. A script that tries to read a file without permission stops and asks,
3131
or fails if prompts are disabled.
3232

33-
Grant access with `--allow-*` flags (each has a short form):
33+
Grant access with `--allow-*` flags (each has a short form), and scope them down
34+
to exactly what's needed:
3435

3536
```sh
36-
deno run --allow-net main.ts # network (-N)
37-
deno run --allow-read main.ts # filesystem (-R)
38-
deno run --allow-env main.ts # env vars (-E)
39-
```
40-
41-
Scope them down to exactly what's needed, and combine as required:
42-
43-
```sh
44-
deno run --allow-read=./data --allow-net=api.example.com main.ts
37+
deno run --allow-net main.ts # network (-N)
38+
deno run --allow-read=./data main.ts # filesystem (-R), scoped
39+
deno run -N=api.example.com -E main.ts # combined, short forms
4540
```
4641

4742
Use `--deny-*` to carve out exceptions, or `-A` / `--allow-all` to skip the
48-
sandbox entirely (handy in trusted environments, but it gives up the
49-
guarantees):
50-
51-
```sh
52-
deno run -A main.ts
53-
```
54-
55-
See [Permissions](/runtime/reference/permissions/) for every flag and
56-
[Security](/runtime/fundamentals/security/) for the model behind them.
43+
sandbox entirely. That is handy in trusted environments, but it gives up the
44+
guarantees. See [Permissions](/runtime/reference/permissions/) for every flag
45+
and [Security](/runtime/fundamentals/security/) for the model behind them.
5746

5847
## Run from a URL or stdin
5948

@@ -77,7 +66,9 @@ changes. No `nodemon`, no extra dependency:
7766
deno run --watch main.ts
7867
```
7968

80-
`deno test`, `deno fmt`, and others accept `--watch` too.
69+
`deno test`, `deno fmt`, and others accept `--watch` too. For what gets watched,
70+
excluding paths, and hot module replacement, see the
71+
[CLI patterns page](/runtime/getting_started/command_line_interface/#watch-mode).
8172

8273
## Run project tasks
8374

0 commit comments

Comments
 (0)