Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions docs/cli-reference/dfx-bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# dfx bootstrap {#_dfx_bootstrap}

Use the `dfx bootstrap` command to start the bootstrap web server defined in the `dfx.json` configuration file or specified using command-line options.

The bootstrap web server you specify is used to serve the front-end static assets for your project.

## Basic usage {#_basic_usage}

``` bash
dfx bootstrap [option]
```

## Flags {#_flags}

You can use the following optional flags with the `dfx bootstrap` command.

| Flag | Description |
-----------------------|-----------------------------------------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

## Options {#_options}

You can specify the following options for the `dfx bootstrap` command.

| Option | Description |
-----------------------|-----------------|
| `ip` <ip_address\> | Specifies the IP address that the bootstrap server listens on. If you don't specify an IP address, the `address` setting you have configured in the `dfx.json` configuration file is used. By default, the server address is 127.0.0.1. |
| \--network <network\> | Specifies the network to connect to if you want to override the default local network endpoint (`http://127.0.0.1:8080/api`).|
| \--port <port\> | Specifies the port number that the bootstrap server listens on. By default, port number 8081 is used. |
| \--root <root\> | Specifies the directory containing static assets served by the bootstrap server. By default, the path to static assets is: `$HOME/.cache/dfinity/versions/$DFX_VERSION/js-user-library/dist/bootstrap`. |
| \--timeout <timeout\> | Specifies the maximum amount of time, in seconds, the bootstrap server will wait for upstream requests to complete. By default, the bootstrap server waits for a maximum of 30 seconds. |

## Examples {#_examples}

You can use the `dfx bootstrap` command to start a web server for your application using custom settings, including a specific server address, port number, and static asset location.

For example, to start the bootstrap server using a specific IP address and port number, you would run a command similar to the following:

``` bash
dfx bootstrap --ip 192.168.47.1 --port 5353
```

The command displays output similar to the following:

``` bash
binding to: V4(192.168.47.1:5353)
replica(s): \http://127.0.0.1:8080/api
Webserver started...
```

To use the default server address and port number but specify a custom location for static assets and longer timeout period, you might run a command similar to the following:

``` bash
dfx bootstrap --root $HOME/ic-projects/assets --timeout 60
```

You can use CTRL-C to stop the bootstrap server.
60 changes: 60 additions & 0 deletions docs/cli-reference/dfx-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# dfx build

Use the `dfx build` command to compile your program into a WebAssembly module that can be deployed on the IC. You can use this command to compile all of the programs that are defined for a project in the project’s `dfx.json` configuration file or a specific canister.

Note that you can only run this command from within the project directory structure. For example, if your project name is `hello_world`, your current working directory must be the `hello_world` top-level project directory or one of its subdirectories.

The `dfx build` command looks for the source code to compile using the information you have configured under the `canisters` section in the `dfx.json` configuration file.

## Basic usage

``` bash
dfx build [flag] [option] [--all | canister_name]
```

## Flags

You can use the following optional flags with the `dfx build` command.

| Flag | Description |
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--check` | Builds canisters using a temporary, hard-coded, locally-defined canister identifier for testing that your program compiles without connecting to the IC. |
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

## Options

You can specify the following option for the `dfx build` command.

| Option | Description |
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--network <network>` | Specifies the network alias or URL you want to connect to. You can use this option to override the network specified in the `dfx.json` configuration file. |

## Arguments

You can specify the following arguments for the `dfx build` command.

