Scripting with WebStorm (IntelliJ)

This topic describes how to build and run DevWeb scripts using the JetBrains WebStorm (IntelliJ) IDE.

Write DevWeb scripts in WebStorm

You can use the EmptyScript template as a basis for your script.

Autocomplete: If you do not start your script from the EmptyScript template, then in order to activate autocomplete capabilities you should copy DevWebSdk.d.ts from the EmptyScript folder to the script folder: <DevWeb root folder>/examples/EmptyScript.

To set up and write a script:

  1. Copy the EmptyScript folder from <DevWeb root>\examples\ to a location on the same machine as DevWeb.

  2. Rename the folder, for example, MyDevWebProject.
  3. In WebStorm, open the MyDevWebProject project.
  4. In the Project view, under the MyDevWebProject project, open main.js to start writing your code.

Back to top

Enable WebStorm to execute and inspect scripts

When scripting with WebStorm, you can execute and inspect the script using the DevWeb executable, as described in the steps below.

To configure WebStorm to use the DevWeb executable:

  1. Select File > Settings. (On a macOS, select WebStorm > Preference.)
  2. Select Tools > External tools, and click the + button.

  3. Define the relevant parameters.

    To enable script execution on Windows in WebStorm:

    To enable script execution on macOS in WebStorm:

    To enable the web inspector for scripts in WebStorm:

  4. Click OK.

Back to top

Run DevWeb scripts from WebStorm

Select Tools > External Tools > Run DevWeb. The results are displayed in the bottom panel.

To run the script again, click the green Run button.

Back to top

Set up debug configuration

Use the WebStorm debugger to debug your DevWeb scripts.

To configure and activate the debugger in WebStorm:

  1. Open Run menu > Edit Configurations.
  2. Click the + button to add a new configuration.
  3. Select Attach to Node.js/Chrome.
  4. Fill in the details:

    Name DevWeb Script
    Host localhost
    Port 9230

  5. Click OK.
  6. Select Tools > External Tools > Inspect DevWeb. The results are displayed in the bottom panel.

  7. To run the new configuration, select Run > Debug ‘DevWeb Script’.

Back to top

See also: