Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[electron] Update Theia to use Electron 3.x and Node 10.x #4750

Merged
merged 2 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ports:
- port: 3000
tasks:
- init: yarn install
command: cd examples/browser && yarn start --hostname 0.0.0.0 ../..
- init: nvm install 10 && nvm use 10 && yarn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do not we install 10.15.3 if the documentation says: "Preferably, use version 10.15.3"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what issues do you see with using latest node 10? before we were using latest node 8, seemed to work just fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the same in travis config btw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just do not understand why do we recommend a version in the documentation but do not stick to it in the gitpod script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Electron ships with Node 10.15.3, there is a slight danger you could introduce incompatibilities if you build using a newer version, however I wouldn't want to restrict people to a specific release otherwise.

This was the same with Electron 2, you can't override the node version it uses.

IMO, the current set up gives the user the right amount of flexibility.

command: yarn --cwd examples/browser start ../..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will eventually fix #4818 too but you have to restore --hostname 0.0.0.0, don't you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitpod is capable to auto expose localhost now, providing hostname is redundant.

github:
prebuilds:
pullRequestsFromForks: true
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sudo: required
language: node_js
node_js: '8'
node_js: '10'
thegecko marked this conversation as resolved.
Show resolved Hide resolved
git:
depth: 1
cache:
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

- [filesystem] added the menu item `Upload Files...` to easily upload files into a workspace
- [workspace] allow creation of files and folders using recursive paths
- [electron] upgraded version of electron used to version 3.

Breaking changes:

