diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..87804998c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: denoland/setup-deno@v1 + - run: deno fmt --check diff --git a/.github/workflows/update_versions.ts b/.github/workflows/update_versions.ts index 0a1a1e402..71d9e82e4 100644 --- a/.github/workflows/update_versions.ts +++ b/.github/workflows/update_versions.ts @@ -32,7 +32,7 @@ if (Deno.args.includes("--create-pr")) { async function getLatestTagForRepo(name: string) { $.logStep(`Fetching latest release for ${name}...`); const latestRelease = await $.request( - `https://api.github.com/repos/denoland/${name}/releases/latest` + `https://api.github.com/repos/denoland/${name}/releases/latest`, ) .header("accept", "application/vnd.github.v3+json") .json<{ tag_name: string }>(); @@ -81,8 +81,7 @@ async function tryCreatePr() { $.log(`Opened PR at ${openedPr.data.url}`); function getPrBody() { - let text = - `Bumped versions for ${latestCliVersion}\n\n` + + let text = `Bumped versions for ${latestCliVersion}\n\n` + `To make edits to this PR:\n` + "```shell\n" + `gh pr checkout \n` + diff --git a/README.md b/README.md index ab2300fcc..69de9520b 100644 --- a/README.md +++ b/README.md @@ -198,8 +198,8 @@ authored. ## Examples -[Deno by Example](https://docs.deno.com/examples) is a collection of small snippets showcasing various functions of the APIs implemented in Deno. - +[Deno by Example](https://docs.deno.com/examples) is a collection of small +snippets showcasing various functions of the APIs implemented in Deno. - Examples are written in TypeScript - Each example should be a single file, no more than 50 lines @@ -217,10 +217,11 @@ authored. ### Adding an example -To add an example, create a file in the `by-example` directory. The file name should -be a short description of the example (in kebab case) and the contents should be the code for the example. -The file should be in the `.ts` format. The file should start with a JSDoc style -multi line comment that describes the example: +To add an example, create a file in the `by-example` directory. The file name +should be a short description of the example (in kebab case) and the contents +should be the code for the example. The file should be in the `.ts` format. The +file should start with a JSDoc style multi line comment that describes the +example: ```ts /** diff --git a/by-example/checking-file-existence.ts b/by-example/checking-file-existence.ts index 350f57bbe..9c0f2c38b 100644 --- a/by-example/checking-file-existence.ts +++ b/by-example/checking-file-existence.ts @@ -4,7 +4,7 @@ * @tags cli, deploy * @run --allow-read --allow-write * @group File System - * + * * Sometimes we as developers think that we need to check * if a file exists or not. More often than not, we are * entirely wrong. diff --git a/by-example/mongo.ts b/by-example/mongo.ts index 69db6ca44..34e529b94 100644 --- a/by-example/mongo.ts +++ b/by-example/mongo.ts @@ -5,7 +5,7 @@ * @run --allow-net --allow-sys --allow-read * @resource {https://deno.land/x/mongo} Deno MongoDB on deno.land/x * @group Databases - * + * * Using the Deno MongoDB client, you can connect to a Mongo database * running anywhere. */ diff --git a/by-example/npm.ts b/by-example/npm.ts index 4d7e95ace..1063b9b17 100644 --- a/by-example/npm.ts +++ b/by-example/npm.ts @@ -7,7 +7,7 @@ * @resource {https://docs.deno.com/runtime/manual/node/npm_specifiers} npm: specifiers * @resource {https://www.npmjs.com/package/express} express module on npm * @group Basics - * + * * Use JavaScript modules from npm in your Deno programs with the "npm:" * specifier in your imports. */ diff --git a/by-example/parsing-serializing-csv.ts b/by-example/parsing-serializing-csv.ts index ab39cd3b4..918c3ca7f 100644 --- a/by-example/parsing-serializing-csv.ts +++ b/by-example/parsing-serializing-csv.ts @@ -6,7 +6,7 @@ * @resource {/import-export} Example: Importing & Exporting * @resource {https://datatracker.ietf.org/doc/html/rfc4180} Spec: CSV * @group Encoding - * + * * CSV is a data serialization format that is designed to be portable for table-like applications. */ import { parse, stringify } from "jsr:@std/csv"; diff --git a/by-example/redis.ts b/by-example/redis.ts index 2094c7921..f9445c53e 100644 --- a/by-example/redis.ts +++ b/by-example/redis.ts @@ -6,7 +6,7 @@ * @resource {https://deno.land/x/r2d2} r2d2 on deno.land/x * @resource {https://redis.io/docs/getting-started/} Getting started with Redis * @group Databases - * + * * Using the r2d2 module, you can connect to a Redis database running anywhere. */ diff --git a/by-example/streaming-files.ts b/by-example/streaming-files.ts index 97868c6d7..8aee542cd 100644 --- a/by-example/streaming-files.ts +++ b/by-example/streaming-files.ts @@ -6,7 +6,7 @@ * @resource {https://deno.land/api?s=Deno.open} Doc: Deno.open * @resource {https://deno.land/api?s=Deno.FsFile} Doc: Deno.FsFile * @group File System - * + * * Sometimes we need more granular control over file operations. * Deno provides a low level interface to file operations that * may be used for this purpose. diff --git a/deploy/manual/acceptable-use-policy.md b/deploy/manual/acceptable-use-policy.md index 817761162..ff03ff738 100644 --- a/deploy/manual/acceptable-use-policy.md +++ b/deploy/manual/acceptable-use-policy.md @@ -1,9 +1,8 @@ # Acceptable use policy -The Deno Deploy service includes resources (CPU time, -request counts) that are subject to this Acceptable Use policy. This document -can give a rough estimate to what we consider as "Acceptable Use", and what we -do not. +The Deno Deploy service includes resources (CPU time, request counts) that are +subject to this Acceptable Use policy. This document can give a rough estimate +to what we consider as "Acceptable Use", and what we do not. ### Examples of Acceptable Use diff --git a/deploy/manual/deployctl.md b/deploy/manual/deployctl.md index 92a60b7d5..68b12c44c 100644 --- a/deploy/manual/deployctl.md +++ b/deploy/manual/deployctl.md @@ -635,3 +635,4 @@ Get a csv stream of the CPU time per request on each isolate of each region: ```shell deployctl top | jq -r '[.id,.region,.cpuTimePerRequest] | @csv' ``` +```` diff --git a/deploy/tutorials/fresh.md b/deploy/tutorials/fresh.md index a2085fbce..a5263674f 100644 --- a/deploy/tutorials/fresh.md +++ b/deploy/tutorials/fresh.md @@ -33,7 +33,8 @@ You can edit `routes/index.js` to modify the application. ## **Step 3:** Deploy to Deno Deploy -1. Navigate to [https://dash.deno.com/new_project](https://dash.deno.com/new_project). +1. Navigate to + [https://dash.deno.com/new_project](https://dash.deno.com/new_project). 2. Connect to your GitHub account and select your repository. 3. Fill in the values on the form: - Give your project a name diff --git a/docusaurus.config.js b/docusaurus.config.js index ef04c0ec6..f0df00393 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -179,7 +179,7 @@ const config = { { label: "Deno Deploy", to: "/deploy/manual", - }, + }, { label: "Deno Subhosting", to: "/subhosting/manual", diff --git a/runtime/manual/advanced/jsx_dom/overview.md b/runtime/manual/advanced/jsx_dom/overview.md index 94dec9cec..7cb202016 100644 --- a/runtime/manual/advanced/jsx_dom/overview.md +++ b/runtime/manual/advanced/jsx_dom/overview.md @@ -18,8 +18,8 @@ A web application is generally made up of three key technologies: - HTML - CSS -As well as increasingly, [WebAssembly](../../runtime/webassembly/index.md) -might play a part in a web application. +As well as increasingly, [WebAssembly](../../runtime/webassembly/index.md) might +play a part in a web application. These technologies combine to allow a developer to build an application in a browser using the web platform. While Deno supports a lot of web platform APIs, diff --git a/runtime/manual/advanced/publishing/index.md b/runtime/manual/advanced/publishing/index.md index 58f3c7541..85512c505 100644 --- a/runtime/manual/advanced/publishing/index.md +++ b/runtime/manual/advanced/publishing/index.md @@ -27,13 +27,13 @@ For more details, see [Adding a Module](https://deno.land/add_module). ## Auto-generating documentation for modules -When a module is published, the contents of the module are analyzed. An automated -process identifies modules that contain code that Deno understands and generates -documentation based on the code. For each path, including the root path, it -attempts to identify the default module. In order of preference it looks for -`mod`, `lib`, `main`, or `index` files with an extension that Deno understands -(ts,tsx,js,jsx,mjs, or mts). When viewing the documentation for the module for a -path, the default module will be shown. +When a module is published, the contents of the module are analyzed. An +automated process identifies modules that contain code that Deno understands and +generates documentation based on the code. For each path, including the root +path, it attempts to identify the default module. In order of preference it +looks for `mod`, `lib`, `main`, or `index` files with an extension that Deno +understands (ts,tsx,js,jsx,mjs, or mts). When viewing the documentation for the +module for a path, the default module will be shown. If a default module cannot be identified, a list of modules that can be documented will be provided instead. When generating the documentation, not only diff --git a/runtime/manual/advanced/typescript/overview.md b/runtime/manual/advanced/typescript/overview.md index 541ef29d7..8e1ed9c90 100644 --- a/runtime/manual/advanced/typescript/overview.md +++ b/runtime/manual/advanced/typescript/overview.md @@ -98,9 +98,9 @@ You can learn more about type-checking arguments Since Deno supports JavaScript, TypeScript, JSX, TSX modules, Deno has to make a decision about how to treat each of these kinds of files. For local modules, -Deno makes this determination based on the extension. When the extension -is absent in a local file, it is assumed to be JavaScript. The module type can -be overridden using the `--ext` argument. This is useful if the module does not +Deno makes this determination based on the extension. When the extension is +absent in a local file, it is assumed to be JavaScript. The module type can be +overridden using the `--ext` argument. This is useful if the module does not have a file extension, e.g. because it is embedded in another file. For remote modules, the media type (mime-type) is used to determine the type of diff --git a/runtime/manual/advanced/typescript/types.md b/runtime/manual/advanced/typescript/types.md index b35850467..d88317cab 100644 --- a/runtime/manual/advanced/typescript/types.md +++ b/runtime/manual/advanced/typescript/types.md @@ -50,7 +50,7 @@ When type checking `coolLib` and your usage of it in the file, the `coolLib.d.ts` types will be used instead of looking at the JavaScript file. The pattern matching for the compiler hint is somewhat forgiving and will accept -quoted and non-question values for the specifier as well as accepting whitespace +quoted and non-question values for the specifier as well as accepting whitespace before and after the equals sign. ## Providing types when hosting @@ -234,12 +234,12 @@ file, its resolution follow the normal import rules of Deno. For a lot of the compatible with Deno. [esm.sh](https://esm.sh) is a CDN which provides type declarations by default - (via the `X-TypeScript-Types` header). It can be disabled by appending - `?no-dts` to the import URL: +(via the `X-TypeScript-Types` header). It can be disabled by appending `?no-dts` +to the import URL: - ```ts - import React from "https://esm.sh/react?no-dts"; - ``` +```ts +import React from "https://esm.sh/react?no-dts"; +``` ## Behavior of JavaScript when type checking diff --git a/runtime/manual/basics/connecting_to_databases.md b/runtime/manual/basics/connecting_to_databases.md index 7545e6fe4..6ed899b60 100644 --- a/runtime/manual/basics/connecting_to_databases.md +++ b/runtime/manual/basics/connecting_to_databases.md @@ -124,8 +124,8 @@ db.close(); To connect to Firebase with Deno, import the [firestore npm module](https://firebase.google.com/docs/firestore/quickstart) -with the [ESM CDN](https://esm.sh/). To learn more about using npm -modules in Deno with a CDN, see [Using npm packages with CDNs](../node/cdns.md). +with the [ESM CDN](https://esm.sh/). To learn more about using npm modules in +Deno with a CDN, see [Using npm packages with CDNs](../node/cdns.md). ### Connect to Firebase with the firestore npm module diff --git a/runtime/manual/getting_started/first_steps.md b/runtime/manual/getting_started/first_steps.md index fcf07f99f..6e8b8025d 100644 --- a/runtime/manual/getting_started/first_steps.md +++ b/runtime/manual/getting_started/first_steps.md @@ -58,7 +58,10 @@ const site = await fetch("https://www.deno.com"); console.log(await site.text()); ``` -Because this example is fetching data from across the internet, you will need to allow network permissions. You can give network permissions with the `--allow-net` flag or by using `-A` to allow all permissions. We'll look at permissions and security in more depth later on. Run the example with: +Because this example is fetching data from across the internet, you will need to +allow network permissions. You can give network permissions with the +`--allow-net` flag or by using `-A` to allow all permissions. We'll look at +permissions and security in more depth later on. Run the example with: ```console deno run -A hello.ts diff --git a/runtime/manual/getting_started/web_frameworks.md b/runtime/manual/getting_started/web_frameworks.md index 05ddd5274..bdc6d8075 100644 --- a/runtime/manual/getting_started/web_frameworks.md +++ b/runtime/manual/getting_started/web_frameworks.md @@ -75,10 +75,11 @@ configure, while being super flexible. Highlights include: [Hono](https://hono.dev) is a light-weight web app framework in the tradition of Express and Sinatra. In just a few lines of code, you can set up an API server -or a server for dynamic web pages. Hono provides a Deno-native installation path, -and works great with Deno’s built-in TypeScript tooling. +or a server for dynamic web pages. Hono provides a Deno-native installation +path, and works great with Deno’s built-in TypeScript tooling. -- This website is served by Hono running on [Deno Deploy](https://deno.com/deploy). +- This website is served by Hono running on + [Deno Deploy](https://deno.com/deploy). ### Oak diff --git a/runtime/manual/references/contributing/building_from_source.md b/runtime/manual/references/contributing/building_from_source.md index c29046af0..62500e623 100644 --- a/runtime/manual/references/contributing/building_from_source.md +++ b/runtime/manual/references/contributing/building_from_source.md @@ -49,6 +49,7 @@ cargo -V > functions. **Linux(Debian)/WSL** + ```shell wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh @@ -78,7 +79,6 @@ brew install llvm # Add /opt/homebrew/opt/llvm/bin/ to $PATH ``` - **Windows**: 1. Get [VS Community 2019](https://www.visualstudio.com/downloads/) with the @@ -136,6 +136,7 @@ Windows users can download the latest binary release from ## Building Deno The easiest way to build Deno is by using a precompiled version of V8: + > for WSL make sure you have sufficient memory allocated in .wslconfig ```console diff --git a/runtime/manual/tools/____template.md b/runtime/manual/tools/____template.md index 8de2d4731..3ea7cb3f6 100644 --- a/runtime/manual/tools/____template.md +++ b/runtime/manual/tools/____template.md @@ -1,6 +1,6 @@ # deno foo -*This applies to `deno` v.1.17.0. and above.* **Unstable preview feature** +_This applies to `deno` v.1.17.0. and above._ **Unstable preview feature** Do a fooer on a bar. @@ -38,11 +38,11 @@ This is a description of the required arguments - `-h, --help` - Prints help information + Prints help information - `-s, --something` - Does a something + Does a something ## Examples diff --git a/runtime/manual/tools/cache.md b/runtime/manual/tools/cache.md index 0bfa1f972..4d3302a53 100644 --- a/runtime/manual/tools/cache.md +++ b/runtime/manual/tools/cache.md @@ -19,27 +19,32 @@ deno cache -h|--help ## Description -Pre-download and compile remote dependencies along with their static imports, storing them in the local cache. +Pre-download and compile remote dependencies along with their static imports, +storing them in the local cache. -All of the static dependencies are saved in the local cache, without running any code. -This ensures faster execution times for scripts that have already been cached by avoiding unnecessary network requests and recompilation. +All of the static dependencies are saved in the local cache, without running any +code. This ensures faster execution times for scripts that have already been +cached by avoiding unnecessary network requests and recompilation. ## Cache Location -Modules cached using `deno cache` are stored in `$DENO_DIR`, a centralized directory. -Its location varies by OS. For instance, on macOS, it's typically `/Users/user/Library/Caches/deno`. +Modules cached using `deno cache` are stored in `$DENO_DIR`, a centralized +directory. Its location varies by OS. For instance, on macOS, it's typically +`/Users/user/Library/Caches/deno`. You can see the cache location by running `deno info` with no arguments. ## Cache Invalidation -Future runs of this module will trigger no downloads or compilation unless the `--reload` option is specified. +Future runs of this module will trigger no downloads or compilation unless the +`--reload` option is specified. ## Arguments `FILE` - The module entrypoint. -The module entrypoint can be a local file or a remote URL. Dependencies are detected from it's imports. +The module entrypoint can be a local file or a remote URL. Dependencies are +detected from it's imports. ## Options @@ -50,10 +55,12 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete - `--import-map ` - Load import map file from local file or remote URL. - Docs: [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) - Specification: [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) - Examples: [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) + Load import map file from local file or remote URL. Docs: + [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) + Specification: + [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) + Examples: + [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) - `-q, --quiet` @@ -75,13 +82,18 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete - `--vendor[=]` - UNSTABLE: Enables or disables the use of a local vendor folder for remote modules and node_modules folder for npm packages + UNSTABLE: Enables or disables the use of a local vendor folder for remote + modules and node_modules folder for npm packages [possible values: true, false] - `-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) + 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) - `--no-config` @@ -91,13 +103,16 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete Reload source code cache (recompile TypeScript). - The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the --reload option. + The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the + --reload option. - E.g. `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` + E.g. + `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` - `--lock []` - Check the specified lock file. If value is not provided, defaults to "deno.lock" in the current working directory. + Check the specified lock file. If value is not provided, defaults to + "deno.lock" in the current working directory. - `--lock-write` @@ -108,12 +123,15 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete Disable auto discovery of the lock file - `--cert ` - - Load the certificate from a [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) + + Load the certificate from a + [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) - `--check[=]` - Enable type-checking. This subcommand does not type-check by default. If the value of '--check=all' is supplied, diagnostic errors from remote modules will be included. + Enable type-checking. This subcommand does not type-check by default. If the + value of '--check=all' is supplied, diagnostic errors from remote modules will + be included. Alternatively, the 'deno check' subcommand can be used. diff --git a/runtime/manual/tools/check.md b/runtime/manual/tools/check.md index 86521bcd4..928df9280 100644 --- a/runtime/manual/tools/check.md +++ b/runtime/manual/tools/check.md @@ -25,33 +25,39 @@ Type-check without execution. deno check https://deno.land/std/http/file_server.ts ``` -Unless `--reload` is specified, this command will not re-download already cached dependencies. +Unless `--reload` is specified, this command will not re-download already cached +dependencies. ## Cache Location -Modules cached are stored in `$DENO_DIR`, a centralized directory. -Its location varies by OS. For instance, on macOS, it's typically `/Users/user/Library/Caches/deno`. +Modules cached are stored in `$DENO_DIR`, a centralized directory. Its location +varies by OS. For instance, on macOS, it's typically +`/Users/user/Library/Caches/deno`. You can see the cache location by running `deno info` with no arguments. ## Cache Invalidation -Future runs of this module will trigger no downloads or compilation unless the `--reload` option is specified. +Future runs of this module will trigger no downloads or compilation unless the +`--reload` option is specified. ## Arguments `FILE` - The module entrypoint. -The module entrypoint can be a local file or a remote URL. Dependencies are detected from it's imports. +The module entrypoint can be a local file or a remote URL. Dependencies are +detected from it's imports. ## Options - `--import-map ` - Load import map file from local file or remote URL. - Docs: [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) - Specification: [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) - Examples: [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) + Load import map file from local file or remote URL. Docs: + [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) + Specification: + [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) + Examples: + [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) - `--no-remote` @@ -73,13 +79,18 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete - `--vendor[=]` - UNSTABLE: Enables or disables the use of a local vendor folder for remote modules and node_modules folder for npm packages + UNSTABLE: Enables or disables the use of a local vendor folder for remote + modules and node_modules folder for npm packages [possible values: true, false] - `-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) + 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) - `--no-config` @@ -89,11 +100,14 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete Reload source code cache (recompile TypeScript). - The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the --reload option. E.g. `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` + The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the + --reload option. E.g. + `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` - `--lock []` - Check the specified lock file. If value is not provided, defaults to "deno.lock" in the current working directory. + Check the specified lock file. If value is not provided, defaults to + "deno.lock" in the current working directory. - `--lock-write` @@ -104,13 +118,14 @@ The module entrypoint can be a local file or a remote URL. Dependencies are dete Disable auto discovery of the lock file - `--cert ` - - Load the certificate from a [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) -- `--all` - Type-check all code, including remote modules and npm packages + Load the certificate from a + [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) - If the value of '--check=all' is supplied, diagnostic errors from remote modules will be included. +- `--all` Type-check all code, including remote modules and npm packages + + If the value of '--check=all' is supplied, diagnostic errors from remote + modules will be included. - `-h, --help` diff --git a/runtime/manual/tools/completions.md b/runtime/manual/tools/completions.md index 5f37fee61..f57331243 100644 --- a/runtime/manual/tools/completions.md +++ b/runtime/manual/tools/completions.md @@ -4,7 +4,8 @@ Output shell completion script to standard output. ## Command -`deno completions [OPTIONS] ` - Generate completion script for the specified shell. +`deno completions [OPTIONS] ` - Generate completion script for the +specified shell. ## Synopsis @@ -16,8 +17,9 @@ deno completions -h|--help ## Description -The completions command generates a script to configure shell completion for Deno. -Executing the script will configure the shell to provide completion for Deno commands and subcommands. +The completions command generates a script to configure shell completion for +Deno. Executing the script will configure the shell to provide completion for +Deno commands and subcommands. ## Arguments @@ -32,7 +34,7 @@ Possible values: bash, fish, powershell, zsh, fig Suppress diagnostic output - `-h, --help` - + Print help (see a summary with '-h') ## Examples diff --git a/runtime/manual/tools/coverage.md b/runtime/manual/tools/coverage.md index ebab9404a..891089dd3 100644 --- a/runtime/manual/tools/coverage.md +++ b/runtime/manual/tools/coverage.md @@ -18,7 +18,8 @@ deno coverage -h|--help 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. +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 @@ -28,19 +29,25 @@ deno coverage ## Inclusions and Exclusions -By default coverage includes any of your code that exists on the local file system, and it's imports. +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 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. +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. +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. +Files that contain `test.js`, `test.ts`, `test.jsx`, or `test.tsx` in their name +are excluded by default. This is equivalent to: @@ -48,12 +55,14 @@ This is equivalent to: 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. +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. +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 @@ -71,53 +80,54 @@ This will output a coverage report as a html file `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. +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 + Ignore coverage files - `--include=` - Include source files in the report + Include source files in the report - [default: ^file:] + [default: ^file:] - `-q, --quiet` - Suppress diagnostic output + Suppress diagnostic output - `--exclude=` - Exclude source files from the report + Exclude source files from the report - [default: test\.(js|mjs|ts|jsx|tsx)$] + [default: test\.(js|mjs|ts|jsx|tsx)$] - `--lcov` - Output coverage report in lcov format + 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' + 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. + If no `--output` option is specified then the report is written to stdout. - `--html` - Output coverage report in HTML format in the given directory + Output coverage report in HTML format in the given directory - `--detailed` - Output coverage report in detailed format in the terminal. + Output coverage report in detailed format in the terminal. - `-h, --help` - Print help (see a summary with '-h') + Print help (see a summary with '-h') ## Examples @@ -135,7 +145,8 @@ 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 +- Only include coverage that matches a specific pattern - in this case, only + include tests from main.ts ```bash deno coverage --include="main.ts" diff --git a/runtime/manual/tools/eval.md b/runtime/manual/tools/eval.md index d6c55631c..1427bb0e5 100644 --- a/runtime/manual/tools/eval.md +++ b/runtime/manual/tools/eval.md @@ -4,7 +4,8 @@ Evaluate JavaScript from the command line. ## Command -`deno eval [OPTIONS] ...` - Executes code provided as a string argument. +`deno eval [OPTIONS] ...` - Executes code provided as a string +argument. ## Synopsis @@ -37,7 +38,8 @@ This command has implicit access to all permissions (--allow-all). ## Arguments -`CODE_ARG` - A string-literal containing the JavaScript or TypeScript code to evaluate. +`CODE_ARG` - A string-literal containing the JavaScript or TypeScript code to +evaluate. ## Options @@ -48,10 +50,12 @@ This command has implicit access to all permissions (--allow-all). - `--import-map ` - Load import map file from local file or remote URL. - Docs: [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) - Specification: [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) - Examples: [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) + Load import map file from local file or remote URL. Docs: + [https://docs.deno.com/runtime/manual/basics/import_maps](https://docs.deno.com/runtime/manual/basics/import_maps) + Specification: + [https://wicg.github.io/import-maps/](https://wicg.github.io/import-maps/) + Examples: + [https://github.com/WICG/import-maps#the-import-map](https://github.com/WICG/import-maps#the-import-map) - `-q, --quiet` @@ -73,13 +77,18 @@ This command has implicit access to all permissions (--allow-all). - `--vendor[=]` - UNSTABLE: Enables or disables the use of a local vendor folder for remote modules and node_modules folder for npm packages + UNSTABLE: Enables or disables the use of a local vendor folder for remote + modules and node_modules folder for npm packages [possible values: true, false] - `-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) + 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) - `--no-config` @@ -89,13 +98,16 @@ This command has implicit access to all permissions (--allow-all). Reload source code cache (recompile TypeScript). - The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the --reload option. + The `CACHE_BLOCKLIST` is a comma separated list of arguments passed to the + --reload option. - E.g. `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` + E.g. + `--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts` - `--lock []` - Check the specified lock file. If value is not provided, defaults to "deno.lock" in the current working directory. + Check the specified lock file. If value is not provided, defaults to + "deno.lock" in the current working directory. - `--lock-write` @@ -106,8 +118,9 @@ This command has implicit access to all permissions (--allow-all). Disable auto discovery of the lock file - `--cert ` - - Load the certificate from a [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) + + Load the certificate from a + [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) - `--inspect[=]` @@ -115,11 +128,13 @@ This command has implicit access to all permissions (--allow-all). - `--inspect-brk[=]` - Activate inspector on host:port, wait for debugger to connect and break at the start of user script + Activate inspector on host:port, wait for debugger to connect and break at the + start of user script - `--inspect-wait[=]` - Activate inspector on host:port and wait for debugger to connect before running user code + Activate inspector on host:port and wait for debugger to connect before + running user code - `--cached-only` @@ -131,8 +146,8 @@ This command has implicit access to all permissions (--allow-all). - `--v8-flags[=...]` - To see a list of all available flags use --v8-flags=--help. - Any flags set with this flag are appended after the DENO_V8_FLAGS environmental variable + To see a list of all available flags use --v8-flags=--help. Any flags set with + this flag are appended after the DENO_V8_FLAGS environmental variable - `--seed ` @@ -140,7 +155,9 @@ This command has implicit access to all permissions (--allow-all). - `--check[=]` - Enable type-checking. This subcommand does not type-check by default. If the value of '--check=all' is supplied, diagnostic errors from remote modules will be included. + Enable type-checking. This subcommand does not type-check by default. If the + value of '--check=all' is supplied, diagnostic errors from remote modules will + be included. Alternatively, the 'deno check' subcommand can be used. @@ -156,7 +173,9 @@ This command has implicit access to all permissions (--allow-all). - `--env[=]` - UNSTABLE: Load environment variables from local file. Only the first environment variable with a given key is used. Existing process environment variables are not overwritten. + UNSTABLE: Load environment variables from local file. Only the first + environment variable with a given key is used. Existing process environment + variables are not overwritten. - `-h, --help` diff --git a/runtime/manual/tools/lsp.md b/runtime/manual/tools/lsp.md index dd0020788..ca9cb4678 100644 --- a/runtime/manual/tools/lsp.md +++ b/runtime/manual/tools/lsp.md @@ -1,6 +1,7 @@ # deno lsp -Starts the Deno language server. The language server is used by editors to provide features like intellisense, code formatting, and more. +Starts the Deno language server. The language server is used by editors to +provide features like intellisense, code formatting, and more. ## Command @@ -16,12 +17,14 @@ 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. +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. +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). +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 diff --git a/runtime/manual/tools/publish.md b/runtime/manual/tools/publish.md index d6d246355..b3da7d055 100644 --- a/runtime/manual/tools/publish.md +++ b/runtime/manual/tools/publish.md @@ -1,12 +1,13 @@ # deno publish -*This applies to `deno` v1.42.0. and above.* +_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. +`deno publish [OPTIONS]` - Publish the current working directory's package or +workspace. ## Synopsis @@ -20,15 +21,20 @@ 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 `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. +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. +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 `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. @@ -42,67 +48,71 @@ Example: } ``` -Before you publish your package, you must create it in the registry by visiting [JSR - Publish a package](https://jsr.io/new). +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. +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 + 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) + 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 + Suppress diagnostic output - `--no-config` - Disable automatic loading of the configuration file. + Disable automatic loading of the configuration file. - `--dry-run` - Prepare the package for publishing performing all checks and validations without uploading + Prepare the package for publishing performing all checks and validations + without uploading - `--allow-slow-types` - Allow publishing with slow types + Allow publishing with slow types - `--allow-dirty` - Allow publishing if the repository has uncommitted changed + 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. + 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. + 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. + 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 + 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') + Print help (see a summary with '-h') ## Examples @@ -112,7 +122,8 @@ There are no required arguments for this command - it should be run from within deno publish ``` -- Publish your current workspace with a specific token, bypassing interactive authentication +- Publish your current workspace with a specific token, bypassing interactive + authentication ```bash deno publish --token c00921b1-0d4f-4d18-b8c8-ac98227f9275 diff --git a/runtime/manual/tools/run.md b/runtime/manual/tools/run.md index 4413f555a..7811190f2 100644 --- a/runtime/manual/tools/run.md +++ b/runtime/manual/tools/run.md @@ -46,7 +46,8 @@ testing_: deno run -A server.ts ``` -If your project requires multiple security flags you should consider using a [`deno task`](./task_runner) to execute them. +If your project requires multiple security flags you should consider using a +[`deno task`](./task_runner) to execute them. ## Watch diff --git a/runtime/manual/tools/test.md b/runtime/manual/tools/test.md index 632fc9606..40f68efd4 100644 --- a/runtime/manual/tools/test.md +++ b/runtime/manual/tools/test.md @@ -43,7 +43,10 @@ Directory arguments are expanded to all contained files matching the glob The test runner is rich in functionality and supports a number of options. -It can be executed in watch mode (`--watch`), supports parallel execution (`--parallel`), and can be configured to run tests in a random order with (`--shuffle`). Additionally, there is built in support for code coverage (`--coverage`) and leak detection (`--trace-leaks`). +It can be executed in watch mode (`--watch`), supports parallel execution +(`--parallel`), and can be configured to run tests in a random order with +(`--shuffle`). Additionally, there is built in support for code coverage +(`--coverage`) and leak detection (`--trace-leaks`). ## Arguments @@ -58,138 +61,153 @@ Arguments passed to script files ## Options - `--no-check[=]`\ - Skip type-checking. If the value of '--no-check=remote' is supplied, diagnostic errors from remote modules will be ignored. + Skip type-checking. If the value of '--no-check=remote' is supplied, + diagnostic errors from remote modules will be ignored. - `--import-map `\ - Load [import map](https://docs.deno.com/runtime/manual/basics/import_maps) file from local file or remote URL. + Load [import map](https://docs.deno.com/runtime/manual/basics/import_maps) + file from local file or remote URL. -- `-q, --quiet` - Suppress diagnostic output +- `-q, --quiet` Suppress diagnostic output - `--no-remote`\ - Do not resolve remote modules + Do not resolve remote modules - `--no-npm`\ - Do not resolve npm modules + Do not resolve npm modules - `--node-modules-dir[=]`\ - Enables or disables the use of a local node_modules folder for npm packages. - [possible values: true, false] + Enables or disables the use of a local node_modules folder for npm packages. + [possible values: true, false] - `--vendor[=]`\ - UNSTABLE: Enables or disables the use of a local vendor folder for remote modules and node_modules folder for npm packages. - [possible values: true, false] + UNSTABLE: Enables or disables the use of a local vendor folder for remote + modules and node_modules folder for npm packages. [possible values: true, + false] -- `-c, --config ` - The [configuration file](https://deno.land/manual/getting_started/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. +- `-c, --config ` The + [configuration file](https://deno.land/manual/getting_started/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. - `--no-config`\ - Disable automatic loading of the configuration file. - -- `-r, --reload[=...]` - Reload source code cache (recompile TypeScript) - - `--reload` - Reload everything - `--reload=jsr:@std/http/file-server` - Reload only standard modules - `--reload=jsr:@std/http/file-server,jsr:@std/assert/assert-equals` - Reloads specific modules - `--reload=npm:` - Reload all npm modules - `--reload=npm:chalk` - Reload specific npm module + Disable automatic loading of the configuration file. + +- `-r, --reload[=...]` Reload source code cache (recompile + TypeScript) + + `--reload` Reload everything `--reload=jsr:@std/http/file-server` Reload only + standard modules + `--reload=jsr:@std/http/file-server,jsr:@std/assert/assert-equals` Reloads + specific modules `--reload=npm:` Reload all npm modules `--reload=npm:chalk` + Reload specific npm module - `--lock []`\ - Check the specified lock file. If value is not provided, defaults to "deno.lock" in the current working directory. + Check the specified lock file. If value is not provided, defaults to + "deno.lock" in the current working directory. - `--lock-write`\ - Force overwriting the lock file. + Force overwriting the lock file. - `--no-lock`\ - Disable auto discovery of the lock file. + Disable auto discovery of the lock file. - `--cert `\ - Load certificate authority from PEM encoded file + Load certificate authority from PEM encoded file - `--no-prompt`\ - Always throw if required permission wasn't passed + Always throw if required permission wasn't passed - `--inspect[=]`\ - Activate inspector on host:port (default: 127.0.0.1:9229) + Activate inspector on host:port (default: 127.0.0.1:9229) - `--inspect-brk[=]`\ - Activate inspector on host:port, wait for debugger to connect and break at the start of user script + Activate inspector on host:port, wait for debugger to connect and break at the + start of user script - `--inspect-wait[=]`\ - Activate inspector on host:port and wait for debugger to connect before running user code + Activate inspector on host:port and wait for debugger to connect before + running user code - `--cached-only`\ - Require that remote dependencies are already cached + Require that remote dependencies are already cached - `--location `\ - Value of `globalThis.location` used by some web APIs + Value of `globalThis.location` used by some web APIs - `--v8-flags[=...]`\ - To see a list of all available flags use `--v8-flags=--help`. Any flags set with this flag are appended after the `DENO_V8_FLAGS` environmental variable + To see a list of all available flags use `--v8-flags=--help`. Any flags set + with this flag are appended after the `DENO_V8_FLAGS` environmental variable - `--seed `\ - Set the random number generator seed + Set the random number generator seed - `--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. + 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. - `--ignore=...`\ - Ignore files + Ignore files - `--no-run`\ - Cache test modules, but don't run tests + Cache test modules, but don't run tests - `--trace-leaks`\ - Enable tracing of leaks. Useful when debugging leaking ops in test, but impacts test execution time. + Enable tracing of leaks. Useful when debugging leaking ops in test, but + impacts test execution time. - `--doc`\ - Type-check code blocks in JSDoc and Markdown + Type-check code blocks in JSDoc and Markdown - `--fail-fast[=]`\ - Stop after N errors. Defaults to stopping after first failure. + Stop after N errors. Defaults to stopping after first failure. - `--allow-none`\ - Don't return error code if no test files are found + Don't return error code if no test files are found - `--filter `\ - Run tests with this string or pattern in the test name + Run tests with this string or pattern in the test name - `--shuffle[=]`\ - Shuffle the order in which the tests are run + Shuffle the order in which the tests are run - `--coverage[=]`\ - Collect coverage profile data into DIR. If DIR is not specified, it uses `coverage/`. + Collect coverage profile data into DIR. If DIR is not specified, it uses + `coverage/`. - `--parallel`\ - Run test modules in parallel. Parallelism defaults to the number of available CPUs or the value in the DENO_JOBS environment variable. + Run test modules in parallel. Parallelism defaults to the number of available + CPUs or the value in the DENO_JOBS environment variable. - `--watch`\ - Watch for file changes and restart process automatically. Only local files from entry point module graph are watched. + Watch for file changes and restart process automatically. Only local files + from entry point module graph are watched. - `--watch-exclude[=...]`\ - Exclude provided files/patterns from watch mode + Exclude provided files/patterns from watch mode - `--no-clear-screen`\ - Do not clear terminal screen when under watch mode + Do not clear terminal screen when under watch mode - `--junit-path `\ - Write a JUnit XML test report to PATH. Use `-` to write to stdout which is the default when PATH is not provided. + Write a JUnit XML test report to PATH. Use `-` to write to stdout which is the + default when PATH is not provided. - `--reporter `\ - Select reporter to use. Default to 'pretty'. - [possible values: pretty, dot, junit, tap] + Select reporter to use. Default to 'pretty'. [possible values: pretty, dot, + junit, tap] - `--env[=]`\ - UNSTABLE: Load environment variables from local file. Only the first environment variable with a given key is used. Existing process environment variables are not overwritten. + UNSTABLE: Load environment variables from local file. Only the first + environment variable with a given key is used. Existing process environment + variables are not overwritten. - `-h, --help`\ - Prints help information + Prints help information
Permissions Options @@ -264,6 +282,7 @@ Arguments passed to script files - `-A, --allow-all`\ Allow [all permissions](https://deno.land/manual/basics/permissions). +
## Examples diff --git a/runtime/manual/tools/types.md b/runtime/manual/tools/types.md index 52f7d7c15..456560e18 100644 --- a/runtime/manual/tools/types.md +++ b/runtime/manual/tools/types.md @@ -16,8 +16,8 @@ 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. +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 @@ -34,7 +34,7 @@ There are no arguments for this command. Suppress diagnostic output - `-h, --help` - + Print help (see a summary with '-h') ## Examples diff --git a/runtime/manual/tools/uninstall.md b/runtime/manual/tools/uninstall.md index a1e03e258..f51715f0d 100644 --- a/runtime/manual/tools/uninstall.md +++ b/runtime/manual/tools/uninstall.md @@ -30,18 +30,15 @@ The name of the script to uninstall. ## Options -- `--root ` - Installation root +- `--root ` Installation root -- `-g, --global` - Remove globally installed package or module +- `-g, --global` Remove globally installed package or module -- `-q, --quiet` - Suppress diagnostic output +- `-q, --quiet` Suppress diagnostic output - `-h, --help` - Prints help information + Prints help information ## Examples diff --git a/runtime/manual/tools/upgrade.md b/runtime/manual/tools/upgrade.md index 7724bd70e..a0a510c69 100644 --- a/runtime/manual/tools/upgrade.md +++ b/runtime/manual/tools/upgrade.md @@ -17,45 +17,49 @@ deno upgrade -h|--help ## Description -Defaults to the latest version of Deno. The version is downloaded from [https://github.com/denoland/deno/releases](https://github.com/denoland/deno/releases) and is used to replace the current executable. +Defaults to the latest version of Deno. The version is downloaded from +[https://github.com/denoland/deno/releases](https://github.com/denoland/deno/releases) +and is used to replace the current executable. ## Arguments -There are no required arguments for this command - it should be run from within your package or workspace directory. +There are no required arguments for this command - it should be run from within +your package or workspace directory. ## Options - `--version ` - The version to upgrade to + The version to upgrade to - `--output ` - The path to output the updated version to + The path to output the updated version to - `-q, --quiet` - Suppress diagnostic output + Suppress diagnostic output - `--dry-run` - Perform all checks without replacing the old executable + Perform all checks without replacing the old executable - `-f, --force` - Replace current executable even if it is not out of date + Replace current executable even if it is not out of date - `--canary` - Upgrade to canary builds + Upgrade to canary builds - `--cert ` - Load the certificate from a [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) + Load the certificate from a + [PEM encoded file](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) - `-h, --help` - Print help (see a summary with '-h') + Print help (see a summary with '-h') ## Examples diff --git a/runtime/tutorials/fetch_data.md b/runtime/tutorials/fetch_data.md index 56403ada0..f24b5d767 100644 --- a/runtime/tutorials/fetch_data.md +++ b/runtime/tutorials/fetch_data.md @@ -72,7 +72,7 @@ const fileResponse = await fetch("https://deno.land/logo.svg"); if (fileResponse.body) { const file = await Deno.open("./logo.svg", { write: true, create: true }); - + await fileResponse.body.pipeTo(file.writable); } diff --git a/runtime/tutorials/manage_dependencies.md b/runtime/tutorials/manage_dependencies.md index a48826dd6..b3c522cb8 100644 --- a/runtime/tutorials/manage_dependencies.md +++ b/runtime/tutorials/manage_dependencies.md @@ -33,7 +33,7 @@ clean separation between dev and production dependencies. /** * deps.ts * - * This module re-exports the required methods + * This module re-exports the required methods * from the dependant remote Ramda module. */ export { @@ -44,8 +44,8 @@ export { This example has the same functionality as the [local and remote import example](../manual/basics/modules/index.md). However in -this case, instead of the Ramda module being referenced directly, it is referenced -by proxy using a local `deps.ts` module. +this case, instead of the Ramda module being referenced directly, it is +referenced by proxy using a local `deps.ts` module. **Command:** `deno run example.ts` diff --git a/sidebars/runtime.js b/sidebars/runtime.js index dcfaed7e5..e4c5097d5 100644 --- a/sidebars/runtime.js +++ b/sidebars/runtime.js @@ -184,7 +184,7 @@ const sidebars = { type: "doc", label: "deno lint", id: "manual/tools/linter", - }, + }, { type: "doc", label: "deno publish", diff --git a/src/components/DenoByExample/index.tsx b/src/components/DenoByExample/index.tsx index 86f2f0030..2e57aba51 100644 --- a/src/components/DenoByExample/index.tsx +++ b/src/components/DenoByExample/index.tsx @@ -24,8 +24,8 @@ export default function Index({ examplesList }) { const lowerGroup = example.group.toLowerCase(); if (!acc[lowerGroup]) { - acc[lowerGroup] = []; - } + acc[lowerGroup] = []; + } if (!groupMap.find(([category]) => category.toLowerCase() === lowerGroup)) { groupMap.push([example.group.toLowerCase(), "IconFlag3"]); @@ -41,7 +41,7 @@ export default function Index({ examplesList }) { if (!group) { return null; } - + group.sort((a, b) => a.sortOrder - b.sortOrder); return ( diff --git a/src/plugins/deno-by-example/example.ts b/src/plugins/deno-by-example/example.ts index 6ec63a6e0..d204a668b 100644 --- a/src/plugins/deno-by-example/example.ts +++ b/src/plugins/deno-by-example/example.ts @@ -1,216 +1,216 @@ export const TAGS = { - cli: { - title: "cli", - description: "Works in Deno CLI", - }, - deploy: { - title: "deploy", - description: "Works on Deno Deploy", - }, - web: { - title: "web", - description: "Works in on the Web", - }, + cli: { + title: "cli", + description: "Works in Deno CLI", + }, + deploy: { + title: "deploy", + description: "Works on Deno Deploy", + }, + web: { + title: "web", + description: "Works in on the Web", + }, }; export const DIFFICULTIES = { - "beginner": { - title: "Beginner", - description: "No significant prior knowledge is required for this example.", - }, - "intermediate": { - title: "Intermediate", - description: "Some prior knowledge is needed for this example.", - }, + "beginner": { + title: "Beginner", + description: "No significant prior knowledge is required for this example.", + }, + "intermediate": { + title: "Intermediate", + description: "Some prior knowledge is needed for this example.", + }, }; export interface ExampleGroup { - title: string; - icon?: any; - items: Example[]; + title: string; + icon?: any; + items: Example[]; } export interface Example { - id: string; - title: string; - description: string; - difficulty: keyof typeof DIFFICULTIES; - tags: (keyof typeof TAGS)[]; - additionalResources: [string, string][]; - run?: string; - playground?: string; - files: ExampleFile[]; - group: string; + id: string; + title: string; + description: string; + difficulty: keyof typeof DIFFICULTIES; + tags: (keyof typeof TAGS)[]; + additionalResources: [string, string][]; + run?: string; + playground?: string; + files: ExampleFile[]; + group: string; } export interface ExampleFile { - name: string; - snippets: ExampleSnippet[]; + name: string; + snippets: ExampleSnippet[]; } export interface ExampleSnippet { - text: string; - code: string; + text: string; + code: string; } export function parseExample(id: string, file: string): Example { - // Substitute $std/ with the full import url - file = file.replaceAll("$std/", "https://deno.land/std@0.207.0/"); + // Substitute $std/ with the full import url + file = file.replaceAll("$std/", "https://deno.land/std@0.207.0/"); - // Extract the multi line JS doc comment at the top of the file - const [, jsdoc, rest] = file.match(/^\s*\/\*\*(.*?)\*\/\s*(.*)/s) || []; + // Extract the multi line JS doc comment at the top of the file + const [, jsdoc, rest] = file.match(/^\s*\/\*\*(.*?)\*\/\s*(.*)/s) || []; - // Extract the @key value pairs from the JS doc comment - let description = ""; - const kvs: Record = {}; - const resources = []; - for (let line of jsdoc.split("\n")) { - line = line.trim().replace(/^\*/, "").trim(); - const [, key, value] = line.match(/^\s*@(\w+)\s+(.*)/) || []; - if (key) { - if (key === "resource") { - resources.push(value); - } else { - kvs[key] = value.trim(); - } - } else { - description += " " + line; - } + // Extract the @key value pairs from the JS doc comment + let description = ""; + const kvs: Record = {}; + const resources = []; + for (let line of jsdoc.split("\n")) { + line = line.trim().replace(/^\*/, "").trim(); + const [, key, value] = line.match(/^\s*@(\w+)\s+(.*)/) || []; + if (key) { + if (key === "resource") { + resources.push(value); + } else { + kvs[key] = value.trim(); + } + } else { + description += " " + line; } - description = description.trim(); + } + description = description.trim(); - // Separate the code into snippets. - const files: ExampleFile[] = [{ - name: "", - snippets: [], - }]; - let parseMode = "code"; - let currentFile = files[0]; - let text = ""; - let code = ""; + // Separate the code into snippets. + const files: ExampleFile[] = [{ + name: "", + snippets: [], + }]; + let parseMode = "code"; + let currentFile = files[0]; + let text = ""; + let code = ""; - for (const line of rest.split("\n")) { - const trimmedLine = line.trim(); - if (parseMode == "code") { - if (line.startsWith("// File:")) { - if (text || code.trimEnd()) { - code = code.trimEnd(); - currentFile.snippets.push({ text, code }); - text = ""; - code = ""; - } - const name = line.slice(8).trim(); - if (currentFile.snippets.length == 0) { - currentFile.name = name; - } else { - currentFile = { - name, - snippets: [], - }; - files.push(currentFile); - } - } else if (line.startsWith("/* File:")) { - if (text || code.trimEnd()) { - code = code.trimEnd(); - currentFile.snippets.push({ text, code }); - text = ""; - code = ""; - } - const name = line.slice(8).trim(); - if (currentFile.snippets.length == 0) { - currentFile.name = name; - } else { - currentFile = { - name, - snippets: [], - }; - files.push(currentFile); - } - parseMode = "file"; - } else if ( - trimmedLine.startsWith("// deno-lint-ignore") || - trimmedLine.startsWith("//deno-lint-ignore") || - trimmedLine.startsWith("// deno-fmt-ignore") || - trimmedLine.startsWith("//deno-fmt-ignore") - ) { - // skip deno directives - } else if (trimmedLine.startsWith("//-")) { - code += line.replace("//-", "//") + "\n"; - } else if (trimmedLine.startsWith("//")) { - if (text || code.trimEnd()) { - code = code.trimEnd(); - currentFile.snippets.push({ text, code }); - } - text = trimmedLine.slice(2).trim(); - code = ""; - parseMode = "comment"; - } else { - code += line + "\n"; - } - } else if (parseMode == "comment") { - if ( - trimmedLine.startsWith("// deno-lint-ignore") || - trimmedLine.startsWith("//deno-lint-ignore") || - trimmedLine.startsWith("// deno-fmt-ignore") || - trimmedLine.startsWith("//deno-fmt-ignore") - ) { - // skip deno directives - } else if (trimmedLine.startsWith("//")) { - text += " " + trimmedLine.slice(2).trim(); - } else { - code += line + "\n"; - parseMode = "code"; - } - } else if (parseMode == "file") { - if (line == "*/") { - parseMode = "code"; - } else { - code += line + "\n"; - } + for (const line of rest.split("\n")) { + const trimmedLine = line.trim(); + if (parseMode == "code") { + if (line.startsWith("// File:")) { + if (text || code.trimEnd()) { + code = code.trimEnd(); + currentFile.snippets.push({ text, code }); + text = ""; + code = ""; } + const name = line.slice(8).trim(); + if (currentFile.snippets.length == 0) { + currentFile.name = name; + } else { + currentFile = { + name, + snippets: [], + }; + files.push(currentFile); + } + } else if (line.startsWith("/* File:")) { + if (text || code.trimEnd()) { + code = code.trimEnd(); + currentFile.snippets.push({ text, code }); + text = ""; + code = ""; + } + const name = line.slice(8).trim(); + if (currentFile.snippets.length == 0) { + currentFile.name = name; + } else { + currentFile = { + name, + snippets: [], + }; + files.push(currentFile); + } + parseMode = "file"; + } else if ( + trimmedLine.startsWith("// deno-lint-ignore") || + trimmedLine.startsWith("//deno-lint-ignore") || + trimmedLine.startsWith("// deno-fmt-ignore") || + trimmedLine.startsWith("//deno-fmt-ignore") + ) { + // skip deno directives + } else if (trimmedLine.startsWith("//-")) { + code += line.replace("//-", "//") + "\n"; + } else if (trimmedLine.startsWith("//")) { + if (text || code.trimEnd()) { + code = code.trimEnd(); + currentFile.snippets.push({ text, code }); + } + text = trimmedLine.slice(2).trim(); + code = ""; + parseMode = "comment"; + } else { + code += line + "\n"; + } + } else if (parseMode == "comment") { + if ( + trimmedLine.startsWith("// deno-lint-ignore") || + trimmedLine.startsWith("//deno-lint-ignore") || + trimmedLine.startsWith("// deno-fmt-ignore") || + trimmedLine.startsWith("//deno-fmt-ignore") + ) { + // skip deno directives + } else if (trimmedLine.startsWith("//")) { + text += " " + trimmedLine.slice(2).trim(); + } else { + code += line + "\n"; + parseMode = "code"; + } + } else if (parseMode == "file") { + if (line == "*/") { + parseMode = "code"; + } else { + code += line + "\n"; + } } - if (text || code.trimEnd()) { - code = code.trimEnd(); - currentFile.snippets.push({ text, code }); - } + } + if (text || code.trimEnd()) { + code = code.trimEnd(); + currentFile.snippets.push({ text, code }); + } - if (!kvs.title) { - throw new Error("Missing title in JS doc comment."); - } + if (!kvs.title) { + throw new Error("Missing title in JS doc comment."); + } - const tags = kvs.tags.split(",").map((s) => s.trim() as keyof typeof TAGS); - for (const tag of tags) { - if (!TAGS[tag]) { - throw new Error(`Unknown tag '${tag}'`); - } + const tags = kvs.tags.split(",").map((s) => s.trim() as keyof typeof TAGS); + for (const tag of tags) { + if (!TAGS[tag]) { + throw new Error(`Unknown tag '${tag}'`); } + } - const difficulty = kvs.difficulty as keyof typeof DIFFICULTIES; - if (!DIFFICULTIES[difficulty]) { - throw new Error(`Unknown difficulty '${difficulty}'`); - } + const difficulty = kvs.difficulty as keyof typeof DIFFICULTIES; + if (!DIFFICULTIES[difficulty]) { + throw new Error(`Unknown difficulty '${difficulty}'`); + } - const additionalResources: [string, string][] = []; - for (const resource of resources) { - // @resource {https://deno.land/std/http/server.ts} std/http/server.ts - const [_, url, title] = resource.match(/^\{(.*?)\}\s(.*)/) || []; - if (!url || !title) { - throw new Error(`Invalid resource: ${resource}`); - } - additionalResources.push([url, title]); + const additionalResources: [string, string][] = []; + for (const resource of resources) { + // @resource {https://deno.land/std/http/server.ts} std/http/server.ts + const [_, url, title] = resource.match(/^\{(.*?)\}\s(.*)/) || []; + if (!url || !title) { + throw new Error(`Invalid resource: ${resource}`); } + additionalResources.push([url, title]); + } - return { - id, - title: kvs.title, - description, - difficulty, - tags, - additionalResources, - run: kvs.run, - playground: kvs.playground, - files, - group: kvs.group || "Misc", - sortOrder: kvs.sortOrder || 999999 - }; + return { + id, + title: kvs.title, + description, + difficulty, + tags, + additionalResources, + run: kvs.run, + playground: kvs.playground, + files, + group: kvs.group || "Misc", + sortOrder: kvs.sortOrder || 999999, + }; } diff --git a/src/plugins/deno-by-example/plugin.spec.ts b/src/plugins/deno-by-example/plugin.spec.ts index 3d340ab7e..d85300d5b 100644 --- a/src/plugins/deno-by-example/plugin.spec.ts +++ b/src/plugins/deno-by-example/plugin.spec.ts @@ -1,31 +1,33 @@ -import * as vitest from 'vitest' -import denoByExamplePlugin from './plugin'; +import * as vitest from "vitest"; +import denoByExamplePlugin from "./plugin"; vitest.describe("plugin", () => { + let sut; + let context; + let options; + vitest.beforeEach(async () => { + context = { + siteDir: "./", + }; + options = { + id: "by-example", + path: "by-example", + routeBasePath: "/by-example", + }; + }); - let sut; - let context; - let options; - vitest.beforeEach(async () => { - context = { - siteDir: "./" - }; - options = { - id: "by-example", - path: "by-example", - routeBasePath: "/by-example", - }; - }); + vitest.it("doesn't crash parsing the filesystem on execution", async () => { + sut = await denoByExamplePlugin(context, options); + vitest.expect(sut.examples.length).toBeGreaterThan(0); + }); - vitest.it("doesn't crash parsing the filesystem on execution", async () => { - sut = await denoByExamplePlugin(context, options); - vitest.expect(sut.examples.length).toBeGreaterThan(0); - }); + vitest.it( + "adds items to the sidebar for every example generated", + async () => { + sut = await denoByExamplePlugin(context, options); - vitest.it("adds items to the sidebar for every example generated", async () => { - sut = await denoByExamplePlugin(context, options); - - vitest.expect(sut.examples.length).toBeGreaterThan(0); - vitest.expect(sut.examplesList.length).toEqual(sut.examples.length); - }); + vitest.expect(sut.examples.length).toBeGreaterThan(0); + vitest.expect(sut.examplesList.length).toEqual(sut.examples.length); + }, + ); }); diff --git a/src/plugins/deno-by-example/plugin.ts b/src/plugins/deno-by-example/plugin.ts index 0e81dbf67..7c452ee9a 100644 --- a/src/plugins/deno-by-example/plugin.ts +++ b/src/plugins/deno-by-example/plugin.ts @@ -2,84 +2,98 @@ import fs from "node:fs"; import { Example, parseExample } from "./example"; type LoadContext = { - siteDir: string; - generatedFilesDir: string; - siteConfig: any; - outDir: string; - baseUrl: string; + siteDir: string; + generatedFilesDir: string; + siteConfig: any; + outDir: string; + baseUrl: string; }; -type ReturnedContent = { name: string; content: string; label: string; parsed: Example }; - -export default async function denoByExamplePlugin(context: LoadContext, options) { - const denoExamplePath = `${context.siteDir}/by-example`; - const files = fs.readdirSync(denoExamplePath); +type ReturnedContent = { + name: string; + content: string; + label: string; + parsed: Example; +}; - const examples = files.map((file) => { - const fileContent = fs.readFileSync(`${denoExamplePath}/${file}`, "utf-8"); - const example = { - name: file, - content: fileContent, - label: file.replace(".ts", ""), - parsed: parseExample(file, fileContent) - } as ReturnedContent; +export default async function denoByExamplePlugin( + context: LoadContext, + options, +) { + const denoExamplePath = `${context.siteDir}/by-example`; + const files = fs.readdirSync(denoExamplePath); - return example; - }); + const examples = files.map((file) => { + const fileContent = fs.readFileSync(`${denoExamplePath}/${file}`, "utf-8"); + const example = { + name: file, + content: fileContent, + label: file.replace(".ts", ""), + parsed: parseExample(file, fileContent), + } as ReturnedContent; - const examplesList = examples.map((example) => { - return { - id: `examples/${example.label}`, - title: example.parsed.title, - tags: example.parsed.tags, - difficulty: example.parsed.difficulty, - group: example.parsed.group, - sortOrder: example.parsed.sortOrder - }; - }); + return example; + }); + const examplesList = examples.map((example) => { return { - name: "deno-by-example", - examples: examples, - examplesList: examplesList, + id: `examples/${example.label}`, + title: example.parsed.title, + tags: example.parsed.tags, + difficulty: example.parsed.difficulty, + group: example.parsed.group, + sortOrder: example.parsed.sortOrder, + }; + }); - async loadContent() { - return examples; - }, + return { + name: "deno-by-example", + examples: examples, + examplesList: examplesList, - async contentLoaded({ content, actions }) { - const { addRoute, createData } = actions; - const callbackContent = content as Promise[]; + async loadContent() { + return examples; + }, - const examplesListModule = `export default ${JSON.stringify(examplesList)}`; - const examplesListPath = await createData(`exampleList.js`, examplesListModule); + async contentLoaded({ content, actions }) { + const { addRoute, createData } = actions; + const callbackContent = content as Promise[]; - addRoute({ - path: "/examples", - component: '@site/src/components/DenoByExample/index.tsx', - exact: true, - modules: { - examplesList: examplesListPath - } - }); + const examplesListModule = `export default ${ + JSON.stringify(examplesList) + }`; + const examplesListPath = await createData( + `exampleList.js`, + examplesListModule, + ); - for (const example of callbackContent) { - const { name, content, label } = await example; - const url = `/examples/${label}`; + addRoute({ + path: "/examples", + component: "@site/src/components/DenoByExample/index.tsx", + exact: true, + modules: { + examplesList: examplesListPath, + }, + }); - const fileContent = "export default " + JSON.stringify({ name, content }); - const path = await createData(`example-${name}.js`, fileContent); + for (const example of callbackContent) { + const { name, content, label } = await example; + const url = `/examples/${label}`; - addRoute({ - path: url, - component: '@site/src/components/DenoByExample/ByExample.tsx', - exact: true, - modules: { - example: path, - examplesList: examplesListPath - } - }); - } - }, - }; -}; + const fileContent = "export default " + + JSON.stringify({ name, content }); + const path = await createData(`example-${name}.js`, fileContent); + + addRoute({ + path: url, + component: "@site/src/components/DenoByExample/ByExample.tsx", + exact: true, + modules: { + example: path, + examplesList: examplesListPath, + }, + }); + } + }, + }; +} diff --git a/src/theme/DocRoot/Layout/Main/index.js b/src/theme/DocRoot/Layout/Main/index.js index 95bd999c2..32a78eeef 100644 --- a/src/theme/DocRoot/Layout/Main/index.js +++ b/src/theme/DocRoot/Layout/Main/index.js @@ -1,24 +1,28 @@ -import React from 'react'; -import clsx from 'clsx'; -import {useDocsSidebar} from '@docusaurus/theme-common/internal'; -import styles from './styles.module.css'; +import React from "react"; +import clsx from "clsx"; +import { useDocsSidebar } from "@docusaurus/theme-common/internal"; +import styles from "./styles.module.css"; import Footer from "@theme/Footer"; -export default function DocRootLayoutMain({hiddenSidebarContainer, children}) { +export default function DocRootLayoutMain( + { hiddenSidebarContainer, children }, +) { const sidebar = useDocsSidebar(); return (
+ "flex flex-col", + )} + >
+ )} + > {children}