Skip to content

Commit

Permalink
[vscode] add builtins to example applications
Browse files Browse the repository at this point in the history
- adds the vscode `builtin` extensions to the example applications (browser, and electron).
- missing extension functionality will need to be replaced by appropriate vscode extensions.

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Jan 21, 2020
1 parent 7097574 commit e9449a0
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 23 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cache:
- /tmp/vscode-ripgrep-cache-1.5.7
- dev-packages/application-manager/node_modules
- dev-packages/application-package/node_modules
- dev-packages/cli/node_modules
- dev-packages/electron/node_modules
- examples/api-samples/node_modules
- examples/browser/node_modules
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

Breaking changes:

- Updated `example-browser` and `example-electron` applications to remove extensions which are instead contributed by VS Code builtin extensions [#6883](https://github.com/eclipse-theia/theia/pull/6883)
- Extensions removed from the example applications are deprecated and will be removed in the future. If adopters/extenders would like to continue
using the deprecated extensions, they must be self-maintained and can be accessed through the repository's Git history.
- In order to fetch plugins remotely, the `@theia/cli` script `download:plugins` can be used:
- In your `package.json` you can define:
- `theiaPluginDir`: to specify the folder in which to download plugins, in respect to your `package.json`
- `theiaPlugins`: to specify the list of plugins in the form of `"id": "url"`
- [core] removed `virtual-renderer`. `react-renderer` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885)
- [core] removed `virtual-widget`. `react-widget` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885)
- [task] renamed method `getStrigifiedTaskSchema()` has been renamed to `getStringifiedTaskSchema()` [#6780](https://github.com/eclipse-theia/theia/pull/6780)
Expand Down
6 changes: 6 additions & 0 deletions dev-packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
"dependencies": {
"@theia/application-manager": "^0.14.0",
"@theia/application-package": "^0.14.0",
"@types/mkdirp": "^0.5.2",
"@types/requestretry": "^1.12.3",
"mkdirp": "^0.5.0",
"requestretry": "^3.1.0",
"tar": "^4.0.0",
"unzip-stream": "^0.3.0",
"yargs": "^11.1.0"
}
}
93 changes: 93 additions & 0 deletions dev-packages/cli/src/download-plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/********************************************************************************
* Copyright (C) 2020 Ericsson and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import * as fs from 'fs';
import * as path from 'path';
import * as process from 'process';
import * as request from 'requestretry';
import * as mkdirp from 'mkdirp';
import * as tar from 'tar';
import * as zlib from 'zlib';

const unzip = require('unzip-stream');

export default function downloadPlugins(): void {

console.log('Downloading plugins...');

// Resolve the `package.json` at the current working directory.
const pck = require(path.resolve(process.cwd(), 'package.json'));

// Resolve the directory for which to download the plugins.
const pluginsDir = pck.theiaPluginsDir || 'plugins';

for (const plugin in pck.theiaPlugins) {
if (!plugin) {
continue;
}
const targetPath = path.join(process.cwd(), pluginsDir, plugin);

// Skip plugins which have previously been downloaded.
if (!isDownloaded(targetPath)) {
console.log(plugin + ': already downloaded');
continue;
}

const pluginUrl = pck.theiaPlugins[plugin];
console.log(plugin + ': downloading from ' + pluginUrl);

const download: request.RequestPromise = request({
...pck.requestOptions,
url: pluginUrl,
maxAttempts: 5,
retryDelay: 2000,
retryStrategy: request.RetryStrategies.HTTPOrNetworkError
// tslint:disable-next-line:no-any
}, (err: any, response: any) => {
if (err) {
console.error(plugin + ': failed to download', err);
} else {
console.log(plugin + ': downloaded successfully' + (response.attempts > 1 ? ` after ${response.attempts} attempts` : ''));
}
});

if (pluginUrl.endsWith('gz')) {
mkdirp(targetPath, () => { });
const gunzip = zlib.createGunzip({
finishFlush: zlib.Z_SYNC_FLUSH,
flush: zlib.Z_SYNC_FLUSH
});
const untar = tar.x({ cwd: targetPath });
download.pipe(gunzip).pipe(untar);
} else {
download.pipe(unzip.Extract({ path: targetPath }));
}
}
}

/**
* Determine if the resource for the given path is already downloaded.
* @param path the resource path.
*
* @returns `true` if the resource is already downloaded, else `false`.
*/
function isDownloaded(dirPath: fs.PathLike): boolean {
try {
return !fs.readdirSync(dirPath).length;
} catch (e) {
return true;
}
}
4 changes: 3 additions & 1 deletion dev-packages/cli/src/theia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as yargs from 'yargs';
import { ApplicationPackageManager, rebuild } from '@theia/application-manager';
import { ApplicationProps } from '@theia/application-package';
import checkHoisted from './check-hoisting';
import downloadPlugins from './download-plugins';

