You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ioBroker dev-server is a simple command line tool running on Windows, Linux and MacOS that allows you to quickly develop and test ioBroker adapters and their admin interface.
6
+
ioBroker dev-server is a simple command line tool running on Windows, Linux and macOS that allows you to quickly develop and test ioBroker adapters and their admin interface.
7
7
8
-
**Note:** dev-server requires at least Node.js 14.
8
+
> [!NOTE]
9
+
> dev-server requires at least Node.js 14.
9
10
10
11
## Installation
11
12
@@ -16,12 +17,12 @@ dev-server watch
16
17
```
17
18
(a local installation as dev-dependency is also possible)
18
19
19
-
**Note for windows users:**
20
-
If dev-server command is not found, check that the npm directory (typically ;C:\Users\%username%\AppData\Roaming\npm) is included into the PATH variable
20
+
> [!TIP]
21
+
> If the `dev-server` command is not found**under Windows**, check that the npm directory (typically `C:\Users\%username%\AppData\Roaming\npm`) is included in the `PATH` variable.
21
22
22
23
## Features
23
24
24
-
- Runs on all operating systems supported by NodeJS and ioBroker
25
+
- Runs on all operating systems supported by Node.js and ioBroker
25
26
- Support for HTML and React UI
26
27
- Support for JavaScript and TypeScript adapters
27
28
- Hot reload of Admin UI upon any changes to HTML and JavaScript files.
@@ -42,31 +43,34 @@ It is possible to run `dev-server` in the root directory of your local copy of [
42
43
You need to install the `dev-server` package as well as set it up it in the adapter directory.
43
44
44
45
### Install package
45
-
*Before installing please check the following what is the best way or recommended:*
46
+
*Before installing, please check the following what is the best way or recommended:*
46
47
47
48
48
-
1. Linux
49
+
####Linux
49
50
* install it as a dev-dependency of your adapter (recommended)
50
51
* install this tool as a global tool
51
52
52
-
Under Linux it is sometimes useful to install this tool as global BUT best practice for developing an own adapter it is better to install it as dev-dependency
53
+
Under Linux, it is sometimes useful to install this tool as global, BUT best practice for developing an own adapter it is better to install it as dev-dependency
53
54
54
-
2. MacOS
55
-
* Under MacOS be careful with installation as global. This is not recommended so better to install it as dev-depency
55
+
####MacOS
56
+
* Under macOS, be careful with installation as global. This is not recommended so better to install it as a dev-dependency
56
57
57
-
3. Windows
58
+
####Windows
58
59
59
-
* Under Windows a global install is no problem.
60
+
* Under Windows, a global installation is no problem.
60
61
61
-
**Note:** dev-server requires at least Node.js 14.
62
+
> [!NOTE]
63
+
> dev-server requires at least Node.js 14.
62
64
63
-
how to nstall it globally:
65
+
How to install it globally:
64
66
65
67
```bash
66
68
npm install --global @iobroker/dev-server
67
69
```
68
70
69
-
Some more explanation, especially when a **global installation** is problematic **because of permission** issues (e.g. on **MacOS**), you can add the dev-server to your adapter's `devDependencies` and add it e.g. as a script to your package.json.
71
+
#### Installation as a development dependency
72
+
73
+
Some more explanation, especially when a **global installation** is problematic **because of permission** issues (e.g., on **macOS**), you can add the dev-server to your adapter's `devDependencies` and add it e.g., as a script to your package.json.
70
74
71
75
```json
72
76
{
@@ -89,13 +93,14 @@ To set up and configure a local dev-server in your adapter directory, change to
89
93
dev-server setup
90
94
```
91
95
92
-
For additional command line arguments, see blow.
96
+
For additional command line arguments, see below.
93
97
94
-
_Note:_ the executable can either be called with the short name `dev-server` or its full name `iobroker-dev-server`. We will use the first way in this document.
98
+
> [!NOTE]
99
+
> The executable can either be called with the short name `dev-server` or its full name `iobroker-dev-server`. We will use the first way in this document.
95
100
96
101
### Exclude temporary folder
97
102
98
-
By default dev-server creates a temporary directory called `.dev-server` in your adapter directory where all data is stored. This directory must be excluded from NPM and Git.
103
+
By default, dev-server creates a temporary directory called `.dev-server` in your adapter directory where all data is stored. This directory must be excluded from NPM and Git.
99
104
100
105
Your `.gitignore` file must be extended with a single additional line:
101
106
@@ -121,7 +126,7 @@ The following global options are available for all commands:
121
126
122
127
### Profiles
123
128
124
-
All commands (except of course `dev-server profile`) support the `[profile]` command line argument. It allows the user to use choose between different profiles.
129
+
All commands (except of course `dev-server profile`) support the `[profile]` command line argument. It allows the user to choose between different profiles.
125
130
126
131
Each profile is a completely independent instance of ioBroker and can run in parallel with other profiles of the same adapter (if different ports are configured).
127
132
@@ -137,7 +142,7 @@ Set up dev-server in the current directory. This should always be called in the
137
142
138
143
The following options are available:
139
144
140
-
`--adminPort <number>` TCP port on which ioBroker.admin will be available (default: 8081). This port number is also used to generate all other port numbers required to run dev-server. This allows multiple instances of dev-server to run in parallel. It is suggested to use ports in the range of 8000-9999. If you experience connection problems, try a different port.
145
+
`--adminPort <number>` TCP port on which `ioBroker.admin` will be available (default: 8081). This port number is also used to generate all other port numbers required to run dev-server. This allows multiple instances of dev-server to run in parallel. It is suggested to use ports in the range of 8000-9999. If you experience connection problems, try a different port.
141
146
142
147
`--jsController <version>` Define which version of js-controller to be used (default: "latest").
143
148
@@ -157,9 +162,10 @@ If you start the adapter from Admin, be aware that it will use the code uploaded
157
162
158
163
Run dev-server and start the adapter in "watch" mode.
159
164
160
-
The adapter will automatically restart when its source code changes (with a 2seconds delay).
165
+
The adapter will automatically restart when its source code changes (with a 2-seconds delay).
161
166
162
-
**DO NOT** start the adapter manually in ioBroker.admin! If you see errors like ADAPTER_ALREADY_RUNNING then most likely you ignored this info :-)
167
+
> [!IMPORTANT]
168
+
> **DO NOT** start the adapter manually in `ioBroker.admin`! If you see errors like `ADAPTER_ALREADY_RUNNING` then most likely you ignored this info :-)
163
169
164
170
You may attach a debugger to the running adapter. Keep in mind that the debugger will be detached when you change your source code, you need to manually attach again to the new process. Watch the console output for the correct process id to attach to.
165
171
@@ -211,7 +217,7 @@ Lists all available profiles with their meta-data.
211
217
212
218
## IDEs
213
219
214
-
You can of course use dev-server together with you preferred IDE.
220
+
You can, of course, use dev-server together with your preferred IDE.
215
221
216
222
The following chapters all assume you have dev-server installed and set up correctly (see above).
217
223
@@ -239,7 +245,7 @@ When the adapter is ready, you will see a message like the following:
239
245
240
246
You can now attach the Visual Studio Code debugger to the given process ID:
241
247
242
-
- Open the Command Pallette (Ctrl-Shift-P)
248
+
- Open the Command Palette (Ctrl-Shift-P)
243
249
- Choose "Debug: Attach to Node Process (legacy)"
244
250
- Select the right process, it usually looks like follows:
245
251
@@ -248,7 +254,7 @@ node --inspect <path to your dev-server directory>/node_modules/...
248
254
process id: 1234, debug port: 9229
249
255
```
250
256
251
-
Now you can set breakpoints (or they are hit, if you set them before) and inspect your adapter while running.
257
+
Now you can set breakpoints (or they are hit if you set them before) and inspect your adapter while running.
252
258
253
259
#### Launch adapter independently
254
260
@@ -292,11 +298,11 @@ Take note of the two paths and create (or extend) a file called `.vscode/launch.
292
298
293
299
You may now launch this configuration with "Start Debugging" (F5).
294
300
295
-
### Webstorm
301
+
### WebStorm
296
302
297
-
Depending on your preferences, you can either start the adapter with dev-server and then attach your debugger or you can start dev-server and then launch the adapter from Webstorm. Both setups are explained below.
303
+
Depending on your preferences, you can either start the adapter with dev-server and then attach your debugger, or you can start dev-server and then launch the adapter from WebStorm. Both setups are explained below.
298
304
299
-
In order to improve performance of Webstorm, I recommend to exclude the .dev-server directory from the context menu (see screenshot). This will prevent Webstorm from indexing the directory, which could take some time.
305
+
In order to improve the performance of WebStorm, I recommend excluding the `.dev-server` directory from the context menu (see screenshot). This will prevent WebStorm from indexing the directory, which could take some time.
@@ -306,13 +312,13 @@ Now cancel the exclusion for the adapter directory in .dev-server\default\node_m
306
312
307
313
#### Attach to dev-server
308
314
309
-
If you want dev-server to take care of the adapter by building (if needed), uploading, running and relaunching upon changes, start it from the built-in Terminal in Webstorm:
315
+
If you want dev-server to take care of the adapter by building (if needed), uploading, running and relaunching upon changes, start it from the built-in Terminal in WebStorm:
310
316
311
317
```bash
312
318
dev-server watch
313
319
```
314
320
315
-
Setup a launch configuration to attach to the process like this:
321
+
Set up a launch configuration to attach to the process like this:
316
322
317
323

318
324
@@ -326,7 +332,7 @@ When the adapter is ready, you will see a message like the following:
0 commit comments