diff --git a/runtime/manual/tools/coverage.md b/runtime/manual/tools/coverage.md new file mode 100644 index 000000000..ebab9404a --- /dev/null +++ b/runtime/manual/tools/coverage.md @@ -0,0 +1,149 @@ +# deno coverage + +Print coverage reports from coverage profiles. + +## Command + +`deno coverage [OPTIONS] ` + +## Synopsis + +```bash +deno coverage [--ignore=] [--include=] [-q|--quiet] [--exclude=] [--lcov] [--output=] [--html] [--detailed] [-h|--help] + +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 coverage files + +- `--include=` + + Include source files in the report + + [default: ^file:] + +- `-q, --quiet` + + Suppress diagnostic output + +- `--exclude=` + + Exclude source files from the report + + [default: test\.(js|mjs|ts|jsx|tsx)$] + +- `--lcov` + + Output coverage report in lcov format + +- `--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 +``` diff --git a/runtime/manual/tools/lsp.md b/runtime/manual/tools/lsp.md new file mode 100644 index 000000000..dd0020788 --- /dev/null +++ b/runtime/manual/tools/lsp.md @@ -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/manual@v1.42.4/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 +``` diff --git a/runtime/manual/tools/publish.md b/runtime/manual/tools/publish.md new file mode 100644 index 000000000..d6d246355 --- /dev/null +++ b/runtime/manual/tools/publish.md @@ -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 ] [-c|--config ] [-q|--quiet] +[--no-config] [--dry-run] [--allow-slow-types] [--allow-dirty] +[--no-provenance] [--check[=]] [--no-check[=]] + +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 `@/` 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 ` + + The API token to use when publishing. If unset, interactive authentication will be used + +- `-c, --config ` + + 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/manual@v1.41.3/getting_started/configuration_file](https://deno.land/manual@v1.41.3/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[=]` + + 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[=]` + + 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 +``` diff --git a/runtime/manual/tools/types.md b/runtime/manual/tools/types.md new file mode 100644 index 000000000..52f7d7c15 --- /dev/null +++ b/runtime/manual/tools/types.md @@ -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 +``` diff --git a/sidebars/runtime.js b/sidebars/runtime.js index 76731dcca..b8984416a 100644 --- a/sidebars/runtime.js +++ b/sidebars/runtime.js @@ -140,6 +140,11 @@ const sidebars = { label: "deno compile", id: "manual/tools/compiler", }, + { + type: "doc", + label: "deno coverage", + id: "manual/tools/coverage", + }, { type: "doc", label: "deno doc", @@ -179,6 +184,16 @@ const sidebars = { type: "doc", label: "deno lint", id: "manual/tools/linter", + }, + { + type: "doc", + label: "deno publish", + id: "manual/tools/publish", + }, + { + type: "doc", + label: "deno lsp", + id: "manual/tools/lsp", }, { type: "doc", @@ -205,6 +220,11 @@ const sidebars = { label: "deno test", id: "manual/tools/test", }, + { + type: "doc", + label: "deno types", + id: "manual/tools/types", + }, { type: "doc", label: "deno upgrade",