CLI
The Juno CLI provides a variety of tools for managing and deploying projects.
Installing the Juno CLI
To download and install Juno CLI, run the following command:
npm i -g @junobuild/cli
Administration
Commands dedicated to configuring and managing deployed Satellites, Mission Control, and other modules.
The CLI automatically runs in non-interactive mode if either a JUNO_TOKEN
is set or the --headless
argument is used.
The former is set when you set up a GitHub Actions.
Login
Authenticating your terminal saves sensitive information on your device. We recommend setting up a password to encrypt this file when prompted.
Generate an authentication for use in non-interactive environments.
Usage: juno login [options]
Options:
-b, --browser A particular browser to open. supported: chrome|firefox|edge.
-h, --help Output usage information.
The authentication process requires a browser.
If you've previously authenticated your terminal and decide to log in again, the CLI will prompt you about reusing your existing identity.
This allows you to reuse your authorization, especially when creating new modules like satellites or orbiters.
How does it work?
A new principal is generated on your local machine and added as a controller of the selected modules. This principal is then used to authenticate any CLI calls made from your terminal to your satellites, mission controls or other modules.
The key is saved in the OS-specific user's variables path.
OS | Path |
---|---|
Mac | ~/Library/Preferences/juno-nodejs |
Windows | %APPDATA%\juno-nodejs\Config (for example, C:\Users\USERNAME\AppData\Roaming\juno-nodejs\Config ) |
Linux | ~/.config/juno-nodejs (or $XDG_CONFIG_HOME/juno-nodejs ) |
Logout
This action currently does not remove the controllers from satellites and/or mission control and/or orbiter. It only logs out your local machine by removing the locally saved key (principal).
Log out of the current device. ⚠️ This action does not remove controllers from the module.
Usage: juno logout [options]
Options:
-h, --help Output usage information.
Init
Set up your project.
Usage: juno init [options]
Options:
-m, --minimal Skip few prompts and generate a config file with a placeholder satellite ID.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
The juno init
command creates a juno.config
file in the root directory of your project.
Depending on your project, it will either create a TypeScript, JavaScript, or JSON file.
We recommend using the first two options because they can leverage your IDE's IntelliSense with type hints.
This file is necessary for deploying, configuring, or running any other CLI commands for your app.
Read more about the configuration.
Deploy
Deploy your dapp to your satellite.
Usage: juno deploy [options]
Options:
-c, --clear Clear existing dapp files before proceeding with deployment.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Config
Apply configuration to satellite.
Usage: juno config [options]
Options:
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Snapshot
Handle snapshot-related tasks.
Usage: juno snapshot <subcommand> [options]
Subcommands:
create Create a snapshot of your current state.
restore Restore a previously created snapshot.
delete Delete an existing snapshot.
Options:
-t, --target Which module type should be snapshotted? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Notes:
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
Stop
Stop a module.
Usage: juno stop [options]
Options:
-t, --target Which module type should be stopped? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Notes:
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
Start
Start a module.
Usage: juno start [options]
Options:
-t, --target Which module type should be started? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Notes:
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
Clear
Clear existing dapp code by removing JavaScript, HTML, CSS, and other files from your satellite.
Usage: juno clear [options]
Options:
-f, --fullPath Clear a particular file of your dapp.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
This command removes existing files from the satellite and only affects the app assets. The user's uploaded files will not be cleared as the app is deployed to a reserved collection, #dapp
.
Upgrade
Upgrade a module to a new version.
Usage: juno upgrade [options]
Options:
-t, --target Which module type should be upgraded? Valid targets are satellite, mission-control or orbiter.
-s, --src An optional local gzipped WASM file for the upgrade. By default, the CDN will be used.
-r, --reset Reset to the initial state.
-cc, --clear-chunks Clear any previously uploaded WASM chunks (applies if the WASM size is greater than 2MB).
-ns, --no-snapshot Skip creating a snapshot before upgrading.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Notes:
- Resetting a mission control is not possible.
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
- We recommend that you stay current with the Juno releases, as some features may not perform correctly in the console if your smart contracts are outdated.
- Upgrading requires a stable internet connection for a successful process.
The CLI automatically runs in non-interactive mode if either a JUNO_TOKEN is set or the --headless argument is used.
Development
Handle development tasks like building serverless functions or running a local Internet Computer instance.
Usage: juno dev <subcommand> [options]
Subcommands:
build Build your serverless functions. The local server supports live reloading.
eject Scaffold the necessary files to start coding and building functions in your project.
start Start a local Internet Computer network in a container.
stop Stop the local network.
Find more about local development and extending features with serverless functions in the related guide.
Build
Build your serverless functions.
Usage: juno dev build [options]
Options:
-l, --lang Specify the language for building the serverless functions: rust, typescript or javascript.
-p, --path Path to the source to bundle.
-w, --watch Rebuild your functions automatically when source files change.
-h, --help Output usage information.
Notes:
- If no language is provided, the CLI attempts to determine the appropriate build.
- Language can be shortened to rs for Rust, ts for TypeScript and mjs for JavaScript.
- The path option maps to --manifest-path for Rust (Cargo) or to the source file for TypeScript and JavaScript (e.g. index.ts or index.mjs).
- The watch option rebuilds when source files change, with a default debounce delay of 10 seconds; optionally, pass a delay in milliseconds.
Eject
Generate the required files to begin developing serverless functions in your project.
Usage: juno dev eject [options]
Options:
-l, --lang Specify the language for building the serverless functions: rust, typescript or javascript.
-h, --help Output usage information.
Notes:
- Language can be shortened to rs for Rust, ts for TypeScript and mjs for JavaScript.
Others
Additional commands for managing and interacting with the CLI environment.
Open
Open your satellite in your browser.
Usage: juno open [options]
Options:
-b, --browser A particular browser to open. supported: chrome|firefox|edge.
-c, --console Open satellite in the console.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Use
Switch between multiple profiles.
Usage: juno use [options]
Options:
-p, --profile The profile that should be use.
-l, --list What are the available profiles.
-h, --help Output usage information.
Version
Check the version of the modules and CLI.
Usage: juno init [options]
Options:
-c, --cli Check only the version of the CLI.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
Who am I?
Display your current profile, controller, and links to your satellite.
Usage: juno whoami [options]
Options:
-h, --help Output usage information.
-m, --mode Set env mode. For example production or a custom string. Default is production.