Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 203a02c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into prp-update-to-the-upstream
2 parents e832e80 + 5076732 commit 203a02c

File tree

86 files changed

+16710
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+16710
-195
lines changed

README.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ In Che-Theia, you’ll find the following capabilities:
6262
- [dockerfiles](./dockerfiles) contains Dockerfiles for plugin sidecars, theia-editor and theia builder,
6363
- [extensions](./extensions) contains Che-Theia specific extensions,
6464
- [plugins](./plugins) contains Che-Theia plugins.
65+
- [generator](./generator) contains Che-Theia [generator](./generator/README.md)
6566

6667
Che-theia editor is a container image which contains the Che-theia IDE web application.
6768

@@ -83,34 +84,10 @@ Contributing to che-theia section is cover in [CONTRIBUTING.md](https://github.c
8384

8485
## Build container images
8586

86-
### How to build all the container images
87+
Building images is required only if you make some changes on `Dockerfile`s inside `dockerfiles` folder.
88+
If it is about testing che-theia extensions or plugins, please refere to [CONTRIBUTING.md](https://github.com/eclipse/che-theia/blob/master/CONTRIBUTING.md).
8789

88-
If you want to build all images run `build.sh` script.
89-
90-
CI for PR job in this repository will use `build.sh --pr`.
91-
> Note: `--pr` will build only limited set of docker images, see [PR_IMAGES variable](./docker_image_build.include)
92-
93-
If you want to publish docker images use `build.sh --push`
94-
95-
### How to build own che-theia image with Docker
96-
97-
First you need to build `che-theia-dev` image:
98-
99-
Run in `dockerfiles/theia-dev` dir:
100-
101-
```bash
102-
./build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:next
103-
```
104-
105-
Then in `dockerfiles/theia` run:
106-
107-
```bash
108-
./build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=master --tag:next --branch:master --git-ref:refs\\/heads\\/master
109-
```
110-
111-
Where `${GITHUB_TOKEN_ARG}` is your GitHub API token, it's used for fetching some vscode library that placed on GitHub releases, without that token build may fail.
112-
113-
That script will clone Theia from master branch and all Che related extensions from theirs master branches.
90+
To build che-theia docker images, please follow [dockerfiles/theia/README.md](https://github.com/eclipse/che-theia/blob/README-docker-image/dockerfiles/theia/README.md) instructions.
11491

11592

11693
# License

dockerfiles/remote-plugin-go-1.10.7/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RUN set -eux; \
4242
/usr/local/go/pkg/obj \
4343
; \
4444
export GOPATH="/go"; \
45-
mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH"; \
45+
mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg"; \
4646
export PATH="$GOPATH/bin:/usr/local/go/bin:$PATH"; \
4747
go get -u -v github.com/ramya-rao-a/go-outline && \
4848
go get -u -v github.com/acroca/go-symbols && \
@@ -63,7 +63,8 @@ RUN set -eux; \
6363
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct && \
6464
go get -u -v github.com/alecthomas/gometalinter && \
6565
go get -u -v github.com/go-delve/delve/cmd/dlv && \
66-
gometalinter --install \
66+
gometalinter --install && \
67+
chmod -R 777 "$GOPATH" \
6768
; \
6869
apk del .build-deps \
6970
; \

extensions/eclipse-che-theia-plugin-ext/src/browser/plugin/che-plugin-manager.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ export class ChePluginManager {
124124

125125
if (!this.registryList) {
126126
this.registryList = [this.defaultRegistry];
127-
128-
this.registryList.push({
129-
name: 'Visual Studio Code plugins',
130-
uri: 'https://marketplace.visualstudio.com/vscode'
131-
});
132-
133127
await this.restoreRegistryList();
134128
}
135129

extensions/eclipse-che-theia-terminal/src/browser/contribution/exec-terminal-contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { MenuBar as MenuBarWidget } from '@phosphor/widgets';
1919
import { TerminalKeybindingContext } from './keybinding-context';
2020
import { CHEWorkspaceService } from '../../common/workspace-service';
2121
import { TerminalWidget, TerminalWidgetOptions } from '@theia/terminal/lib/browser/base/terminal-widget';
22-
import { REMOTE_TERMINAL_WIDGET_FACTORY_ID, RemoteTerminalWidget, RemoteTerminalWidgetFactoryOptions } from '../terminal-widget/remote-terminal-widget';
22+
import { REMOTE_TERMINAL_WIDGET_FACTORY_ID, RemoteTerminalWidgetFactoryOptions } from '../terminal-widget/remote-terminal-widget';
2323
import { filterRecipeContainers } from './terminal-command-filter';
2424
import URI from '@theia/core/lib/common/uri';
2525
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
@@ -97,7 +97,7 @@ export class ExecTerminalFrontendContribution extends TerminalFrontendContributi
9797
const workspaceId = <string>await this.baseEnvVariablesServer.getValue('CHE_WORKSPACE_ID').then(v => v ? v.value : undefined);
9898
const termApiEndPoint = <URI | undefined>await this.termApiEndPointProvider();
9999

100-
const widget = <RemoteTerminalWidget>await this.widgetManager.getOrCreateWidget(REMOTE_TERMINAL_WIDGET_FACTORY_ID, <RemoteTerminalWidgetFactoryOptions>{
100+
const widget = <TerminalWidget>await this.widgetManager.getOrCreateWidget(REMOTE_TERMINAL_WIDGET_FACTORY_ID, <RemoteTerminalWidgetFactoryOptions>{
101101
created: new Date().toString(),
102102
machineName: containerName,
103103
workspaceId,

extensions/eclipse-che-theia-terminal/src/browser/terminal-frontend-module.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import { ContainerModule, Container, interfaces } from 'inversify';
1212
import { WidgetFactory, WebSocketConnectionProvider, KeybindingContext, QuickOpenContribution } from '@theia/core/lib/browser';
1313
import { TerminalQuickOpenService } from './contribution/terminal-quick-open';
14-
import { RemoteTerminalWidgetOptions, REMOTE_TERMINAL_WIDGET_FACTORY_ID } from './terminal-widget/remote-terminal-widget';
14+
import { RemoteTerminalWidgetOptions, REMOTE_TERMINAL_WIDGET_FACTORY_ID, REMOTE_TERMINAL_TARGET_SCOPE } from './terminal-widget/remote-terminal-widget';
1515
import { RemoteWebSocketConnectionProvider } from './server-definition/remote-connection';
1616
import { TerminalProxyCreator, TerminalProxyCreatorProvider, TerminalApiEndPointProvider } from './server-definition/terminal-proxy-creator';
1717

@@ -27,6 +27,7 @@ import { RemoteTerminaActiveKeybingContext } from './contribution/keybinding-con
2727
import { RemoteTerminalServerProxy, RemoteTerminalServer, RemoteTerminalWatcher } from './server-definition/remote-terminal-protocol';
2828
import URI from '@theia/core/lib/common/uri';
2929
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
30+
import { TerminalWidgetImpl } from '@theia/terminal/lib/browser/terminal-widget-impl';
3031

3132
export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {
3233
// bind this contstant to prevent circle dependency
@@ -69,7 +70,7 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
6970
child.bind(RemoteTerminalWidgetOptions).toConstantValue(widgetOptions);
7071
child.bind('terminal-dom-id').toConstantValue(domId);
7172

72-
return child.get(RemoteTerminalWidget);
73+
return child.getNamed(TerminalWidget, REMOTE_TERMINAL_TARGET_SCOPE);
7374
}
7475
}));
7576

@@ -85,7 +86,9 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
8586
try {
8687
const server = await workspaceService.findTerminalServer();
8788
if (server) {
88-
bind(TerminalWidget).to(RemoteTerminalWidget).inTransientScope();
89+
rebind(TerminalWidget).to(TerminalWidgetImpl).inTransientScope().whenTargetIsDefault();
90+
bind(TerminalWidget).to(RemoteTerminalWidget).inTransientScope().whenTargetNamed(REMOTE_TERMINAL_TARGET_SCOPE);
91+
8992
rebind(TerminalService).toService(ExecTerminalFrontendContribution);
9093

9194
const token = await envServer.getValue('CHE_MACHINE_TOKEN');

extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { TerminalWidgetOptions } from '@theia/terminal/lib/browser/base/terminal
2020
import URI from '@theia/core/lib/common/uri';
2121

2222
const ReconnectingWebSocket = require('reconnecting-websocket');
23+
export const REMOTE_TERMINAL_TARGET_SCOPE = 'remote-terminal';
2324
export const REMOTE_TERMINAL_WIDGET_FACTORY_ID = 'remote-terminal';
2425
export const RemoteTerminalWidgetOptions = Symbol('RemoteTerminalWidgetOptions');
2526
export interface RemoteTerminalWidgetOptions extends Partial<TerminalWidgetOptions> {

generator/.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
insert_final_newline = true
5+
end_of_line = lf
6+
indent_style = space
7+
trim_trailing_spaces = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{js,ts,md}]
11+
indent_size = 4
12+
13+
[*.{json,yml}]
14+
indent_size = 2

generator/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
coverage
4+
yarn-error.log
5+
.vscode
6+
exe
7+
/lib/

generator/CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# @eclipse-che/theia-generator
2+
3+
4+
# Contributing to this CLI
5+
6+
This project is using yargs to manage CLI options. [See src/yargs.ts file](src/yargs.ts)
7+
8+
## Code formatter/linter
9+
when doing `yarn` command, formatter is executed with linter, etc.
10+
11+
## Unit tests
12+
jest is used to test the project.
13+
14+
`yarn run test` is launching all the tests. A code coverage is also reported in `./coverage` folder.
15+
16+
Try to expect 100% of coverage when implementing a feature (for now only yargs.ts is not covered as I haven't figured out a good way to test it, welcome !)
17+
18+
## native executable
19+
The cli can also be generated to a native executable (run `yar run exe`)
20+
21+
It will produce several native binaries.

generator/README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# @eclipse-che/theia-generator
2+
===================================
3+
4+
5+
# Installation guide
6+
7+
Theia Generator can be installed locally or globally
8+
9+
Here is how to install it globally:
10+
11+
using yarn:
12+
```
13+
$ yarn global add @eclipse-che/theia-generator
14+
```
15+
16+
using npm:
17+
```
18+
$ npm install -g @eclipse-che/theia-generator
19+
```
20+
21+
Then, a new command line tool is available : `che:theia`
22+
23+
# Using the tool
24+
25+
Once the tool is installed, the following commands are available:
26+
- `che:theia init`
27+
- `che:theia production`
28+
29+
(help is also available with command `che:theia --help`)
30+
31+
## che:theia init
32+
33+
This command needs to be launched inside a cloned directory of Eclipse Theia cloned directory
34+
35+
```
36+
$ git clone https://github.com/theia-ide/theia
37+
$ cd theia
38+
$ che:theia init
39+
```
40+
41+
once the init command has been launched:
42+
- inside `theia/che` folder, all extensions and plugins have been cloned and checkout to their correct branches (if specified)
43+
- all extensions have their package.json updated to the versions used by the current theia. (cloned)
44+
- in `packages` folder, there are symlinks for each extension coming from `theia/che` folders. All packages are prefixed by `@che-`
45+
- in `plugins` folder, there are symlinks for each plugin coming from `theia/che` folders.
46+
- in `examples` folder, a new folder named àssembly` has been generated and include the `che-theia` assembly of Theia
47+
48+
In order to build the product, just run `yarn` at the root folder (where theia has been cloned)
49+
50+
### Custom extension and plugin set
51+
52+
Also you can provide custom `yaml` with your extension set, by using `-c` or `--config` parameter of `che:theia init` :
53+
54+
`che:theia init -c ./path/to/custom/che-theia-init-sources.yaml`
55+
56+
The sample of `che-theia-init-sources.yaml` can be found [there](https://github.com/eclipse/che-theia/blob/master/che-theia-init-sources.yml)
57+
58+
### Dev mode
59+
60+
Dev mode is the way to use all new extensions from `master` branch:
61+
62+
`che:theia init -d`
63+
64+
And `che:theia` will use `master` branch for all extensions and plugins, regardless of provided configuration
65+
66+
### Development life-cycle
67+
it's easy to check changes. Running yarn watch in a module and then running yarn watch in `examples/assembly` folder and using `yarn run start` in `examples/assembly`
68+
69+
### compiling the plugins
70+
Plugins have to be compiled separately with the script `plugins/foreach_yarn`. This script simply run the `yarn` command on each subfolders of `plugins` and copy the `.theia` package in `production/plugins` folder to be reused by the che-theia product.
71+
72+
## che:theia production
73+
A production's ready assembly of che-theia can be obtained by running from the root folder of theia: `che:theia production`
74+
75+
It will generate in `${where theia has been cloned}/production` folder a ready-to-use assembly of theia, without lot of files (like source maps, source code, etc)
76+
77+
It can be started with the command `node ${where theia has been cloned}/production/src-gen/backend/main.js`
78+
79+
## che:theia clean
80+
81+
If you want to clean up your Theia repository use
82+
`che:theia clean` command, and it will undo all modification on your repository
83+
84+
# Developer's guide
85+
[See Contributing](CONTRIBUTING.md)
86+
87+
# License
88+
89+
[EPL-2.0](LICENSE)

generator/package.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"name": "@eclipse-che/theia-generator",
3+
"version": "0.0.1",
4+
"description": "Eclipse Che - Theia tooling",
5+
"author": "Florent Benoit",
6+
"license": "EPL-2.0",
7+
"bin": {
8+
"che:theia": "./dist/index.js"
9+
},
10+
"dependencies": {
11+
"fs-extra": "7.0.1",
12+
"glob": "7.1.3",
13+
"glob-promise": "3.4.0",
14+
"mustache": "3.0.1",
15+
"js-yaml": "3.12.0",
16+
"read-pkg": "3.0.0",
17+
"yargs": "12.0.5",
18+
"webpack": "^4.0.0",
19+
"html-webpack-plugin": "^3.2.0",
20+
"axios": "0.18.0",
21+
"tmp": "^0.0.33"
22+
},
23+
"devDependencies": {
24+
"@types/fs-extra": "5.0.4",
25+
"@types/jest": "23.3.9",
26+
"@types/js-yaml": "3.11.2",
27+
"@types/mustache": "0.8.32",
28+
"@types/node": "10.12.10",
29+
"@types/read-pkg": "3.0.0",
30+
"@types/tmp": "^0.0.33",
31+
"@types/webpack": "^4.0.0",
32+
"@types/yargs": "12.0.1",
33+
"jest": "23.6.0",
34+
"json2yaml": "^1.1.0",
35+
"nexe": "^2.0.0-rc.34",
36+
"rimraf": "2.6.2",
37+
"ts-jest": "23.10.5",
38+
"tslint": "5.11.0",
39+
"typescript": "3.1.6",
40+
"typescript-formatter": "7.2.2"
41+
},
42+
"files": [
43+
"dist",
44+
"src"
45+
],
46+
"scripts": {
47+
"prepare": "yarn run clean && yarn run build",
48+
"clean": "rimraf dist",
49+
"build": "yarn run compile && yarn run format-code && yarn run tslint-fix && yarn run test",
50+
"compile": "tsc && chmod +x dist/index.js",
51+
"watch": "tsc -w",
52+
"test": "jest",
53+
"test-watch": "jest --watchAll",
54+
"format-code": "tsfmt -r",
55+
"tslint-fix": "tslint --fix --project .",
56+
"tslint": "tslint --project .",
57+
"exe": "yarn run exe:alpine && yarn run exe:mac && yarn run exe:linux",
58+
"exe:alpine": "rimraf exe/alpine/ && mkdir -p exe/alpine && nexe dist/yargs.js -t alpine-x64-8.12.0 -o exe/alpine/che-theia",
59+
"exe:mac": "rimraf exe/macOS/ && mkdir -p exe/macOS && nexe dist/yargs.js -t mac-x64-8.12.0 -o exe/macOS/che-theia",
60+
"exe:linux": "rimraf exe/linux/ && mkdir -p exe/linux && nexe dist/yargs.js -t linux-x64-8.12.0 -o exe/linux/che-theia",
61+
"publish:next": "yarn publish --registry=https://registry.npmjs.org/ --no-git-tag-version --new-version 0.0.1-\"$(date +%s)\""
62+
},
63+
"jest": {
64+
"collectCoverage": true,
65+
"collectCoverageFrom": [
66+
"!src/yargs.ts",
67+
"src/**/*.ts"
68+
],
69+
"coverageDirectory": "./coverage",
70+
"transform": {
71+
"^.+\\.tsx?$": "ts-jest"
72+
},
73+
"modulePathIgnorePatterns": [
74+
"<rootDir>/dist"
75+
],
76+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
77+
"moduleFileExtensions": [
78+
"ts",
79+
"tsx",
80+
"js",
81+
"jsx",
82+
"json"
83+
]
84+
}
85+
}

0 commit comments

Comments
 (0)