| sidebar_position | 200 |
|---|---|
| hide_table_of_contents | true |
The DeviceScript command line allows to compile and debug programs from your favorite IDE. The CLI also also usable within containers (Docker, GitHub Codespaces, CodeSandbox, ...).
- install Node.js
- install the CLI using npm or yarn
# yarn
yarn add -D @devicescript/cli#npm developer dependency
npm install @devicescript/cli --save-dev#npm globally
npm install -g -u @devicescript/cliThe command tool is named devicescript or devsc for short.
The full list of options for each command is available through the CLI by running devsc help <command>.
The init commands creates or updates the necessary files to get syntax completion
and checking in DeviceScript project (typically from Visual Studio Code). The command expects to be in the project folder.
devsc initA device script project will look as follows:
.devicescript reserved folder for devicescript generated
/lib supporting runtime types and libraries
/bin compilation file output
.gitignore if you are using git, make sure to ignore .devicescript
main.ts usual name for your entry point application
package.json additional dependencies and also has the `devicescript` field entry
tsconfig.json configure the TypeScript compiler to compile DeviceScript syntax
By default, init will not override existing tsconfig.json. Using this flag, you can override this setting
and force refreshing that file.
devsc init --forceThe build command compiles a DeviceScript file (default is main.ts), using the resolution rules in tsconfig.json. It is the default command.
devsc build main.tsor, for short,
devsc buildThe --stats flag enables printing additional debugging information about code size,
and other useful metrics.
devsc build --statsTo automatically rebuild your program based on file changes,
add --watch.
devsc build --watchWhen the build is run in watch mode, it also opens a developer tool web server that allows to execute the compiled program in a virtual device or physical devices. Follow the console application instructions to open the web page.
To access the developer tools outside localhost, add --internet
devsc build --watch --internetThe devtools command launches the developer tool server, without trying to build a project.
devsc devtoolsTo access the developer tools outside localhost, add --internet
devsc devtools --internet