| Argument | Description |
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--all` | Builds all of the canisters configured in the project’s `dfx.json` file. |
| `canister_name` | Specifies the name of the canister you want to build. If you are not using the `--all` option, you can continue to use `dfx build` or provide a canister name as an argument (the canister name must match at least one name that you have configured in the `canisters` section of the `dfx.json` configuration file for your project.) |

## Examples

You can use the `dfx build` command to build one or more WebAssembly modules from the programs specified in the `dfx.json` configuration file under the `canisters` key. For example, if your `dfx.json` configuration file defines one `hello_world` canister and one `hello_world_assets` canister [like this](../_attachments/sample-dfx.json), then running `dfx build` compiles two WebAssembly modules.

Note that the file name and path to the programs on your file system must match the information specified in the `dfx.json` configuration file.

In this example, the `hello_world` canister contains the main program code and the `hello_world_assets` canister store frontend code and assets. If you want to keep the `hello_world_assets` canister defined in the `dfx.json` file, but only build the backend program, you could run the following command:

``` bash
dfx build hello_world
```

Building a specific canister is useful when you have multiple canisters defined in the dfx.json file, but want to test and debug operations for canisters independently.

To test whether a canister compiles without connecting to the IC or the local canister execution environment, you would run the following command:

``` bash
dfx build --check
```
157 changes: 157 additions & 0 deletions docs/cli-reference/dfx-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# dfx cache

Use the `dfx cache` command with flags and subcommands to manage the `dfx` version cache.

The basic syntax for running `dfx cache` commands is:

``` bash
dfx cache [subcommand] [flag]
```

Depending on the `dfx cache` subcommand you specify, additional arguments, options, and flags might apply. For reference information and examples that illustrate using `dfx cache` commands, select an appropriate command.

| Command | Description |
|----------------------------|-------------------------------------------------------------------------------|
| [`delete`](#delete) | Deletes the specified version of `dfx` from the local cache. |
| `help` | Displays usage information message for a specified subcommand. |
| [`install`](#install) | Installs the specified version of `dfx` from the local cache. |
| [`list`](#_dfx_cache_list) | Lists the versions of `dfx` currently installed and used in current projects. |
| [`show`](#_dfx_cache_show) | Show the path of the cache used by this version of the `dfx` executable. |

To view usage information for a specific subcommand, specify the subcommand and the `--help` flag. For example, to see usage information for `dfx cache delete`, you can run the following command:

``` bash
dfx cache delete --help
```

## dfx cache delete

Use the `dfx cache delete` command to delete a specified version of `dfx` from the version cache on the local computer.

### Basic usage

``` bash
dfx cache delete [version] [flag]
```

### Flags

You can use the following optional flags with the `dfx cache delete` command.

| Flag | Description |
|-------------------|-------------------------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

### Arguments

You can specify the following argument for the `dfx cache delete` command.

| Command | Description |
|-----------|--------------------------------------------------------------------|
| `version` | Specifies the version of `dfx` you to delete from the local cache. |

### Examples

You can use the `dfx cache delete` command to permanently delete versions of `dfx` that you no longer want to use. For example, you can run the following command to delete `dfx` version `0.6.2`:

``` bash
dfx cache delete 0.6.2
```

## dfx cache install

Use the `dfx cache install` command to install `dfx` using the version currently found in the `dfx` cache.

### Basic usage

``` bash
dfx cache install [flag]
```

### Flags

You can use the following optional flags with the `dfx cache install` command.

| Flag | Description |
|-------------------|-------------------------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

### Examples

You can use the `dfx cache install` command to force the installation of `dfx` from the version in the cache. For example, you can run the following command to install `dfx`:

``` bash
dfx cache install
```

## dfx cache list

Use the `dfx cache list` command to list the `dfx` versions you have currently installed and used in projects.

If you have multiple versions of `dfx` installed, the cache list displays an asterisk (\*) to indicate the currently active version.

### Basic usage

``` bash
dfx cache list [flag]
```

### Flags

You can use the following optional flags with the `dfx cache list` command.

| Flag | Description |
|-------------------|-------------------------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

### Examples

You can use the `dfx cache list` command to list the `dfx` versions you have currently installed and used in projects. For example, you can run the following command to list versions of `dfx` found in the cache:

``` bash
dfx cache list
```

This command displays the list of `dfx` versions found similar to the following:

``` bash
0.6.4 *
0.6.3
0.6.0
```

## dfx cache show

Use the `dfx cache show` command to display the full path to the cache used by the `dfx` version you are currently using.

### Basic usage

``` bash
dfx cache show [flag]
```

### Flags

You can use the following optional flags with the `dfx cache show` command.

| Flag | Description |
|-------------------|-------------------------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

### Examples

You can use the `dfx cache show` command to display the path to the cache used by the `dfx` version you are currently using:

``` bash
dfx cache show
```

This command displays the path to the cache used by the `dfx` version you are currently using:

``` bash
/Users/pubs/.cache/dfinity/versions/0.6.4
```
Loading