Skip to content

Commit

Permalink
Merge branch 'main' into cli-docs-test
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjofrank authored Apr 30, 2024
2 parents 6c7f51c + 4317cbf commit 18b41ca
Show file tree
Hide file tree
Showing 5 changed files with 404 additions and 0 deletions.
149 changes: 149 additions & 0 deletions runtime/manual/tools/coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# deno coverage

Print coverage reports from coverage profiles.

## Command

`deno coverage [OPTIONS] <COVERAGE>`

## Synopsis

```bash
deno coverage [--ignore=<ignore>] [--include=<regex>] [-q|--quiet] [--exclude=<regex>] [--lcov] [--output=<output>] [--html] [--detailed] [-h|--help] <COVERAGE>

deno coverage -h|--help
```

## Description

Print coverage reports from coverage profiles.

By default, when you run `deno test --coverage` a coverage profile will be generated in the `/coverage` directory in the current working directory.
Subsequently you can run `deno coverage` to print a coverage report to stdout.

```bash
deno test --coverage
deno coverage
```

## Inclusions and Exclusions

By default coverage includes any of your code that exists on the local file system, and it's imports.

You can customize the inclusions and exclusions by using the `--include` and `--exclude` options.

You can expand the coverage to include files that are not on the local file system by using the `--include` option and customizing the regex pattern.

```bash
deno coverage --include="^file:|https:"
```

The default inclusion pattern should be sufficient for most use cases, but you can customize it to be more specific about which files are included in your coverage report.

Files that contain `test.js`, `test.ts`, `test.jsx`, or `test.tsx` in their name are excluded by default.

This is equivalent to:

```bash
deno coverage --exclude="test\.(js|mjs|ts|jsx|tsx)$"
```

This default setting prevents your test code from contributing to your coverage report.
For a URL to match it must match the include pattern and not match the exclude pattern.

## Output Formats

By default we support Deno's own coverage format - but you can also output coverage reports in the lcov format, or in html.

```bash
deno coverage --lcov --output=cov.lcov
```

This lcov file can be used with other tools that support the lcov format.

```bash
deno coverage --html
```

This will output a coverage report as a html file

## Arguments

`COVERAGE`

The name of the coverage profile to use.
This coverage profile will be created as a result of running `deno test --coverage` and appears as a directory in your workspace.

## Options

- `--ignore=<ignore>`

Ignore coverage files

- `--include=<regex>`

Include source files in the report

[default: ^file:]

- `-q, --quiet`

Suppress diagnostic output

- `--exclude=<regex>`

Exclude source files from the report

[default: test\.(js|mjs|ts|jsx|tsx)$]

- `--lcov`

Output coverage report in lcov format

- `--output=<output>`

Exports the coverage report in lcov format to the given file.
Filename should be passed along with '=' For example '--output=foo.lcov'

If no `--output` option is specified then the report is written to stdout.

- `--html`

Output coverage report in HTML format in the given directory

- `--detailed`

Output coverage report in detailed format in the terminal.

- `-h, --help`

Print help (see a summary with '-h')

## Examples

- Generate a coverage report from the default coverage profile in your workspace

```bash
deno test --coverage
deno coverage
```

- Generate a coverage report from a coverage profile with a custom name

```bash
deno test --coverage=custom_profile_name
deno coverage custom_profile_name
```

- Only include coverage that matches a specific pattern - in this case, only include tests from main.ts

```bash
deno coverage --include="main.ts"
```

- Export test coverage from the default coverage profile to an lcov file

```bash
deno test --coverage
deno coverage --lcov --output=cov.lcov
```
52 changes: 52 additions & 0 deletions runtime/manual/tools/lsp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# deno lsp

Starts the Deno language server. The language server is used by editors to provide features like intellisense, code formatting, and more.

## Command

`deno lsp [OPTIONS]`

## Synopsis

```bash
deno lsp [-q|--quiet]

deno lsp -h|--help
```

## Description

The 'deno lsp' subcommand provides a way for code editors and IDEs to interact with Deno using the Language Server Protocol.

Usually humans do not use this subcommand directly. For example, 'deno lsp' can provide IDEs with go-to-definition support and automatic code formatting.

