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

[vscode] add builtins to example applications #6883

Merged
merged 1 commit into from
Jan 21, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
akosyakov marked this conversation as resolved.
Show resolved Hide resolved
- 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)
akosyakov marked this conversation as resolved.
Show resolved Hide resolved
- 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

missing @types/tar ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's correct. I added it as part of #6933 once I realized it was missing, but I will extract it to a different pull request:

"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",
akosyakov marked this conversation as resolved.
Show resolved Hide resolved
"@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",
vince-fugnitto marked this conversation as resolved.
Show resolved Hide resolved
"@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",
vince-fugnitto marked this conversation as resolved.
Show resolved Hide resolved
"@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