Skip to content

Commit

Permalink
updating tutorial files (denoland#845)
Browse files Browse the repository at this point in the history
Co-authored-by: Marvin Hagemeister <[email protected]>
  • Loading branch information
thisisjofrank and marvinhagemeister authored Sep 17, 2024
1 parent 1a80726 commit da64ba0
Show file tree
Hide file tree
Showing 52 changed files with 141 additions and 255 deletions.
1 change: 1 addition & 0 deletions _config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ site.copy("runtime/tutorials/images");
site.copy("deploy/manual/images");
site.copy("deno.json");
site.copy("go.json");
site.copy("oldurls.json");
site.copy("server.ts");
site.copy("middleware.ts");
site.copy("examples");
Expand Down
2 changes: 1 addition & 1 deletion examples/command-line-arguments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Command Line Arguments
* @title Command line arguments
* @difficulty beginner
* @tags cli
* @run <url> Deno Sushi --help --version=1.0.0 --no-color
Expand Down
2 changes: 1 addition & 1 deletion examples/create-remove-directories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Creating & Removing Directories
* @title Creating & removing directories
* @difficulty beginner
* @tags cli
* @run --allow-write <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/deleting-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Deleting Files
* @title Deleting files
* @difficulty beginner
* @tags cli
* @resource {https://docs.deno.com/api/deno/~/Deno.remove} Doc: Deno.remove
Expand Down
27 changes: 0 additions & 27 deletions examples/dependency-management.ts

This file was deleted.

2 changes: 1 addition & 1 deletion examples/dns-queries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Running DNS Queries
* @title Running DNS queries
* @difficulty beginner
* @tags cli, deploy
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/environment-variables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Environment Variables
* @title Environment variables
* @difficulty beginner
* @tags cli, deploy
* @run --allow-env <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Hello World
* @title Hello world
* @difficulty beginner
* @tags cli, deploy, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/hex-base64-encoding.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Hex and Base64 Encoding
* @title Hex and base64 encoding
* @difficulty beginner
* @tags cli
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-requests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Requests
* @title HTTP requests
* @difficulty beginner
* @tags cli, deploy, web
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Server: Serving Files
* @title HTTP server: Serving files
* @difficulty intermediate
* @tags cli, deploy
* @run --allow-net --allow-read <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server-routing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Server: Routing
* @title HTTP server: Routing
* @difficulty intermediate
* @tags cli, deploy
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server-streaming.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Server: Streaming
* @title HTTP server: Streaming
* @difficulty intermediate
* @tags cli, deploy
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server-websocket.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Server: WebSockets
* @title HTTP server: WebSockets
* @difficulty intermediate
* @tags cli, deploy
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title HTTP Server: Hello World
* @title HTTP Server: Hello world
* @difficulty intermediate
* @tags cli, deploy
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/import-export.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Importing & Exporting
* @title Importing & exporting
* @difficulty beginner
* @tags cli, deploy
* @resource {/examples/dependency-management} Example: Dependency Management
Expand Down
2 changes: 1 addition & 1 deletion examples/kv-watch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Deno KV Watch
* @title Deno KV watch
* @difficulty intermediate
* @tags cli, deploy
* @run --unstable-kv <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/kv.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Deno KV: Key/Value Database
* @title Deno KV: Key/Value database
* @difficulty intermediate
* @tags cli, deploy
* @run --unstable-kv <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/moving-renaming-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Moving/Renaming Files
* @title Moving/Renaming files
* @difficulty beginner
* @tags cli
* @run --allow-read=./ --allow-write=./ <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/os-signals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Handling OS Signals
* @title Handling OS signals
* @difficulty beginner
* @tags cli
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/permissions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Permission Management
* @title Permission management
* @difficulty beginner
* @tags cli
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/pid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Process Information
* @title Process information
* @difficulty beginner
* @tags cli
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/piping-streams.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Piping Streams
* @title Piping streams
* @difficulty intermediate
* @tags cli
* @run --allow-net --allow-read --allow-write <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/prompts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Input Prompts
* @title Input prompts
* @difficulty beginner
* @tags cli, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/queues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Deno Queues
* @title Deno queues
* @difficulty intermediate
* @tags cli, deploy
* @run --unstable-kv <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/reading-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Reading Files
* @title Reading files
* @difficulty beginner
* @tags cli, deploy
* @run --allow-read <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/streaming-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Streaming File Operations
* @title Streaming file operations
* @difficulty intermediate
* @tags cli
* @run --allow-read --allow-write <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/subprocesses-output.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Subprocesses: Collecting Output
* @title Subprocesses: Collecting output
* @difficulty intermediate
* @tags cli
* @run --allow-run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/symlinks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Creating & Resolving Symlinks
* @title Creating & resolving symlinks
* @difficulty beginner
* @tags cli
* @run --allow-write --allow-read <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp-connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title TCP Connector: Ping
* @title TCP connector: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp-listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title TCP Listener: Ping
* @title TCP listener: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/temporary-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Temporary Files & Directories
* @title Temporary files & directories
* @difficulty beginner
* @tags cli
* @run --allow-read --allow-write <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/timers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Timeouts & Intervals
* @title Timeouts & intervals
* @difficulty beginner
* @tags cli, deploy, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title TCP/TLS Connector: Ping
* @title TCP/TLS connector: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net --allow-read <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title TCP/TLS Listener: Ping
* @title TCP/TLS listener: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net --allow-read <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/udp-connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title UDP Connector: Ping
* @title UDP connector: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net --unstable-net <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/udp-listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title UDP Listener: Ping
* @title UDP listener: Ping
* @difficulty intermediate
* @tags cli
* @run --allow-net --unstable-net <url>
Expand Down
19 changes: 19 additions & 0 deletions examples/unix-cat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @title Unix cat
* @difficulty beginner
* @tags cli
* @run --allow-read cat.ts file1 file2
* @resource {https://docs.deno.com/api/deno/~/Deno.args} Deno args API docs
* @resource {https://docs.deno.com/api/deno/~/Deno.open} Deno open API docs
* @resource {https://docs.deno.com/api/deno/~/Deno.stdout} Deno stdout API docs
* @resource {https://docs.deno.com/api/deno/~/Deno.FsFile#property_readable} Deno File System API docs
* @group File System
*
* In Unix, the `cat` command is a utility that reads files and writes them to standard output. You can use Deno to mimic the behavior of the `cat` command. <br><br> In this program each command-line argument is assumed to be a filename, the file is opened, and printed to stdout (e.g. the console).
*/

// Create a script that reads the contents of one or more files and writes them to standard output.
for (const filename of Deno.args) {
const file = await Deno.open(filename);
await file.readable.pipeTo(Deno.stdout.writable, { preventClose: true });
}
2 changes: 1 addition & 1 deletion examples/url-parsing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Manipulating & Parsing URLs
* @title Manipulating & parsing URLs
* @difficulty beginner
* @tags cli, deploy, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/uuids.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Generating & Validating UUIDs
* @title Generating & validating UUIDs
* @difficulty beginner
* @tags cli, deploy, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/web-workers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Web Workers
* @title Web workers
* @difficulty intermediate
* @tags cli, web
* @resource {https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers} MDN: Web Workers
Expand Down
2 changes: 1 addition & 1 deletion examples/webassembly.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Web Assembly
* @title Web assembly
* @difficulty intermediate
* @tags cli, deploy, web
* @run <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/writing-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Writing Files
* @title Writing files
* @difficulty beginner
* @tags cli
* @run --allow-read --allow-write <url>
Expand Down
2 changes: 1 addition & 1 deletion examples/writing-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title Writing Tests
* @title Writing tests
* @difficulty beginner
* @tags cli
* @run deno test --allow-read --allow-write <url>
Expand Down
5 changes: 5 additions & 0 deletions oldurls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"/runtime/manual/examples/read_write_files/": "/examples/",
"/runtime/tutorials/unix_cat/": "/examples/unix-cat/",
"/examples/dependency-management/": "/runtime/fundamentals/configuration/#dependencies"
}
5 changes: 3 additions & 2 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ export const sidebar = [
"/runtime/tutorials/init_project/",
"/runtime/tutorials/fetch_data/",
"/runtime/tutorials/http_server/",
"/runtime/tutorials/read_write_files/",
"/examples/reading-files/",
"/examples/writing-files/",
"/runtime/tutorials/hashbang/",
"/runtime/tutorials/cjs_to_esm/",
"/runtime/tutorials/connecting_to_databases/",
{
label: "Advanced Examples",
items: [
"/runtime/tutorials/unix_cat/",
"/examples/unix-cat/",
"/runtime/tutorials/file_server/",
"/runtime/tutorials/tcp_echo/",
"/runtime/tutorials/subprocess/",
Expand Down
2 changes: 1 addition & 1 deletion runtime/reference/cli/bundler.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use [deno_emit](https://github.com/denoland/deno_emit),
Deno, which includes all dependencies of the specified input. For example:

```bash
deno bundle https://deno.land/[email protected]/examples/colors.tsts colors.bundle.js
$ deno bundle https://deno.land/[email protected]/examples/colors.tsts colors.bundle.js
Bundle https://deno.land/[email protected]/examples/colors.ts
Download https://deno.land/[email protected]/examples/colors.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Expand Down
Loading

0 comments on commit da64ba0

Please sign in to comment.