Read more about [how to connect editors and IDEs to 'deno lsp'](
https://deno.land/[email protected]/getting_started/setup_your_environment#editors-and-ides).

## Arguments

There are no required arguments for this command.

## Options

- `-q, --quiet`

Suppress diagnostic output

- `-h, --help`

Prints help information

## Examples

- Run the command

```bash
deno lsp
```

- Run the command 2

```bash
deno lsp2
```
137 changes: 137 additions & 0 deletions runtime/manual/tools/publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# deno publish

*This applies to `deno` v1.42.0. and above.*

Publish a package or workspace to [JSR](https://jsr.io/).

## Command

`deno publish [OPTIONS]` - Publish the current working directory's package or workspace.

## Synopsis

```bash
deno publish [--token <token>] [-c|--config <FILE>] [-q|--quiet]
[--no-config] [--dry-run] [--allow-slow-types] [--allow-dirty]
[--no-provenance] [--check[=<CHECK_TYPE>]] [--no-check[=<NO_CHECK_TYPE>]]

deno publish -h|--help
```
## Description
The `deno publish` command is used to [publish a package or workspace](https://jsr.io/docs/publishing-packages) to [JSR](https://jsr.io/).
The command will upload the package to the registry and make it available for others to use.
## Package Requirements
Your package must have a `name` and `version` and an `exports` field in its `deno.json` or `jsr.json` file.
- The `name` field must be unique and follow the `@<scope_name>/<package_name>` convention.
- The `version` field must be a valid semver version.
- The `exports` field must point to the main entry point of the package.
Example:
```json title="deno.json"
{
"name": "@scope_name/package_name",
"version": "1.0.0",
"exports": "./main.ts"
}
```
Before you publish your package, you must create it in the registry by visiting [JSR - Publish a package](https://jsr.io/new).
## Arguments
There are no required arguments for this command - it should be run from within your package or workspace directory.
## Options
- `--token <token>`
The API token to use when publishing. If unset, interactive authentication will be used
- `-c, --config <FILE>`
The configuration file can be used to configure different aspects of
deno including TypeScript, linting, and code formatting. Typically the
configuration file will be called `deno.json` or `deno.jsonc` and
automatically detected; in that case this flag is not necessary.
See [https://deno.land/[email protected]/getting_started/configuration_file](https://deno.land/[email protected]/getting_started/configuration_file)
- `-q, --quiet`
Suppress diagnostic output
- `--no-config`
Disable automatic loading of the configuration file.
- `--dry-run`
Prepare the package for publishing performing all checks and validations without uploading
- `--allow-slow-types`
Allow publishing with slow types
- `--allow-dirty`
Allow publishing if the repository has uncommitted changed
- `--no-provenance`
Disable provenance attestation. Enabled by default on Github actions, publicly links the package to where it was built and published from.
- `--check[=<CHECK_TYPE>]`
Set type-checking behavior. This subcommand type-checks local modules by
default, so adding --check is redundant.
If the value of '--check=all' is supplied, diagnostic errors from remote modules
will be included.
Alternatively, the 'deno check' subcommand can be used.
- `--no-check[=<NO_CHECK_TYPE>]`
Skip type-checking. If the value of '--no-check=remote' is supplied,
diagnostic errors from remote modules will be ignored
- `-h, --help`
Print help (see a summary with '-h')
## Examples
- Publish your current workspace
```bash
deno publish
```
- Publish your current workspace with a specific token, bypassing interactive authentication
```bash
deno publish --token c00921b1-0d4f-4d18-b8c8-ac98227f9275
```
- Publish and check for errors in remote modules
```bash
deno publish --check=all
```
- Perform a dry run to simulate publishing.
```bash
deno publish --dry-run
```
- Publish using settings from a specific configuration file
```bash
deno publish --config custom-config.json
```
46 changes: 46 additions & 0 deletions runtime/manual/tools/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# deno types

Prints runtime TypeScript declarations.

## Command

`deno types [OPTIONS]` - Generate types into stdout.

## Synopsis

```bash
deno types [-q|--quiet] [OPTIONS]

deno types -h|--help
```

## Description

Generates types suitable for use with Deno runtime.
The types are printed to stdout and can be redirected to a file or used in a pipeline.

```bash
deno types > lib.deno.d.ts
```

## Arguments

There are no arguments for this command.

## Options

- `-q, --quiet`

Suppress diagnostic output

- `-h, --help`

Print help (see a summary with '-h')

## Examples

- Save Deno type definitions into a d.ts file

```bash
deno types > lib.deno.d.ts
```
Loading

0 comments on commit 18b41ca

Please sign in to comment.