diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-04-16 23:15:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 18:15:42 -0400 |
commit | 5bfe3eb8f49f5d6eed2e6d4436b8c75dd4b4ad26 (patch) | |
tree | a589b555b9ac700b7864b30c44b39b5a84269087 /std/manual.md | |
parent | d359789c529d3c7b5fab5471309eaa4b75fc0bfd (diff) |
feat(cli/installer.rs): Add DENO_INSTALL_ROOT (#4787)
Diffstat (limited to 'std/manual.md')
-rw-r--r-- | std/manual.md | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/std/manual.md b/std/manual.md index 0381aaf2a..e80a56872 100644 --- a/std/manual.md +++ b/std/manual.md @@ -874,14 +874,14 @@ Or you could import it into another ES module to consume: ### Installing executable scripts -Deno provides ability to easily install and distribute executable code via -`deno install` command. +Deno provides `deno install` to easily install and distribute executable code. `deno install [FLAGS...] [EXE_NAME] [URL] [SCRIPT_ARGS...]` will install the script available at `URL` under the name `EXE_NAME`. -This command is a thin wrapper that creates executable shell scripts which -invoke `deno` with specified permissions and CLI flags. +This command creates a thin, executable shell script which invokes `deno` using +the specified CLI flags and main module. It is place in the installation root's +`bin` directory. Example: @@ -893,36 +893,37 @@ $ deno install --allow-net --allow-read file_server https://deno.land/std/http/f /Users/deno/.deno/bin/file_server ``` -By default scripts are installed at `$HOME/.deno/bin` or -`$USERPROFILE/.deno/bin` and one of that directories must be added to the path -manually. +To change the installation root, use `--root`: ```shell -$ echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc +$ deno install --allow-net --allow-read --root /usr/local file_server https://deno.land/std/http/file_server.ts ``` -Installation directory can be changed using `-d/--dir` flag: +The installation root is determined, in order of precedence: + +- `--root` option +- `DENO_INSTALL_ROOT` environment variable +- `$HOME/.deno` + +These must be added to the path manually if required. ```shell -$ deno install --allow-net --allow-read --dir /usr/local/bin file_server https://deno.land/std/http/file_server.ts +$ echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc ``` -When installing a script you can specify permissions that will be used to run -the script. - -Example: +You must specify permissions that will be used to run the script at installation +time. ```shell $ deno install --allow-net --allow-read file_server https://deno.land/std/http/file_server.ts 8080 ``` -Above command creates an executable called `file_server` that runs with write -and read permissions and binds to port 8080. +The above command creates an executable called `file_server` that runs with +write and read permissions and binds to port 8080. -It is a good practice to use `import.meta.main` idiom for an entry point for -executable file. See -[Testing if current file is the main program](#testing-if-current-file-is-the-main-program) -section. +For good practice, use the +[`import.meta.main`](#testing-if-current-file-is-the-main-program) idiom to +specify the entry point in an executable script. Example: |