- [node] moved to using Node.js version 10, dropping support for Node.js version 8.
- [dialog] `validate` and `accept` methods are now Promisified [#4764](https://github.com/theia-ide/theia/pull/4764)

Breaking changes:
- [editor] turn off autoSave by default to align with VS Code [#4777](https://github.com/theia-ide/theia/pull/4777)
- default settings can be overriden in application package.json:
```json
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ shallow_clone: true

environment:
matrix:
- nodejs_version: "8"
- nodejs_version: "10"

platform:
- x64
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/application-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"circular-dependency-plugin": "^5.0.0",
"copy-webpack-plugin": "^4.5.0",
"css-loader": "^0.28.1",
"electron": "^2.0.14",
"electron": "^3.1.7",
"electron-rebuild": "^1.5.11",
"file-loader": "^1.1.11",
"font-awesome-webpack": "0.0.5-beta.2",
Expand Down
7 changes: 3 additions & 4 deletions doc/Developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ For Windows instructions [click here](#building-on-windows).
- [Root privileges errors](#root-privileges-errors)

## Prerequisites
- Node.js `>= 8.x`, `< 9.x`.
- Preferably, **use** version `8.11.4`, it has the [active LTS](https://github.com/nodejs/Release).
- Node.js `9.x` is untested.
- Node.js `10.x` is **not** supported yet due to a known issue in [`nsfw`](https://github.com/theia-ide/theia/issues/2009).
- Node.js `>= 10.2.0`.
- Preferably, **use** version `10.15.3`, it has the [active LTS](https://github.com/nodejs/Release).
- Node.js `11.x` is untested.
- [Yarn package manager](https://yarnpkg.com/en/docs/install) v1.7.0
- git (If you would like to use the Git-extension too, you will need to have git version 2.11.0 or higher.)

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"version": "0.0.0",
"engines": {
"yarn": "1.0.x || >=1.2.1",
"node": ">=8.9.3"
"node": ">=10.2.0"
},
"resolution": {
"**/@types/node": "8.10.20"
"**/@types/node": "~10.3.6"
},
"devDependencies": {
"@types/chai": "^4.0.1",
"@types/chai-string": "^1.4.0",
"@types/jsdom": "^11.0.4",
"@types/mocha": "^2.2.41",
"@types/node": "8.10.20",
"@types/node": "~10.3.6",
"@types/sinon": "^2.3.5",
"@types/temp": "^0.8.29",
"@types/webdriverio": "^4.7.0",
Expand All @@ -39,7 +39,7 @@
"typedoc-plugin-external-module-map": "^1.0.0",
"typescript": "^3.1.3",
"uuid": "^3.1.0",
"wdio-mocha-framework": "0.5.13",
"wdio-mocha-framework": "0.6.4",
"wdio-selenium-standalone-service": "0.0.12",
"wdio-spec-reporter": "0.1.5",
"webdriverio": "4.14.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/yargs": "^11.1.0",
"ajv": "^6.5.3",
"body-parser": "^1.17.2",
"electron": "^2.0.14",
"electron": "^3.1.7",
"electron-store": "^2.0.0",
"es6-promise": "^4.2.4",
"express": "^4.16.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/browser/tree/tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ describe('Tree', () => {
const expectedRefreshedNodes = new Set([
retrieveNode<CompositeTreeNode>('1'),
retrieveNode<CompositeTreeNode>('1.1'),
retrieveNode<CompositeTreeNode>('1.2'),
retrieveNode<CompositeTreeNode>('1.2.1')]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a race condition here where not all nodes are deleted before the refresh() promise returns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a hard time with this one but why this test was OK before migration to node 10 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the race simply gets further in different Node versions :/

retrieveNode<CompositeTreeNode>('1.2')]);
model.onNodeRefreshed((e: Readonly<CompositeTreeNode>) => {
result = result && expectedRefreshedNodes.has(e);
expectedRefreshedNodes.delete(e);
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/node/backend-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ILogger, ContributionProvider, MaybePromise } from '../common';
import { CliContribution } from './cli';
import { Deferred } from '../common/promise-util';
import { environment } from '../common/index';
import { AddressInfo } from 'net';

export const BackendApplicationContribution = Symbol('BackendApplicationContribution');
export interface BackendApplicationContribution {
Expand Down Expand Up @@ -185,7 +186,7 @@ export class BackendApplication {

server.listen(port, hostname, () => {
const scheme = this.cliParams.ssl ? 'https' : 'http';
this.logger.info(`Theia app listening on ${scheme}://${hostname || 'localhost'}:${server.address().port}.`);
this.logger.info(`Theia app listening on ${scheme}://${hostname || 'localhost'}:${(server.address() as AddressInfo).port}.`);
deferred.resolve(server);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as http from 'http';
import * as https from 'https';
import { WebSocketChannel } from '../../../common/messaging/web-socket-channel';
import { Disposable } from '../../../common/disposable';
import { AddressInfo } from 'net';

export class TestWebSocketChannel extends WebSocketChannel {

Expand All @@ -27,7 +28,7 @@ export class TestWebSocketChannel extends WebSocketChannel {
path: string
}) {
super(0, content => socket.send(content));
const socket = new ws(`ws://localhost:${server.address().port}${WebSocketChannel.wsPath}`);
const socket = new ws(`ws://localhost:${(server.address() as AddressInfo).port}${WebSocketChannel.wsPath}`);
socket.on('error', error =>
this.fireError(error)
);
Expand Down
3 changes: 2 additions & 1 deletion packages/git/src/electron-node/askpass/askpass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MaybePromise } from '@theia/core/lib/common/types';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { GitPrompt } from '../../common/git-prompt';
import { DugiteGitPromptServer } from '../../node/dugite-git-prompt';
import { AddressInfo } from 'net';

/**
* Environment for the Git askpass helper.
Expand Down Expand Up @@ -89,7 +90,7 @@ export class Askpass implements Disposable {
return new Promise<Address>(resolve => {
this.server.on('error', err => this.logger.error(err));
this.server.listen(0, this.hostname(), () => {
resolve(this.server.address());
resolve(this.server.address() as AddressInfo);
});
});
} catch (err) {
Expand Down
5 changes: 3 additions & 2 deletions packages/java/src/node/java-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { JAVA_LANGUAGE_ID, JAVA_LANGUAGE_NAME, JavaStartParams } from '../common
import { JavaCliContribution } from './java-cli-contribution';
import { ContributionProvider } from '@theia/core';
import { JavaExtensionContribution } from './java-extension-model';
import { AddressInfo } from 'net';
const sha1 = require('sha1');

export type ConfigurationType = 'config_win' | 'config_mac' | 'config_linux';
Expand Down Expand Up @@ -137,8 +138,8 @@ export class JavaContribution extends BaseLanguageServerContribution {
this.logInfo('logs at ' + path.resolve(workspacePath, '.metadata', '.log'));
const env = Object.create(process.env);
const address = server.address();
env.CLIENT_HOST = address.address;
env.CLIENT_PORT = address.port;
env.CLIENT_HOST = (address as AddressInfo).address;
env.CLIENT_PORT = (address as AddressInfo).port;
const serverConnection = await this.createProcessSocketConnection(socket, socket, command, args, { env });
this.forward(clientConnection, serverConnection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class MarkdownPreviewHandler implements PreviewHandler {
if (!elementToReveal) {
return;
}
elementToReveal.scrollIntoView({ behavior: 'instant' });
elementToReveal.scrollIntoView();
Copy link
Member

@akosyakov akosyakov Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexTugarev What are consequences of this change? Could you review the preview extension in this PR?

I wonder why it's affected. It's not part of Node.js, but DOM api.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov, instant scroll behavior was experimental, apparently they removed it leaving smooth and auto. this change shouldn't make any difference.

fyi, instant was in place just to make sure it isn't using smooth by default, which would be bogus as it's not an atomic operation.

}

findElementForFragment(content: HTMLElement, link: string): HTMLElement | undefined {
Expand Down
4 changes: 2 additions & 2 deletions packages/preview/src/browser/preview-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class PreviewWidget extends BaseWidget implements Navigatable {
const elementToReveal = this.previewHandler.findElementForFragment(this.node, uri.fragment);
if (elementToReveal) {
this.preventScrollNotification = true;
elementToReveal.scrollIntoView({ behavior: 'instant' });
elementToReveal.scrollIntoView();
window.setTimeout(() => {
this.preventScrollNotification = false;
}, 50);
Expand All @@ -225,7 +225,7 @@ export class PreviewWidget extends BaseWidget implements Navigatable {
const elementToReveal = this.previewHandler.findElementForSourceLine(this.node, sourceLine);
if (elementToReveal) {
this.preventScrollNotification = true;
elementToReveal.scrollIntoView({ behavior: 'instant' });
elementToReveal.scrollIntoView();
window.setTimeout(() => {
this.preventScrollNotification = false;
}, 50);
Expand Down
6 changes: 3 additions & 3 deletions packages/process/src/node/raw-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export class RawProcess extends Process {
);
});

this.output = this.process.stdout;
this.input = this.process.stdin;
this.errorOutput = this.process.stderr;
this.output = this.process.stdout || new DevNullStream();
this.input = this.process.stdin || new DevNullStream();
this.errorOutput = this.process.stderr || new DevNullStream();

if (this.process.pid !== undefined) {
process.nextTick(() => {
Expand Down