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

Commit

Permalink
Merge pull request #40 from PizzaFactory/prp-update-to-the-upstream
Browse files Browse the repository at this point in the history
Update to the upstream
  • Loading branch information
monaka authored Jul 31, 2019
2 parents e832e80 + 203a02c commit d48930e
Show file tree
Hide file tree
Showing 86 changed files with 16,710 additions and 195 deletions.
31 changes: 4 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ In Che-Theia, you’ll find the following capabilities:
- [dockerfiles](./dockerfiles) contains Dockerfiles for plugin sidecars, theia-editor and theia builder,
- [extensions](./extensions) contains Che-Theia specific extensions,
- [plugins](./plugins) contains Che-Theia plugins.
- [generator](./generator) contains Che-Theia [generator](./generator/README.md)

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

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

## Build container images

### How to build all the container images
Building images is required only if you make some changes on `Dockerfile`s inside `dockerfiles` folder.
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).

If you want to build all images run `build.sh` script.

CI for PR job in this repository will use `build.sh --pr`.
> Note: `--pr` will build only limited set of docker images, see [PR_IMAGES variable](./docker_image_build.include)
If you want to publish docker images use `build.sh --push`

### How to build own che-theia image with Docker

First you need to build `che-theia-dev` image:

Run in `dockerfiles/theia-dev` dir:

```bash
./build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:next
```

Then in `dockerfiles/theia` run:

```bash
./build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=master --tag:next --branch:master --git-ref:refs\\/heads\\/master
```

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.

That script will clone Theia from master branch and all Che related extensions from theirs master branches.
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.


