Deno LandDeno

Deploy Docs

deployctl

deployctl allows you to run your Deno Deploy scripts locally on your machine. Your scripts are run in the Deno CLI, with the correct TypeScript types for Deno Deploy. deployctl can be installed using the following command.

Note that you will need to install deno seperatly to be able to run the following command. To do that follow the instructions in the Deno manual.

deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -f https://deno.land/x/deploy/deployctl.ts

Usage

Local development

The most basic usecase is to simply run a script like it would on Deno Deploy:

deployctl run https://deno.land/x/deploy/examples/hello.js

For local development, you can also add the --watch flag to automatically restart the script when any of modules in the module graph change:

deployctl run --watch https://deno.land/x/deploy/examples/hello.js

The --inspect flag for debugging using the Chrome inspector, --no-check flag for skipping type checking, and --reload flag for redownloading dependencies are also supported.

Typechecking in CI

Another common usecase is to type check your Deno Deploy script in CI. To do this you can use the deployctl check command:

deployctl check https://deno.land/x/deploy/examples/hello.js

Reference

Run Deno Deploy scripts locally.

To run a script locally:
  deployctl run https://dash.deno.com/examples/hello.js

To run a script locally and watch changes:
  deployctl run --watch https://dash.deno.com/examples/hello.js

SUBCOMMANDS:
    run       Run a script given a filename or url
    check     Perform type checking of the script without actually running it
    types     Print the Deno Deploy TypeScript declarations

deployctl check

Perform type checking of the given file or url as Deno Deploy script.

To check a script:
  deployctl check https://deno.land/x/deploy/examples/hello.js

To check a script and watch for changes:
  deployctl check --watch https://deno.land/x/deploy/examples/hello.js

USAGE:
    deployctl check [OPTIONS] <ENTRYPOINT>

OPTIONS:
    -h, --help          Prints help information
        --libs=<libs>   The deploy type libs that are loaded (default "ns,window,fetchevent")
    -r, --reload        Reload source code cache (recompile TypeScript)
        --watch         Watch for file changes and restart process automatically

deployctl run

Run a Deno Deploy script locally given a filename or url to the module.

To run a script locally:
  deployctl run https://deno.land/x/deploy/examples/hello.js

To run a script locally and watch for changes:
  deployctl run --watch https://deno.land/x/deploy/examples/hello.js

USAGE:
    deployctl run [OPTIONS] <ENTRYPOINT>

OPTIONS:
        --addr=<addr>          The address to listen on (default ":8080")
        --env=<path/to/.env>   Load envirnoment variables from the provided .env file
    -h, --help                 Prints help information
        --inspect              Activate inspector on 127.0.0.1:9229
        --libs=<libs>          The deploy type libs that are loaded (default "ns,window,fetchevent")
        --no-check             Skip type checking modules
    -r, --reload               Reload source code cache (recompile TypeScript)
        --watch                Watch for file changes and restart process automatically

deployctl types

Print runtime TypeScript declarations.
deployctl types > deployctl.d.ts

The declaration file could be saved and used for typing information.

USAGE:
    deployctl types [OPTIONS]

OPTIONS:
    -h, --help      Prints help information

Please file an issue in our feedback repository if you find any problem in Deploy service or documentation.