forked from eclipse-theia/vscode-builtin-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
- Loading branch information
0 parents
commit 4ddc3f9
Showing
20 changed files
with
10,498 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
node_modules_backup | ||
.browser_modules | ||
lib | ||
*.log | ||
*-app/* | ||
!*-app/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "vscode"] | ||
path = vscode | ||
url = https://github.com/Microsoft/vscode.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
image: | ||
file: Dockerfile | ||
ports: | ||
- port: 3000 | ||
tasks: | ||
- init: yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
// Use IntelliSense to learn about possible Node.js debug attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Start Browser Backend", | ||
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js", | ||
"args": [ | ||
"--loglevel=debug", | ||
"--port=3000", | ||
"--no-cluster" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceRoot}/node_modules/@theia/*/lib/**/*.js", | ||
"${workspaceRoot}/browser-app/lib/**/*.js", | ||
"${workspaceRoot}/browser-app/src-gen/**/*.js" | ||
], | ||
"smartStep": true, | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"outputCapture": "std" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Start Electron Backend", | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", | ||
"windows": { | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" | ||
}, | ||
"program": "${workspaceRoot}/electron-app/src-gen/frontend/electron-main.js", | ||
"protocol": "inspector", | ||
"args": [ | ||
"--loglevel=debug", | ||
"--hostname=localhost", | ||
"--no-cluster" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceRoot}/electron-app/src-gen/frontend/electron-main.js", | ||
"${workspaceRoot}/electron-app/src-gen/backend/main.js", | ||
"${workspaceRoot}/electron-app/lib/**/*.js", | ||
"${workspaceRoot}/node_modules/@theia/*/lib/**/*.js" | ||
], | ||
"smartStep": true, | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"outputCapture": "std" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM gitpod/workspace-full:latest | ||
|
||
# install dependencies | ||
USER root | ||
RUN apt-get update \ | ||
&& apt-get install -y libx11-dev libxkbfile-dev libsecret-1-dev libgconf2-4 libnss3 libgtk-3-dev libasound2-dev twm \ | ||
&& apt-get clean && rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* | ||
USER gitpod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# vscode-builtin-extensions | ||
|
||
This extension contributes built-in VS Code extensions to Theia. | ||
|
||
## Getting started | ||
|
||
Install [nvm](https://github.com/creationix/nvm#install-script). | ||
|
||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash | ||
|
||
Install npm and node. | ||
|
||
nvm install 8 | ||
nvm use 8 | ||
|
||
Install yarn. | ||
|
||
npm install -g yarn | ||
|
||
## Running the browser example | ||
|
||
yarn rebuild:browser | ||
cd browser-app | ||
yarn start | ||
|
||
Open http://localhost:3000 in the browser. | ||
|
||
## Running the Electron example | ||
|
||
yarn rebuild:electron | ||
cd electron-app | ||
yarn start | ||
|
||
## Developing with the browser example | ||
|
||
Start watching of vscode-builtin-extensions. | ||
|
||
cd vscode-builtin-extensions | ||
yarn watch | ||
|
||
Start watching of the browser example. | ||
|
||
yarn rebuild:browser | ||
cd browser-app | ||
yarn watch | ||
|
||
Launch `Start Browser Backend` configuration from VS code. | ||
|
||
Open http://localhost:3000 in the browser. | ||
|
||
## Developing with the Electron example | ||
|
||
Start watching of vscode-builtin-extensions. | ||
|
||
cd vscode-builtin-extensions | ||
yarn watch | ||
|
||
Start watching of the electron example. | ||
|
||
yarn rebuild:electron | ||
cd electron-app | ||
yarn watch | ||
|
||
Launch `Start Electron Backend` configuration from VS code. | ||
|
||
## Publishing vscode-builtin-extensions | ||
|
||
Create a npm user and login to the npm registry, [more on npm publishing](https://docs.npmjs.com/getting-started/publishing-npm-packages). | ||
|
||
npm login | ||
|
||
Publish packages with lerna to update versions properly across local packages, [more on publishing with lerna](https://github.com/lerna/lerna#publish). | ||
|
||
npx lerna publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"private": true, | ||
"name": "browser-app", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"vscode-builtin-extensions": "0.0.0" | ||
}, | ||
"devDependencies": { | ||
"@theia/cli": "0.4.0-next.c5d44a81" | ||
}, | ||
"scripts": { | ||
"prepare": "theia build --mode development", | ||
"start": "theia start", | ||
"watch": "theia build --watch --mode development" | ||
}, | ||
"theia": { | ||
"target": "browser" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @ts-check | ||
const fs = require('fs'); | ||
const cp = require('child_process'); | ||
const path = require('path'); | ||
const rimraf = require('./vscode/node_modules/rimraf'); | ||
const vfs = require('./vscode/node_modules/vinyl-fs'); | ||
const ext = require('./vscode/build/lib/extensions'); | ||
|
||
const backupNodeModules = () => { | ||
const move = (src, dest) => fs.existsSync(src) && fs.renameSync(src, dest); | ||
const nodeModules = path.join(__dirname, 'node_modules'); | ||
const nodeModulesBackup = path.join(__dirname, 'node_modules_backup'); | ||
move(nodeModules, nodeModulesBackup); | ||
return () => move(nodeModulesBackup, nodeModules); | ||
} | ||
const revertNodeModules = backupNodeModules(); | ||
process.on('exit', revertNodeModules); | ||
process.on('SIGINT', revertNodeModules); | ||
process.on('SIGTERM', revertNodeModules); | ||
const extensionsPath = path.join(__dirname, 'vscode-builtin-extensions/extensions'); | ||
rimraf.sync(extensionsPath); | ||
// @ts-ignore | ||
ext.packageExtensionsStream().pipe(vfs.dest(path.dirname(extensionsPath))).on('end', async () => { | ||
// see why exlcuded https://github.com/theia-ide/theia/issues/3815#issuecomment-452686623 | ||
rimraf.sync(path.join(extensionsPath, 'configuration-editing')); | ||
rimraf.sync(path.join(extensionsPath, 'css-language-features')); | ||
rimraf.sync(path.join(extensionsPath, 'html-language-features')); | ||
rimraf.sync(path.join(extensionsPath, 'extension-editing')); | ||
rimraf.sync(path.join(extensionsPath, 'grunt')); | ||
rimraf.sync(path.join(extensionsPath, 'gulp')); | ||
await run('yarn', ['install', '--production'], path.join(extensionsPath, 'debug-auto-launch')); | ||
await run('yarn', ['install', '--production'], path.join(extensionsPath, 'ms-vscode.node-debug')); | ||
await run('yarn', ['install', '--production'], path.join(extensionsPath, 'ms-vscode.node-debug2')); | ||
}); | ||
|
||
function run(command, args, cwd) { | ||
// @ts-ignore | ||
return new Promise(resolve => { | ||
const p = cp.spawn(command, args, { cwd }); | ||
p.stdout.on('data', data => console.log(String(data))); | ||
p.stderr.on('data', data => console.error(String(data))); | ||
p.on('close', resolve); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"private": true, | ||
"name": "electron-app", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"vscode-builtin-extensions": "0.0.0" | ||
}, | ||
"devDependencies": { | ||
"@theia/cli": "0.4.0-next.c5d44a81" | ||
}, | ||
"scripts": { | ||
"prepare": "theia build --mode development", | ||
"start": "theia start", | ||
"watch": "theia build --watch --mode development" | ||
}, | ||
"theia": { | ||
"target": "electron" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"lerna": "2.4.0", | ||
"version": "0.0.0", | ||
"useWorkspaces": true, | ||
"npmClient": "yarn", | ||
"command": { | ||
"run": { | ||
"stream": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"prepare": "yarn build:extensions && yarn bundle:extensions && yarn build", | ||
"build": "lerna run prepare", | ||
"build:extensions": "cd vscode && yarn && npx gulp compile-extensions-build", | ||
"bundle:extensions": "cd vscode && node ../bundle-extensions.js", | ||
"rebuild:browser": "theia rebuild:browser", | ||
"rebuild:electron": "theia rebuild:electron" | ||
}, | ||
"devDependencies": { | ||
"lerna": "2.4.0" | ||
}, | ||
"workspaces": [ | ||
"vscode-builtin-extensions", | ||
"browser-app", | ||
"electron-app" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "vscode-builtin-extensions", | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"version": "0.0.0", | ||
"files": [ | ||
"lib", | ||
"src", | ||
"extensions" | ||
], | ||
"dependencies": { | ||
"@theia/plugin-ext-vscode": "0.4.0-next.c5d44a81" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "latest", | ||
"typescript": "latest" | ||
}, | ||
"scripts": { | ||
"prepare": "yarn run clean && yarn run build", | ||
"clean": "rimraf lib", | ||
"build": "tsc", | ||
"watch": "tsc -w" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"backend": "lib/node/vscode-builtin-extensions-backend-module" | ||
} | ||
] | ||
} |
37 changes: 37 additions & 0 deletions
37
vscode-builtin-extensions/src/node/vscode-builtin-extension-directory-handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as path from 'path'; | ||
import { injectable } from 'inversify'; | ||
import { PluginDeployerEntry, PluginDeployerDirectoryHandler, PluginDeployerDirectoryHandlerContext, PluginDeployerEntryType } from '@theia/plugin-ext'; | ||
|
||
@injectable() | ||
export class VSCodeBuiltinExtensionDirectoryHandler implements PluginDeployerDirectoryHandler { | ||
|
||
accept(plugin: PluginDeployerEntry): boolean { | ||
const pck = this.resolvePackage(plugin); | ||
return !!pck && !!pck.engines && !!pck.engines.vscode; | ||
} | ||
|
||
protected resolvePackage(plugin: PluginDeployerEntry): { | ||
engines?: { | ||
[engine: string]: string | ||
} | ||
} | undefined { | ||
let pck = plugin.getValue('package.json'); | ||
if (pck) { | ||
return pck; | ||
} | ||
try { | ||
pck = require(path.join(plugin.path(), 'package.json')); | ||
if (pck) { | ||
plugin.storeValue('package.json', pck); | ||
} | ||
return pck; | ||
} catch { | ||
return undefined; | ||
} | ||
} | ||
|
||
async handle(context: PluginDeployerDirectoryHandlerContext): Promise<void> { | ||
context.pluginEntry().accept(PluginDeployerEntryType.BACKEND); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
vscode-builtin-extensions/src/node/vscode-builtin-extensions-backend-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as path from 'path'; | ||
import { ContainerModule } from 'inversify'; | ||
import { PluginDeployerDirectoryHandler } from '@theia/plugin-ext'; | ||
import { VSCodeBuiltinExtensionDirectoryHandler } from './vscode-builtin-extension-directory-handler'; | ||
|
||
let plugins = `local-dir://${path.resolve(__dirname, '../../extensions')}`; | ||
if (process.env.THEIA_DEFAULT_PLUGINS) { | ||
plugins += ',' + process.env.THEIA_DEFAULT_PLUGINS; | ||
} | ||
process.env.THEIA_DEFAULT_PLUGINS = plugins; | ||
|
||
export default new ContainerModule(bind => { | ||
bind(PluginDeployerDirectoryHandler).to(VSCodeBuiltinExtensionDirectoryHandler).inSingletonScope(); | ||
}); |
Oops, something went wrong.