process.on('unhandledRejection', (reason, promise) => {
throw reason;
Expand Down Expand Up @@ -139,7 +140,8 @@ function rebuildCommand(command: string, target: ApplicationProps.Target): yargs
process.exit(1);
}
}
});
})
.command({ command: 'download:plugins', handler: () => downloadPlugins() });

// see https://github.com/yargs/yargs/issues/287#issuecomment-314463783
// tslint:disable-next-line:no-any
Expand Down
9 changes: 0 additions & 9 deletions examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@
"@theia/console": "^0.14.0",
"@theia/core": "^0.14.0",
"@theia/debug": "^0.14.0",
"@theia/debug-nodejs": "^0.14.0",
"@theia/editor": "^0.14.0",
"@theia/editor-preview": "^0.14.0",
"@theia/editorconfig": "^0.14.0",
"@theia/file-search": "^0.14.0",
"@theia/filesystem": "^0.14.0",
"@theia/getting-started": "^0.14.0",
"@theia/git": "^0.14.0",
"@theia/java": "^0.14.0",
"@theia/java-debug": "^0.14.0",
"@theia/json": "^0.14.0",
"@theia/keymaps": "^0.14.0",
"@theia/languages": "^0.14.0",
"@theia/markers": "^0.14.0",
"@theia/merge-conflicts": "^0.14.0",
"@theia/messages": "^0.14.0",
"@theia/metrics": "^0.14.0",
"@theia/mini-browser": "^0.14.0",
Expand All @@ -48,15 +43,11 @@
"@theia/preferences": "^0.14.0",
"@theia/preview": "^0.14.0",
"@theia/process": "^0.14.0",
"@theia/python": "^0.14.0",
"@theia/scm": "^0.14.0",
"@theia/search-in-workspace": "^0.14.0",
"@theia/task": "^0.14.0",
"@theia/terminal": "^0.14.0",
"@theia/textmate-grammars": "^0.14.0",
"@theia/tslint": "^0.14.0",
"@theia/typehierarchy": "^0.14.0",
"@theia/typescript": "^0.14.0",
"@theia/userstorage": "^0.14.0",
"@theia/variable-resolver": "^0.14.0",
"@theia/workspace": "^0.14.0"
Expand Down
9 changes: 0 additions & 9 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@
"@theia/console": "^0.14.0",
"@theia/core": "^0.14.0",
"@theia/debug": "^0.14.0",
"@theia/debug-nodejs": "^0.14.0",
"@theia/editor": "^0.14.0",
"@theia/editor-preview": "^0.14.0",
"@theia/editorconfig": "^0.14.0",
"@theia/file-search": "^0.14.0",
"@theia/filesystem": "^0.14.0",
"@theia/getting-started": "^0.14.0",
"@theia/git": "^0.14.0",
"@theia/java": "^0.14.0",
"@theia/java-debug": "^0.14.0",
"@theia/json": "^0.14.0",
"@theia/keymaps": "^0.14.0",
"@theia/languages": "^0.14.0",
"@theia/markers": "^0.14.0",
"@theia/merge-conflicts": "^0.14.0",
"@theia/messages": "^0.14.0",
"@theia/metrics": "^0.14.0",
"@theia/mini-browser": "^0.14.0",
Expand All @@ -45,15 +40,11 @@
"@theia/preferences": "^0.14.0",
"@theia/preview": "^0.14.0",
"@theia/process": "^0.14.0",
"@theia/python": "^0.14.0",
"@theia/scm": "^0.14.0",
"@theia/search-in-workspace": "^0.14.0",
"@theia/task": "^0.14.0",
"@theia/terminal": "^0.14.0",
"@theia/textmate-grammars": "^0.14.0",
"@theia/tslint": "^0.14.0",
"@theia/typehierarchy": "^0.14.0",
"@theia/typescript": "^0.14.0",
"@theia/userstorage": "^0.14.0",
"@theia/variable-resolver": "^0.14.0",
"@theia/workspace": "^0.14.0"
Expand Down
73 changes: 70 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"scripts": {
"postinstall": "node scripts/post-install.js",
"prepare": "node scripts/skip-prepare || ( yarn prepare:travis && yarn rebuild:clean && yarn build:clean && yarn prepare:hoisting )",
"prepare": "node scripts/skip-prepare || ( yarn prepare:travis && yarn rebuild:clean && yarn build:clean && yarn prepare:hoisting && yarn download:plugins)",
"prepare:travis": "node scripts/prepare-travis",
"prepare:hoisting": "theia check:hoisted -s",
"preinstall": "node-gyp install",
Expand All @@ -70,11 +70,78 @@
"next:publish": "lerna publish --exact --canary=next --npm-tag=next --yes",
"publish:check": "node scripts/check-publish.js",
"start:browser": "yarn rebuild:browser && run start \"@theia/example-browser\"",
"start:electron": "yarn rebuild:electron && run start \"@theia/example-electron\""
"start:electron": "yarn rebuild:electron && run start \"@theia/example-electron\"",
"download:plugins": "theia download:plugins"
},
"workspaces": [
"dev-packages/*",
"packages/*",
"examples/*"
]
],
"theiaPluginsDir": "plugins",
"theiaPlugins": {
"vscode-builtin-bat": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/bat-1.39.1-prel.vsix",
"vscode-builtin-clojure": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/clojure-1.39.1-prel.vsix",
"vscode-builtin-coffeescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/coffeescript-1.39.1-prel.vsix",
"vscode-builtin-configuration-editing": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/configuration-editing-1.39.1-prel.vsix",
"vscode-builtin-cpp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/cpp-1.39.1-prel.vsix",
"vscode-builtin-csharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/csharp-1.39.1-prel.vsix",
"vscode-builtin-css": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/css-1.39.1-prel.vsix",
"vscode-builtin-debug-auto-launch": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/debug-auto-launch-1.39.1-prel.vsix",
"vscode-builtin-docker": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/docker-1.39.1-prel.vsix",
"vscode-builtin-emmet": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/emmet-1.39.1-prel.vsix",
"vscode-builtin-fsharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/fsharp-1.39.1-prel.vsix",
"vscode-builtin-go": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/go-1.39.1-prel.vsix",
"vscode-builtin-groovy": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/groovy-1.39.1-prel.vsix",
"vscode-builtin-grunt": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/grunt-1.39.1-prel.vsix",
"vscode-builtin-gulp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/gulp-1.39.1-prel.vsix",
"vscode-builtin-handlebars": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/handlebars-1.39.1-prel.vsix",
"vscode-builtin-hlsl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/hlsl-1.39.1-prel.vsix",
"vscode-builtin-html": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/html-1.39.1-prel.vsix",
"vscode-builtin-ini": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ini-1.39.1-prel.vsix",
"vscode-builtin-jake": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/jake-1.39.1-prel.vsix",
"vscode-builtin-java": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/java-1.39.1-prel.vsix",
"vscode-builtin-javascript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/javascript-1.39.1-prel.vsix",
"vscode-builtin-json": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/json-1.39.1-prel.vsix",
"vscode-builtin-less": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/less-1.39.1-prel.vsix",
"vscode-builtin-log": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/log-1.39.1-prel.vsix",
"vscode-builtin-lua": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/lua-1.39.1-prel.vsix",
"vscode-builtin-make": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/make-1.39.1-prel.vsix",
"vscode-builtin-markdown": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-1.39.1-prel.vsix",
"vscode-builtin-markdown-language-features": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-language-features-1.39.1-prel.vsix",
"vscode-builtin-merge-conflicts": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/merge-conflict-1.39.1-prel.vsix",
"vscode-builtin-npm": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/npm-1.39.1-prel.vsix",
"vscode-builtin-node-debug": "https://github.com/theia-ide/vscode-node-debug/releases/download/v1.35.3/node-debug-1.35.3.vsix",
"vscode-builtin-node-debug2": "https://github.com/theia-ide/vscode-node-debug2/releases/download/v1.33.0/node-debug2-1.33.0.vsix",
"vscode-builtin-objective-c": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/objective-c-1.39.1-prel.vsix",
"vscode-builtin-perl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/perl-1.39.1-prel.vsix",
"vscode-builtin-powershell": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/powershell-1.39.1-prel.vsix",
"vscode-builtin-pug": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/pug-1.39.1-prel.vsix",
"vscode-builtin-python": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/python-1.39.1-prel.vsix",
"vscode-builtin-r": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/r-1.39.1-prel.vsix",
"vscode-builtin-razor": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/razor-1.39.1-prel.vsix",
"vscode-builtin-ruby": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ruby-1.39.1-prel.vsix",
"vscode-builtin-rust": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/rust-1.39.1-prel.vsix",
"vscode-builtin-scss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/scss-1.39.1-prel.vsix",
"vscode-builtin-shaderlab": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shaderlab-1.39.1-prel.vsix",
"vscode-builtin-shellscript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shellscript-1.39.1-prel.vsix",
"vscode-builtin-sql": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/sql-1.39.1-prel.vsix",
"vscode-builtin-swift": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/swift-1.39.1-prel.vsix",
"vscode-builtin-theme-abyss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-abyss-1.39.1-prel.vsix",
"vscode-builtin-theme-defaults": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-defaults-1.39.1-prel.vsix",
"vscode-builtin-theme-kimbie-dark": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-kimbie-dark-1.39.1-prel.vsix",
"vscode-builtin-theme-monokai": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-monokai-1.39.1-prel.vsix",
"vscode-builtin-theme-dimmed": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-monokai-dimmed-1.39.1-prel.vsix",
"vscode-builtin-theme-quietlight": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-quietlight-1.39.1-prel.vsix",
"vscode-builtin-theme-red": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-red-1.39.1-prel.vsix",
"vscode-builtin-theme-solarized-dark": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-solarized-dark-1.39.1-prel.vsix",
"vscode-builtin-theme-tomorrow-night-blue": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/theme-tomorrow-night-blue-1.39.1-prel.vsix",
"vscode-builtin-typescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-1.39.1-prel.vsix",
"vscode-builtin-typescript-language-features": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-language-features-1.39.1-prel.vsix",
"vscode-builtin-vb": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/vb-1.39.1-prel.vsix",
"vscode-builtin-icon-theme-seti": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/vscode-theme-seti-1.39.1-prel.vsix",
"vscode-builtin-xml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/xml-1.39.1-prel.vsix",
"vscode-builtin-yaml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/yaml-1.39.1-prel.vsix",
"vscode-editorconfig": "https://github.com/theia-ide/editorconfig-vscode/releases/download/v0.14.4/EditorConfig-0.14.4.vsix"
}
}
Loading

0 comments on commit e9449a0

Please sign in to comment.