Skip to content

Commit

Permalink
make electron runtime deps optional
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed Apr 11, 2019
1 parent 7d37b12 commit d4d8967
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 29 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cache:
# start_cache_directories
- dev-packages/application-manager/node_modules
- dev-packages/application-package/node_modules
- dev-packages/electron/node_modules
- examples/browser/node_modules
- examples/electron/node_modules
- node_modules
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Breaking changes:
- [core] support native keyboard layouts [#4724](https://github.com/theia-ide/theia/pull/4724)
- [node] moved to using Node.js version 10, dropping support for Node.js version 8.
- [electron] removed cluster mode and startup timeout setting
- [electron] make Electron runtime dependencies optional [#4873](https://github.com/theia-ide/theia/pull/4873)
- [dialog] `validate` and `accept` methods are now Promisified [#4764](https://github.com/theia-ide/theia/pull/4764)
- [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:
Expand Down
12 changes: 0 additions & 12 deletions dev-packages/application-manager/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion dev-packages/application-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
},
"dependencies": {
"@theia/application-package": "^0.5.0",
"@theia/electron": "^0.5.0",
"@types/fs-extra": "^4.0.2",
"bunyan": "^1.8.10",
"circular-dependency-plugin": "^5.0.0",
"copy-webpack-plugin": "^4.5.0",
"css-loader": "^0.28.1",
"electron": "^3.1.7",
"electron-rebuild": "^1.5.11",
"file-loader": "^1.1.11",
"font-awesome-webpack": "0.0.5-beta.2",
Expand Down
10 changes: 10 additions & 0 deletions dev-packages/application-package/src/application-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { ExtensionPackageCollector } from './extension-package-collector';
import { ApplicationProps } from './application-props';
import { environment } from './environment';

// tslint:disable:no-implicit-dependencies

// tslint:disable-next-line:no-any
export type ApplicationLog = (message?: any, ...optionalParams: any[]) => void;
export class ApplicationPackageOptions {
Expand All @@ -46,6 +48,14 @@ export class ApplicationPackage {
this.projectPath = options.projectPath;
this.log = options.log || console.log.bind(console);
this.error = options.error || console.error.bind(console);
if (this.isElectron()) {
const { version } = require('../package.json');
try {
require('@theia/electron/package.json');
} catch {
console.warn(`please install @theia/electorn@${version} as a runtime dependency`);
}
}
}

protected _registry: NpmRegistry | undefined;
Expand Down
5 changes: 5 additions & 0 deletions dev-packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ The target can be configured in package.json via `theia/target` property, e.g:
{
"theia": {
"target": "electron"
},
"dependencies": {
"@theia/electron": "latest"
}
}
```

For `electron` target make sure to install required Electron runtime dependenices. The easiest way is to install `@theia/electron` package.

### Using latest builds

If you set `next` in your theia config, then Theia will prefer `next` over `latest` as the latest tag.
Expand Down
7 changes: 7 additions & 0 deletions dev-packages/electron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Electron runtimed dependencies for Theia.

This package has to be installed for `electron` [application target](dev-packages/cli/README.md#build-target).

## License
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
23 changes: 23 additions & 0 deletions dev-packages/electron/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@theia/electron",
"version": "0.5.0",
"description": "Electron runtime dependencies for Theia",
"publishConfig": {
"access": "public"
},
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
"repository": {
"type": "git",
"url": "https://github.com/theia-ide/theia.git"
},
"bugs": {
"url": "https://github.com/theia-ide/theia/issues"
},
"homepage": "https://github.com/theia-ide/theia",
"dependencies": {
"electron": "^3.1.7",
"electron-store": "^2.0.0",
"fix-path": "^2.1.0",
"native-keymap": "^1.2.5"
}
}
4 changes: 0 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@
"@types/yargs": "^11.1.0",
"ajv": "^6.5.3",
"body-parser": "^1.17.2",
"electron": "^3.1.7",
"electron-store": "^2.0.0",
"es6-promise": "^4.2.4",
"express": "^4.16.3",
"file-icons-js": "^1.0.3",
"fix-path": "^2.1.0",
"font-awesome": "^4.7.0",
"fuzzy": "^0.1.3",
"inversify": "^4.14.0",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"native-keymap": "^1.2.5",
"nsfw": "^1.2.2",
"perfect-scrollbar": "^1.3.0",
"react": "^16.4.1",
Expand Down
14 changes: 2 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2409,7 +2409,7 @@ [email protected]:
dependencies:
graceful-readlink ">= 1.0.0"

commander@^2.19.0:
commander@^2.19.0, commander@~2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
Expand All @@ -2418,11 +2418,6 @@ commander@~2.13.0:
version "2.13.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"

commander@~2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==

commander@~2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4"
Expand Down Expand Up @@ -7693,7 +7688,7 @@ progress-stream@^1.1.0:
speedometer "~0.1.2"
through2 "~0.2.3"

[email protected]:
[email protected], progress@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
Expand All @@ -7702,11 +7697,6 @@ progress@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"

progress@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==

prom-client@^10.2.0:
version "10.2.3"
resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-10.2.3.tgz#a51bf21c239c954a6c5be4b1361fdd380218bb41"
Expand Down

0 comments on commit d4d8967

Please sign in to comment.