# License
Expand Down
5 changes: 3 additions & 2 deletions dockerfiles/remote-plugin-go-1.10.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN set -eux; \
/usr/local/go/pkg/obj \
; \
export GOPATH="/go"; \
mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH"; \
mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg"; \
export PATH="$GOPATH/bin:/usr/local/go/bin:$PATH"; \
go get -u -v github.com/ramya-rao-a/go-outline && \
go get -u -v github.com/acroca/go-symbols && \
Expand All @@ -63,7 +63,8 @@ RUN set -eux; \
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct && \
go get -u -v github.com/alecthomas/gometalinter && \
go get -u -v github.com/go-delve/delve/cmd/dlv && \
gometalinter --install \
gometalinter --install && \
chmod -R 777 "$GOPATH" \
; \
apk del .build-deps \
; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ export class ChePluginManager {

if (!this.registryList) {
this.registryList = [this.defaultRegistry];

this.registryList.push({
name: 'Visual Studio Code plugins',
uri: 'https://marketplace.visualstudio.com/vscode'
});

await this.restoreRegistryList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { MenuBar as MenuBarWidget } from '@phosphor/widgets';
import { TerminalKeybindingContext } from './keybinding-context';
import { CHEWorkspaceService } from '../../common/workspace-service';
import { TerminalWidget, TerminalWidgetOptions } from '@theia/terminal/lib/browser/base/terminal-widget';
import { REMOTE_TERMINAL_WIDGET_FACTORY_ID, RemoteTerminalWidget, RemoteTerminalWidgetFactoryOptions } from '../terminal-widget/remote-terminal-widget';
import { REMOTE_TERMINAL_WIDGET_FACTORY_ID, RemoteTerminalWidgetFactoryOptions } from '../terminal-widget/remote-terminal-widget';
import { filterRecipeContainers } from './terminal-command-filter';
import URI from '@theia/core/lib/common/uri';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
Expand Down Expand Up @@ -97,7 +97,7 @@ export class ExecTerminalFrontendContribution extends TerminalFrontendContributi
const workspaceId = <string>await this.baseEnvVariablesServer.getValue('CHE_WORKSPACE_ID').then(v => v ? v.value : undefined);
const termApiEndPoint = <URI | undefined>await this.termApiEndPointProvider();

const widget = <RemoteTerminalWidget>await this.widgetManager.getOrCreateWidget(REMOTE_TERMINAL_WIDGET_FACTORY_ID, <RemoteTerminalWidgetFactoryOptions>{
const widget = <TerminalWidget>await this.widgetManager.getOrCreateWidget(REMOTE_TERMINAL_WIDGET_FACTORY_ID, <RemoteTerminalWidgetFactoryOptions>{
created: new Date().toString(),
machineName: containerName,
workspaceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { ContainerModule, Container, interfaces } from 'inversify';
import { WidgetFactory, WebSocketConnectionProvider, KeybindingContext, QuickOpenContribution } from '@theia/core/lib/browser';
import { TerminalQuickOpenService } from './contribution/terminal-quick-open';
import { RemoteTerminalWidgetOptions, REMOTE_TERMINAL_WIDGET_FACTORY_ID } from './terminal-widget/remote-terminal-widget';
import { RemoteTerminalWidgetOptions, REMOTE_TERMINAL_WIDGET_FACTORY_ID, REMOTE_TERMINAL_TARGET_SCOPE } from './terminal-widget/remote-terminal-widget';
import { RemoteWebSocketConnectionProvider } from './server-definition/remote-connection';
import { TerminalProxyCreator, TerminalProxyCreatorProvider, TerminalApiEndPointProvider } from './server-definition/terminal-proxy-creator';

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

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

return child.get(RemoteTerminalWidget);
return child.getNamed(TerminalWidget, REMOTE_TERMINAL_TARGET_SCOPE);
}
}));

Expand All @@ -85,7 +86,9 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
try {
const server = await workspaceService.findTerminalServer();
if (server) {
bind(TerminalWidget).to(RemoteTerminalWidget).inTransientScope();
rebind(TerminalWidget).to(TerminalWidgetImpl).inTransientScope().whenTargetIsDefault();
bind(TerminalWidget).to(RemoteTerminalWidget).inTransientScope().whenTargetNamed(REMOTE_TERMINAL_TARGET_SCOPE);

rebind(TerminalService).toService(ExecTerminalFrontendContribution);

const token = await envServer.getValue('CHE_MACHINE_TOKEN');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { TerminalWidgetOptions } from '@theia/terminal/lib/browser/base/terminal
import URI from '@theia/core/lib/common/uri';

const ReconnectingWebSocket = require('reconnecting-websocket');
export const REMOTE_TERMINAL_TARGET_SCOPE = 'remote-terminal';
export const REMOTE_TERMINAL_WIDGET_FACTORY_ID = 'remote-terminal';
export const RemoteTerminalWidgetOptions = Symbol('RemoteTerminalWidgetOptions');
export interface RemoteTerminalWidgetOptions extends Partial<TerminalWidgetOptions> {
Expand Down
14 changes: 14 additions & 0 deletions generator/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
insert_final_newline = true
end_of_line = lf
indent_style = space
trim_trailing_spaces = true
trim_trailing_whitespace = true

[*.{js,ts,md}]
indent_size = 4

[*.{json,yml}]
indent_size = 2
7 changes: 7 additions & 0 deletions generator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
coverage
yarn-error.log
.vscode
exe
/lib/
21 changes: 21 additions & 0 deletions generator/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @eclipse-che/theia-generator


# Contributing to this CLI

This project is using yargs to manage CLI options. [See src/yargs.ts file](src/yargs.ts)

## Code formatter/linter
when doing `yarn` command, formatter is executed with linter, etc.

## Unit tests
jest is used to test the project.

`yarn run test` is launching all the tests. A code coverage is also reported in `./coverage` folder.

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 !)

## native executable
The cli can also be generated to a native executable (run `yar run exe`)

It will produce several native binaries.
89 changes: 89 additions & 0 deletions generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# @eclipse-che/theia-generator
===================================


# Installation guide

Theia Generator can be installed locally or globally

Here is how to install it globally:

using yarn:
```
$ yarn global add @eclipse-che/theia-generator
```

using npm:
```
$ npm install -g @eclipse-che/theia-generator
```

Then, a new command line tool is available : `che:theia`

# Using the tool

Once the tool is installed, the following commands are available:
- `che:theia init`
- `che:theia production`

(help is also available with command `che:theia --help`)

## che:theia init

This command needs to be launched inside a cloned directory of Eclipse Theia cloned directory

```
$ git clone https://github.com/theia-ide/theia
$ cd theia
$ che:theia init
```

once the init command has been launched:
- inside `theia/che` folder, all extensions and plugins have been cloned and checkout to their correct branches (if specified)
- all extensions have their package.json updated to the versions used by the current theia. (cloned)
- in `packages` folder, there are symlinks for each extension coming from `theia/che` folders. All packages are prefixed by `@che-`
- in `plugins` folder, there are symlinks for each plugin coming from `theia/che` folders.
- in `examples` folder, a new folder named àssembly` has been generated and include the `che-theia` assembly of Theia

In order to build the product, just run `yarn` at the root folder (where theia has been cloned)

### Custom extension and plugin set

Also you can provide custom `yaml` with your extension set, by using `-c` or `--config` parameter of `che:theia init` :

`che:theia init -c ./path/to/custom/che-theia-init-sources.yaml`

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)

### Dev mode

Dev mode is the way to use all new extensions from `master` branch:

`che:theia init -d`

And `che:theia` will use `master` branch for all extensions and plugins, regardless of provided configuration

### Development life-cycle
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`

### compiling the plugins
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.

## che:theia production
A production's ready assembly of che-theia can be obtained by running from the root folder of theia: `che:theia production`

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)

It can be started with the command `node ${where theia has been cloned}/production/src-gen/backend/main.js`

## che:theia clean

If you want to clean up your Theia repository use
`che:theia clean` command, and it will undo all modification on your repository

# Developer's guide
[See Contributing](CONTRIBUTING.md)

# License

[EPL-2.0](LICENSE)
85 changes: 85 additions & 0 deletions generator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "@eclipse-che/theia-generator",
"version": "0.0.1",
"description": "Eclipse Che - Theia tooling",
"author": "Florent Benoit",
"license": "EPL-2.0",
"bin": {
"che:theia": "./dist/index.js"
},
"dependencies": {
"fs-extra": "7.0.1",
"glob": "7.1.3",
"glob-promise": "3.4.0",
"mustache": "3.0.1",
"js-yaml": "3.12.0",
"read-pkg": "3.0.0",
"yargs": "12.0.5",
"webpack": "^4.0.0",
"html-webpack-plugin": "^3.2.0",
"axios": "0.18.0",
"tmp": "^0.0.33"
},
"devDependencies": {
"@types/fs-extra": "5.0.4",
"@types/jest": "23.3.9",
"@types/js-yaml": "3.11.2",
"@types/mustache": "0.8.32",
"@types/node": "10.12.10",
"@types/read-pkg": "3.0.0",
"@types/tmp": "^0.0.33",
"@types/webpack": "^4.0.0",
"@types/yargs": "12.0.1",
"jest": "23.6.0",
"json2yaml": "^1.1.0",
"nexe": "^2.0.0-rc.34",
"rimraf": "2.6.2",
"ts-jest": "23.10.5",
"tslint": "5.11.0",
"typescript": "3.1.6",
"typescript-formatter": "7.2.2"
},
"files": [
"dist",
"src"
],
"scripts": {
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf dist",
"build": "yarn run compile && yarn run format-code && yarn run tslint-fix && yarn run test",
"compile": "tsc && chmod +x dist/index.js",
"watch": "tsc -w",
"test": "jest",
"test-watch": "jest --watchAll",
"format-code": "tsfmt -r",
"tslint-fix": "tslint --fix --project .",
"tslint": "tslint --project .",
"exe": "yarn run exe:alpine && yarn run exe:mac && yarn run exe:linux",
"exe:alpine": "rimraf exe/alpine/ && mkdir -p exe/alpine && nexe dist/yargs.js -t alpine-x64-8.12.0 -o exe/alpine/che-theia",
"exe:mac": "rimraf exe/macOS/ && mkdir -p exe/macOS && nexe dist/yargs.js -t mac-x64-8.12.0 -o exe/macOS/che-theia",
"exe:linux": "rimraf exe/linux/ && mkdir -p exe/linux && nexe dist/yargs.js -t linux-x64-8.12.0 -o exe/linux/che-theia",
"publish:next": "yarn publish --registry=https://registry.npmjs.org/ --no-git-tag-version --new-version 0.0.1-\"$(date +%s)\""
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
"!src/yargs.ts",
"src/**/*.ts"
],
"coverageDirectory": "./coverage",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"modulePathIgnorePatterns": [
"<rootDir>/dist"
],
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
]
}
}
Loading

0 comments on commit d48930e

Please sign in to comment.