@theia/cli 1.53.0-next.4 → 1.53.0-next.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +367 -367
- package/bin/theia +2 -2
- package/bin/theia-patch.js +37 -37
- package/lib/download-plugins.d.ts +2 -2
- package/lib/download-plugins.d.ts.map +1 -1
- package/lib/download-plugins.js +2 -4
- package/lib/download-plugins.js.map +1 -1
- package/lib/theia.js +10 -5
- package/lib/theia.js.map +1 -1
- package/package.json +8 -8
- package/patches/@phosphor+widgets+1.9.3.patch +157 -157
- package/patches/@theia+monaco-editor-core+1.83.101.patch +32 -32
- package/src/check-dependencies.ts +328 -328
- package/src/download-plugins.ts +364 -363
- package/src/run-test.ts +87 -87
- package/src/test-page.ts +138 -138
- package/src/theia.ts +691 -686
package/README.md
CHANGED
|
@@ -1,367 +1,367 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - CLI</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Outline
|
|
14
|
-
|
|
15
|
-
- [Outline](#outline)
|
|
16
|
-
- [Description](#description)
|
|
17
|
-
- [Getting Started](#getting-started)
|
|
18
|
-
- [Configure](#configure)
|
|
19
|
-
- [Application Properties](#application-properties)
|
|
20
|
-
- [Default Preferences](#default-preferences)
|
|
21
|
-
- [Default Theme](#default-theme)
|
|
22
|
-
- [Build Target](#build-target)
|
|
23
|
-
- [Electron Frontend Application Config](#electron-frontend-application-config)
|
|
24
|
-
- [Using Latest Builds](#using-latest-builds)
|
|
25
|
-
- [Building](#building)
|
|
26
|
-
- [Build](#build)
|
|
27
|
-
- [Watch](#watch)
|
|
28
|
-
- [Clean](#clean)
|
|
29
|
-
- [Rebuilding Native Modules](#rebuilding-native-modules)
|
|
30
|
-
- [Running](#running)
|
|
31
|
-
- [Debugging](#debugging)
|
|
32
|
-
- [Testing](#testing)
|
|
33
|
-
- [Enabling Tests](#enabling-tests)
|
|
34
|
-
- [Writing Tests](#writing-tests)
|
|
35
|
-
- [Running Tests](#running-tests)
|
|
36
|
-
- [Configuring Tests](#configuring-tests)
|
|
37
|
-
- [Inspecting Tests](#inspecting-tests)
|
|
38
|
-
- [Reporting Test Coverage](#reporting-test-coverage)
|
|
39
|
-
- [Downloading Plugins](#downloading-plugins)
|
|
40
|
-
- [Autogenerated Application](#autogenerated-application)
|
|
41
|
-
- [Additional Information](#additional-information)
|
|
42
|
-
- [License](#license)
|
|
43
|
-
- [Trademark](#trademark)
|
|
44
|
-
|
|
45
|
-
## Description
|
|
46
|
-
|
|
47
|
-
The `@theia/cli` package provides helpful scripts and commands for extension and application development.
|
|
48
|
-
The contributed `theia`, is a command line tool to manage Theia-based applications.
|
|
49
|
-
|
|
50
|
-
## Getting Started
|
|
51
|
-
|
|
52
|
-
Install `@theia/cli` as a dev dependency in your application.
|
|
53
|
-
|
|
54
|
-
With yarn:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
yarn add @theia/cli@next --dev
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
With npm:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npm install @theia/cli@next --save-dev
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Configure
|
|
67
|
-
|
|
68
|
-
A Theia-based application can be configured via the `theia` property as described in the application's `package.json`.
|
|
69
|
-
|
|
70
|
-
### Application Properties
|
|
71
|
-
|
|
72
|
-
It is possible `Application Properties` for a given application.\
|
|
73
|
-
For example, an application can define it's `applicationName` using the following syntax:
|
|
74
|
-
|
|
75
|
-
```json
|
|
76
|
-
"theia": {
|
|
77
|
-
"frontend": {
|
|
78
|
-
"config": {
|
|
79
|
-
"applicationName": "Custom Application Name",
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Default Preferences
|
|
86
|
-
|
|
87
|
-
If required, an application can define for a given preference, the default value.
|
|
88
|
-
For example, an application can update the preference value for `files.enableTrash` based on it's requirements:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
|
|
92
|
-
"theia": {
|
|
93
|
-
"frontend": {
|
|
94
|
-
"config": {
|
|
95
|
-
"preferences": {
|
|
96
|
-
"files.enableTrash": false
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Default Theme
|
|
104
|
-
|
|
105
|
-
Default color and icon themes can be configured in `theia.frontend.config` section:
|
|
106
|
-
```json
|
|
107
|
-
"theia": {
|
|
108
|
-
"frontend": {
|
|
109
|
-
"config": {
|
|
110
|
-
"defaultTheme": "light",
|
|
111
|
-
"defaultIconTheme": "vs-seti"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Build Target
|
|
118
|
-
|
|
119
|
-
The following targets are supported: `browser` and `electron`. By default `browser` target is used.
|
|
120
|
-
The target can be configured in the `package.json` via `theia/target` property, e.g:
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"theia": {
|
|
125
|
-
"target": "electron"
|
|
126
|
-
},
|
|
127
|
-
"dependencies": {
|
|
128
|
-
"@theia/electron": "latest"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
For `electron` target applications, is it mandatory to include **Electron** runtime dependencies. The `@theia/electron` package is the easiest way to install the necessary dependencies.
|
|
134
|
-
|
|
135
|
-
### Electron Frontend Application Config
|
|
136
|
-
|
|
137
|
-
The `electron` frontend application configuration provides configuration options for the `electron` target.\
|
|
138
|
-
The currently supported configurations are:
|
|
139
|
-
|
|
140
|
-
- `disallowReloadKeybinding`: if set to `true`, reloading the current browser window won't be possible with the <kbd>Ctrl/Cmd</kbd> + <kbd>r</kbd> keybinding. It is `false` by default. Has no effect if not in an electron environment.
|
|
141
|
-
- `windowOptions`: override or add properties to the electron `windowOptions`.
|
|
142
|
-
|
|
143
|
-
```json
|
|
144
|
-
{
|
|
145
|
-
"theia": {
|
|
146
|
-
"target": "electron",
|
|
147
|
-
"frontend": {
|
|
148
|
-
"config": {
|
|
149
|
-
"electron": {
|
|
150
|
-
"disallowReloadKeybinding": true,
|
|
151
|
-
"windowOptions": {
|
|
152
|
-
"titleBarStyle": "hidden",
|
|
153
|
-
"webPreferences": {
|
|
154
|
-
"webSecurity": false,
|
|
155
|
-
"nodeIntegration": true,
|
|
156
|
-
"webviewTag": true
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Using Latest Builds
|
|
167
|
-
|
|
168
|
-
If you set `next` in your theia config, then Theia will prefer `next` over `latest` as the latest tag.
|
|
169
|
-
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"theia": {
|
|
173
|
-
"next": "true"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Building
|
|
179
|
-
|
|
180
|
-
### Build
|
|
181
|
-
|
|
182
|
-
The following command can be used to build the application:
|
|
183
|
-
|
|
184
|
-
**Development**
|
|
185
|
-
|
|
186
|
-
theia build --mode development
|
|
187
|
-
|
|
188
|
-
**Production**
|
|
189
|
-
|
|
190
|
-
theia build
|
|
191
|
-
|
|
192
|
-
### Watch
|
|
193
|
-
|
|
194
|
-
The following command can be used to rebuild the application on each change:
|
|
195
|
-
|
|
196
|
-
theia build --watch --mode development
|
|
197
|
-
|
|
198
|
-
### Clean
|
|
199
|
-
|
|
200
|
-
The following command can be used to clean up the build result:
|
|
201
|
-
|
|
202
|
-
In order to clean up the build result:
|
|
203
|
-
|
|
204
|
-
theia clean
|
|
205
|
-
|
|
206
|
-
Arguments are passed directly to [webpack](https://webpack.js.org/). Use `--help` to learn which options are supported.
|
|
207
|
-
|
|
208
|
-
## Rebuilding Native Modules
|
|
209
|
-
|
|
210
|
-
In order to run Electron targets, one should rebuild native node modules for an electron version:
|
|
211
|
-
|
|
212
|
-
theia rebuild
|
|
213
|
-
|
|
214
|
-
To rollback native modules, change the target to `browser` and run the command again.
|
|
215
|
-
|
|
216
|
-
## Running
|
|
217
|
-
|
|
218
|
-
To run the backend server:
|
|
219
|
-
|
|
220
|
-
theia start
|
|
221
|
-
|
|
222
|
-
For the browser target a server is started on http://localhost:3000 by default.
|
|
223
|
-
For the electron target a server is started on `localhost` host with the dynamically allocated port by default.
|
|
224
|
-
|
|
225
|
-
Arguments are passed directly to a server, use `--help` to learn which options are supported.
|
|
226
|
-
|
|
227
|
-
## Debugging
|
|
228
|
-
|
|
229
|
-
To debug the backend server:
|
|
230
|
-
|
|
231
|
-
theia start --inspect
|
|
232
|
-
|
|
233
|
-
Theia CLI accepts `--inspect` node flag: https://nodejs.org/en/docs/inspector/#command-line-options.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
## Testing
|
|
237
|
-
|
|
238
|
-
### Enabling Tests
|
|
239
|
-
|
|
240
|
-
First enable `expose-loader` in `webpack.config.js`
|
|
241
|
-
to expose modules from bundled code to tests
|
|
242
|
-
by un-commenting:
|
|
243
|
-
|
|
244
|
-
```js
|
|
245
|
-
/**
|
|
246
|
-
* Expose bundled modules on window.theia.moduleName namespace, e.g.
|
|
247
|
-
* window['theia']['@theia/core/lib/common/uri'].
|
|
248
|
-
* Such syntax can be used by external code, for instance, for testing.
|
|
249
|
-
config.module.rules.push({
|
|
250
|
-
test: /\.js$/,
|
|
251
|
-
loader: require.resolve('@theia/application-manager/lib/expose-loader')
|
|
252
|
-
}); */
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
After that run `theia build` again to expose modules in generated bundle files.
|
|
256
|
-
|
|
257
|
-
### Writing Tests
|
|
258
|
-
|
|
259
|
-
See [API Integration Testing](../../doc/api-testing.md) docs.
|
|
260
|
-
|
|
261
|
-
### Running Tests
|
|
262
|
-
|
|
263
|
-
To start the backend server and run API tests against it:
|
|
264
|
-
|
|
265
|
-
theia test
|
|
266
|
-
|
|
267
|
-
After running test this command terminates. It accepts the same arguments as `start` command,
|
|
268
|
-
but as well additional arguments to specify test files, enable inspection or generate test coverage.
|
|
269
|
-
|
|
270
|
-
### Configuring Tests
|
|
271
|
-
|
|
272
|
-
To specify test files:
|
|
273
|
-
|
|
274
|
-
theia test . --test-spec=./test/*.spec.js --plugins=./plugins
|
|
275
|
-
|
|
276
|
-
This command starts the application with a current directory as a workspace,
|
|
277
|
-
load VS Code extensions from `./plugins`
|
|
278
|
-
and run test files matching `./test/*.spec.js` glob.
|
|
279
|
-
|
|
280
|
-
Use `theia test --help` to learn more options. Test specific options start with `--test-`.
|
|
281
|
-
|
|
282
|
-
### Inspecting Tests
|
|
283
|
-
|
|
284
|
-
To inspect tests:
|
|
285
|
-
|
|
286
|
-
theia test . --test-spec=./test/*.spec.js --test-inspect --inspect
|
|
287
|
-
|
|
288
|
-
This command starts the application server in the debug mode
|
|
289
|
-
as well as open the Chrome devtools to debug frontend code and test files.
|
|
290
|
-
One can reload/rerun code and tests by simply reloading the page.
|
|
291
|
-
|
|
292
|
-
> Important! Since tests are relying on focus, while running tests keep the page focused.
|
|
293
|
-
|
|
294
|
-
### Reporting Test Coverage
|
|
295
|
-
|
|
296
|
-
To report test coverage:
|
|
297
|
-
|
|
298
|
-
theia test . --test-spec=./test/*.spec.js --test-coverage
|
|
299
|
-
|
|
300
|
-
This command executes tests and generate test coverage files consumable by [Istanbul](https://github.com/istanbuljs/istanbuljs).
|
|
301
|
-
|
|
302
|
-
## Downloading Plugins
|
|
303
|
-
|
|
304
|
-
The `@theia/cli` package provides a utility for applications to define and download a list of plugins it requires as part of their application using the command:
|
|
305
|
-
|
|
306
|
-
theia download:plugins
|
|
307
|
-
|
|
308
|
-
This utility works by declaring in the `package.json` a location to store downloaded plugins, as well as defining each plugin the application wishes to download.
|
|
309
|
-
|
|
310
|
-
The property `theiaPluginsDir` describes the location of which to download plugins (relative to the `package.json`), for example:
|
|
311
|
-
|
|
312
|
-
```json
|
|
313
|
-
"theiaPluginsDir": "plugins",
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
The property `theiaPlugins` describes the list of plugins to download, for example:
|
|
317
|
-
|
|
318
|
-
```json
|
|
319
|
-
"theiaPlugins": {
|
|
320
|
-
"vscode.theme-defaults": "https://open-vsx.org/api/vscode/theme-defaults/1.62.3/file/vscode.theme-defaults-1.62.3.vsix",
|
|
321
|
-
"vscode-builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.50.0/file/eclipse-theia.builtin-extension-pack-1.50.0.vsix",
|
|
322
|
-
"vscode-editorconfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.14.4/file/EditorConfig.EditorConfig-0.14.4.vsix",
|
|
323
|
-
"vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/2.1.1/file/dbaeumer.vscode-eslint-2.1.1.vsix",
|
|
324
|
-
"rust-analyzer": "https://open-vsx.org/api/rust-lang/rust-analyzer/${targetPlatform}/0.4.1473/file/rust-lang.rust-analyzer-0.4.1473@${targetPlatform}.vsix"
|
|
325
|
-
}
|
|
326
|
-
```
|
|
327
|
-
As seen in the `rust-analyzer` entry we can use placeholders in the URLs. Supported placeholders are:
|
|
328
|
-
- The `${targetPlatform}` Placeholder, which resolves to a string like `win32-x64` describing the local system and architecture. This is useful for adding non-universal plugins.
|
|
329
|
-
|
|
330
|
-
Please note that in order to use `extensionPacks` properly you should use `namespace.name` as the `id` you give extensions so that when resolving the pack we do not re-download an existing plugin under a different name.
|
|
331
|
-
|
|
332
|
-
The property `theiaPluginsExcludeIds` can be used to declare the list of plugin `ids` to exclude when using extension-packs.
|
|
333
|
-
The `ids` referenced by the property will not be downloaded when resolving extension-packs, and can be used to omit extensions which are problematic or unwanted. The format of the property is as follows:
|
|
334
|
-
|
|
335
|
-
```json
|
|
336
|
-
"theiaPluginsExcludeIds": [
|
|
337
|
-
"vscode.cpp"
|
|
338
|
-
]
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
## Autogenerated Application
|
|
342
|
-
|
|
343
|
-
This package can auto-generate application code for both the backend and frontend, as well as webpack configuration files.
|
|
344
|
-
|
|
345
|
-
When targeting Electron, the `electron-main.js` script will spawn the backend process in a Node.js sub-process, where Electron's API won't be available. To prevent the generated application from forking the backend, you can pass a `--no-cluster` flag. This flag is mostly useful/used for debugging.
|
|
346
|
-
|
|
347
|
-
```sh
|
|
348
|
-
# when developing a Theia application with @theia/cli:
|
|
349
|
-
yarn theia start --no-cluster
|
|
350
|
-
|
|
351
|
-
# when starting a bundled application made using @theia/cli:
|
|
352
|
-
bundled-application.exe --no-cluster
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## Additional Information
|
|
356
|
-
|
|
357
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
358
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
359
|
-
|
|
360
|
-
## License
|
|
361
|
-
|
|
362
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
363
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
364
|
-
|
|
365
|
-
## Trademark
|
|
366
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
367
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - CLI</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Outline
|
|
14
|
+
|
|
15
|
+
- [Outline](#outline)
|
|
16
|
+
- [Description](#description)
|
|
17
|
+
- [Getting Started](#getting-started)
|
|
18
|
+
- [Configure](#configure)
|
|
19
|
+
- [Application Properties](#application-properties)
|
|
20
|
+
- [Default Preferences](#default-preferences)
|
|
21
|
+
- [Default Theme](#default-theme)
|
|
22
|
+
- [Build Target](#build-target)
|
|
23
|
+
- [Electron Frontend Application Config](#electron-frontend-application-config)
|
|
24
|
+
- [Using Latest Builds](#using-latest-builds)
|
|
25
|
+
- [Building](#building)
|
|
26
|
+
- [Build](#build)
|
|
27
|
+
- [Watch](#watch)
|
|
28
|
+
- [Clean](#clean)
|
|
29
|
+
- [Rebuilding Native Modules](#rebuilding-native-modules)
|
|
30
|
+
- [Running](#running)
|
|
31
|
+
- [Debugging](#debugging)
|
|
32
|
+
- [Testing](#testing)
|
|
33
|
+
- [Enabling Tests](#enabling-tests)
|
|
34
|
+
- [Writing Tests](#writing-tests)
|
|
35
|
+
- [Running Tests](#running-tests)
|
|
36
|
+
- [Configuring Tests](#configuring-tests)
|
|
37
|
+
- [Inspecting Tests](#inspecting-tests)
|
|
38
|
+
- [Reporting Test Coverage](#reporting-test-coverage)
|
|
39
|
+
- [Downloading Plugins](#downloading-plugins)
|
|
40
|
+
- [Autogenerated Application](#autogenerated-application)
|
|
41
|
+
- [Additional Information](#additional-information)
|
|
42
|
+
- [License](#license)
|
|
43
|
+
- [Trademark](#trademark)
|
|
44
|
+
|
|
45
|
+
## Description
|
|
46
|
+
|
|
47
|
+
The `@theia/cli` package provides helpful scripts and commands for extension and application development.
|
|
48
|
+
The contributed `theia`, is a command line tool to manage Theia-based applications.
|
|
49
|
+
|
|
50
|
+
## Getting Started
|
|
51
|
+
|
|
52
|
+
Install `@theia/cli` as a dev dependency in your application.
|
|
53
|
+
|
|
54
|
+
With yarn:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
yarn add @theia/cli@next --dev
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
With npm:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install @theia/cli@next --save-dev
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Configure
|
|
67
|
+
|
|
68
|
+
A Theia-based application can be configured via the `theia` property as described in the application's `package.json`.
|
|
69
|
+
|
|
70
|
+
### Application Properties
|
|
71
|
+
|
|
72
|
+
It is possible `Application Properties` for a given application.\
|
|
73
|
+
For example, an application can define it's `applicationName` using the following syntax:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
"theia": {
|
|
77
|
+
"frontend": {
|
|
78
|
+
"config": {
|
|
79
|
+
"applicationName": "Custom Application Name",
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Default Preferences
|
|
86
|
+
|
|
87
|
+
If required, an application can define for a given preference, the default value.
|
|
88
|
+
For example, an application can update the preference value for `files.enableTrash` based on it's requirements:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
|
|
92
|
+
"theia": {
|
|
93
|
+
"frontend": {
|
|
94
|
+
"config": {
|
|
95
|
+
"preferences": {
|
|
96
|
+
"files.enableTrash": false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Default Theme
|
|
104
|
+
|
|
105
|
+
Default color and icon themes can be configured in `theia.frontend.config` section:
|
|
106
|
+
```json
|
|
107
|
+
"theia": {
|
|
108
|
+
"frontend": {
|
|
109
|
+
"config": {
|
|
110
|
+
"defaultTheme": "light",
|
|
111
|
+
"defaultIconTheme": "vs-seti"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Build Target
|
|
118
|
+
|
|
119
|
+
The following targets are supported: `browser` and `electron`. By default `browser` target is used.
|
|
120
|
+
The target can be configured in the `package.json` via `theia/target` property, e.g:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"theia": {
|
|
125
|
+
"target": "electron"
|
|
126
|
+
},
|
|
127
|
+
"dependencies": {
|
|
128
|
+
"@theia/electron": "latest"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For `electron` target applications, is it mandatory to include **Electron** runtime dependencies. The `@theia/electron` package is the easiest way to install the necessary dependencies.
|
|
134
|
+
|
|
135
|
+
### Electron Frontend Application Config
|
|
136
|
+
|
|
137
|
+
The `electron` frontend application configuration provides configuration options for the `electron` target.\
|
|
138
|
+
The currently supported configurations are:
|
|
139
|
+
|
|
140
|
+
- `disallowReloadKeybinding`: if set to `true`, reloading the current browser window won't be possible with the <kbd>Ctrl/Cmd</kbd> + <kbd>r</kbd> keybinding. It is `false` by default. Has no effect if not in an electron environment.
|
|
141
|
+
- `windowOptions`: override or add properties to the electron `windowOptions`.
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"theia": {
|
|
146
|
+
"target": "electron",
|
|
147
|
+
"frontend": {
|
|
148
|
+
"config": {
|
|
149
|
+
"electron": {
|
|
150
|
+
"disallowReloadKeybinding": true,
|
|
151
|
+
"windowOptions": {
|
|
152
|
+
"titleBarStyle": "hidden",
|
|
153
|
+
"webPreferences": {
|
|
154
|
+
"webSecurity": false,
|
|
155
|
+
"nodeIntegration": true,
|
|
156
|
+
"webviewTag": true
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Using Latest Builds
|
|
167
|
+
|
|
168
|
+
If you set `next` in your theia config, then Theia will prefer `next` over `latest` as the latest tag.
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"theia": {
|
|
173
|
+
"next": "true"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Building
|
|
179
|
+
|
|
180
|
+
### Build
|
|
181
|
+
|
|
182
|
+
The following command can be used to build the application:
|
|
183
|
+
|
|
184
|
+
**Development**
|
|
185
|
+
|
|
186
|
+
theia build --mode development
|
|
187
|
+
|
|
188
|
+
**Production**
|
|
189
|
+
|
|
190
|
+
theia build
|
|
191
|
+
|
|
192
|
+
### Watch
|
|
193
|
+
|
|
194
|
+
The following command can be used to rebuild the application on each change:
|
|
195
|
+
|
|
196
|
+
theia build --watch --mode development
|
|
197
|
+
|
|
198
|
+
### Clean
|
|
199
|
+
|
|
200
|
+
The following command can be used to clean up the build result:
|
|
201
|
+
|
|
202
|
+
In order to clean up the build result:
|
|
203
|
+
|
|
204
|
+
theia clean
|
|
205
|
+
|
|
206
|
+
Arguments are passed directly to [webpack](https://webpack.js.org/). Use `--help` to learn which options are supported.
|
|
207
|
+
|
|
208
|
+
## Rebuilding Native Modules
|
|
209
|
+
|
|
210
|
+
In order to run Electron targets, one should rebuild native node modules for an electron version:
|
|
211
|
+
|
|
212
|
+
theia rebuild
|
|
213
|
+
|
|
214
|
+
To rollback native modules, change the target to `browser` and run the command again.
|
|
215
|
+
|
|
216
|
+
## Running
|
|
217
|
+
|
|
218
|
+
To run the backend server:
|
|
219
|
+
|
|
220
|
+
theia start
|
|
221
|
+
|
|
222
|
+
For the browser target a server is started on http://localhost:3000 by default.
|
|
223
|
+
For the electron target a server is started on `localhost` host with the dynamically allocated port by default.
|
|
224
|
+
|
|
225
|
+
Arguments are passed directly to a server, use `--help` to learn which options are supported.
|
|
226
|
+
|
|
227
|
+
## Debugging
|
|
228
|
+
|
|
229
|
+
To debug the backend server:
|
|
230
|
+
|
|
231
|
+
theia start --inspect
|
|
232
|
+
|
|
233
|
+
Theia CLI accepts `--inspect` node flag: https://nodejs.org/en/docs/inspector/#command-line-options.
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
## Testing
|
|
237
|
+
|
|
238
|
+
### Enabling Tests
|
|
239
|
+
|
|
240
|
+
First enable `expose-loader` in `webpack.config.js`
|
|
241
|
+
to expose modules from bundled code to tests
|
|
242
|
+
by un-commenting:
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
/**
|
|
246
|
+
* Expose bundled modules on window.theia.moduleName namespace, e.g.
|
|
247
|
+
* window['theia']['@theia/core/lib/common/uri'].
|
|
248
|
+
* Such syntax can be used by external code, for instance, for testing.
|
|
249
|
+
config.module.rules.push({
|
|
250
|
+
test: /\.js$/,
|
|
251
|
+
loader: require.resolve('@theia/application-manager/lib/expose-loader')
|
|
252
|
+
}); */
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
After that run `theia build` again to expose modules in generated bundle files.
|
|
256
|
+
|
|
257
|
+
### Writing Tests
|
|
258
|
+
|
|
259
|
+
See [API Integration Testing](../../doc/api-testing.md) docs.
|
|
260
|
+
|
|
261
|
+
### Running Tests
|
|
262
|
+
|
|
263
|
+
To start the backend server and run API tests against it:
|
|
264
|
+
|
|
265
|
+
theia test
|
|
266
|
+
|
|
267
|
+
After running test this command terminates. It accepts the same arguments as `start` command,
|
|
268
|
+
but as well additional arguments to specify test files, enable inspection or generate test coverage.
|
|
269
|
+
|
|
270
|
+
### Configuring Tests
|
|
271
|
+
|
|
272
|
+
To specify test files:
|
|
273
|
+
|
|
274
|
+
theia test . --test-spec=./test/*.spec.js --plugins=./plugins
|
|
275
|
+
|
|
276
|
+
This command starts the application with a current directory as a workspace,
|
|
277
|
+
load VS Code extensions from `./plugins`
|
|
278
|
+
and run test files matching `./test/*.spec.js` glob.
|
|
279
|
+
|
|
280
|
+
Use `theia test --help` to learn more options. Test specific options start with `--test-`.
|
|
281
|
+
|
|
282
|
+
### Inspecting Tests
|
|
283
|
+
|
|
284
|
+
To inspect tests:
|
|
285
|
+
|
|
286
|
+
theia test . --test-spec=./test/*.spec.js --test-inspect --inspect
|
|
287
|
+
|
|
288
|
+
This command starts the application server in the debug mode
|
|
289
|
+
as well as open the Chrome devtools to debug frontend code and test files.
|
|
290
|
+
One can reload/rerun code and tests by simply reloading the page.
|
|
291
|
+
|
|
292
|
+
> Important! Since tests are relying on focus, while running tests keep the page focused.
|
|
293
|
+
|
|
294
|
+
### Reporting Test Coverage
|
|
295
|
+
|
|
296
|
+
To report test coverage:
|
|
297
|
+
|
|
298
|
+
theia test . --test-spec=./test/*.spec.js --test-coverage
|
|
299
|
+
|
|
300
|
+
This command executes tests and generate test coverage files consumable by [Istanbul](https://github.com/istanbuljs/istanbuljs).
|
|
301
|
+
|
|
302
|
+
## Downloading Plugins
|
|
303
|
+
|
|
304
|
+
The `@theia/cli` package provides a utility for applications to define and download a list of plugins it requires as part of their application using the command:
|
|
305
|
+
|
|
306
|
+
theia download:plugins
|
|
307
|
+
|
|
308
|
+
This utility works by declaring in the `package.json` a location to store downloaded plugins, as well as defining each plugin the application wishes to download.
|
|
309
|
+
|
|
310
|
+
The property `theiaPluginsDir` describes the location of which to download plugins (relative to the `package.json`), for example:
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
"theiaPluginsDir": "plugins",
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
The property `theiaPlugins` describes the list of plugins to download, for example:
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
"theiaPlugins": {
|
|
320
|
+
"vscode.theme-defaults": "https://open-vsx.org/api/vscode/theme-defaults/1.62.3/file/vscode.theme-defaults-1.62.3.vsix",
|
|
321
|
+
"vscode-builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.50.0/file/eclipse-theia.builtin-extension-pack-1.50.0.vsix",
|
|
322
|
+
"vscode-editorconfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.14.4/file/EditorConfig.EditorConfig-0.14.4.vsix",
|
|
323
|
+
"vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/2.1.1/file/dbaeumer.vscode-eslint-2.1.1.vsix",
|
|
324
|
+
"rust-analyzer": "https://open-vsx.org/api/rust-lang/rust-analyzer/${targetPlatform}/0.4.1473/file/rust-lang.rust-analyzer-0.4.1473@${targetPlatform}.vsix"
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
As seen in the `rust-analyzer` entry we can use placeholders in the URLs. Supported placeholders are:
|
|
328
|
+
- The `${targetPlatform}` Placeholder, which resolves to a string like `win32-x64` describing the local system and architecture. This is useful for adding non-universal plugins.
|
|
329
|
+
|
|
330
|
+
Please note that in order to use `extensionPacks` properly you should use `namespace.name` as the `id` you give extensions so that when resolving the pack we do not re-download an existing plugin under a different name.
|
|
331
|
+
|
|
332
|
+
The property `theiaPluginsExcludeIds` can be used to declare the list of plugin `ids` to exclude when using extension-packs.
|
|
333
|
+
The `ids` referenced by the property will not be downloaded when resolving extension-packs, and can be used to omit extensions which are problematic or unwanted. The format of the property is as follows:
|
|
334
|
+
|
|
335
|
+
```json
|
|
336
|
+
"theiaPluginsExcludeIds": [
|
|
337
|
+
"vscode.cpp"
|
|
338
|
+
]
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Autogenerated Application
|
|
342
|
+
|
|
343
|
+
This package can auto-generate application code for both the backend and frontend, as well as webpack configuration files.
|
|
344
|
+
|
|
345
|
+
When targeting Electron, the `electron-main.js` script will spawn the backend process in a Node.js sub-process, where Electron's API won't be available. To prevent the generated application from forking the backend, you can pass a `--no-cluster` flag. This flag is mostly useful/used for debugging.
|
|
346
|
+
|
|
347
|
+
```sh
|
|
348
|
+
# when developing a Theia application with @theia/cli:
|
|
349
|
+
yarn theia start --no-cluster
|
|
350
|
+
|
|
351
|
+
# when starting a bundled application made using @theia/cli:
|
|
352
|
+
bundled-application.exe --no-cluster
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Additional Information
|
|
356
|
+
|
|
357
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
358
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
359
|
+
|
|
360
|
+
## License
|
|
361
|
+
|
|
362
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
363
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
364
|
+
|
|
365
|
+
## Trademark
|
|
366
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
367
|
+
https://www.eclipse.org/theia
|