Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitf committed Aug 3, 2018
0 parents commit 619609b
Show file tree
Hide file tree
Showing 16 changed files with 1,516 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.tar.gz

31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
sudo: required
language: node_js
node_js: '9'
git:
depth: 1
cache:
yarn: true
directories:
- ui/node_modules
branches:
only:
- master
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s --
- export PATH=$HOME/.yarn/bin:$PATH ;
install: ./build.sh
script: ./build.sh
jobs:
fast_finish: true
include:
- stage: deploy
os: linux
deploy:
- provider: releases
api-key: $GITHUB_AUTH_TOKEN
name: che-plugin-$(date +'%F-%T')
file_glob: true
file: ./assembly/*.tar.gz
skip_cleanup: true
on:
branch: master
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# che-dummy-plugin
Che Plug-in with a simple hello world Theia plug-in.

## Folders
here are the different folders:

### ui
This is a pure Theia plug-in. This plug-in contains a command named `Hello World` that displays an information message.

note: there is a `build.sh` script to build locally the npm plug-in. It can also be tested using the self-hosting mode in theia.

#### requirements: yarn + nodejs

### assembly

In this folder, the Che plug-in is generated (`che-service-plugin.tar.gz`) including:
- che-plugin.yaml file (from `etc/` folder) describing the Che plug-in wrapping the theia plug-in
- che-dependency.yaml file (from `etc/` folder) linking the Theia plug-in to a local file
- hello_world_plugin.theia the Theia plug-in

note: there is a build.sh allowing to recreate this .tar.gz file


## Building

In the root folder, `build.sh` script can build the theia plug-in and create Che plug-in file.

## Using

In Releases section, https://github.com/ws-skeleton/che-dummy-plugin/releases, a new Che plug-in is published for each commit occuring into master.

## CI job
Che plug-in is managed by a Travis-CI job
--> https://travis-ci.org/ws-skeleton/che-dummy-plugin/builds




5 changes: 5 additions & 0 deletions assembly/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Che Plugin Assembly

Package plug-in definition and includes Theia plug-in inside

Result is a .tar.gz file
18 changes: 18 additions & 0 deletions assembly/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e
set -u

if [ -f che-dummy-plugin.tar.gz ]; then
rm che-dummy-plugin.tar.gz
fi

if [ ! -f ../ui/hello_world_plugin.theia ]; then
echo "Theia plug-in does not exist. Please compile Theia plug-in first"
echo "in ../ui directory"
exit 1
fi

tar cvf che-dummy-plugin.tar -C ../ui hello_world_plugin.theia
tar uvf che-dummy-plugin.tar etc
gzip che-dummy-plugin.tar

4 changes: 4 additions & 0 deletions assembly/etc/che-dependency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins:
- id: theia-hello-world
version: 1.0.0
location: /hello_world_plugin.theia
3 changes: 3 additions & 0 deletions assembly/etc/che-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
editors:
- id: org.eclipse.che.editor.theia
plugins: [theia-hello-world:1.0.0]
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e
set -u

BLUE='\033[1;34m'
NC='\033[0m'
DIR=$(cd "$(dirname "$0")"; pwd)

printf "${BLUE}Building Theia plug-in${NC}\n"
cd ${DIR}/ui && ./build.sh

printf "${BLUE}Generating Che plug-in file...${NC}\n"
cd ${DIR}/assembly && ./build.sh
printf "${BLUE}Generated in assembly/che-service-plugin.tar.gz${NC}\n"
3 changes: 3 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib/
node_modules/
*.theia
2 changes: 2 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hello-world-plugin
hello-world Plugin example for Theia.
6 changes: 6 additions & 0 deletions ui/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
set -u

yarn

35 changes: 35 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "hello-world-plugin",
"publisher": "theia",
"keywords": [
"theia-plugin"
],
"version": "0.0.1",
"files": [
"src"
],
"devDependencies": {
"@theia/plugin": "next",
"@theia/plugin-packager": "latest",
"rimraf": "2.6.2",
"typescript-formatter": "7.2.2",
"typescript": "2.9.2"
},
"scripts": {
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf lib",
"format-code": "tsfmt -r",
"watch": "tsc -watch",
"compile": "tsc",
"build": "yarn run format-code && yarn run compile && theia:plugin pack"
},
"engines": {
"theiaPlugin": "next"
},
"theiaPlugin": {


"backend": "lib/hello-world-backend-plugin.js"

}
}
20 changes: 20 additions & 0 deletions ui/src/hello-world-backend-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Generated using theia-plugin-generator
*/

import * as theia from '@theia/plugin';

export function start() {
const informationMessageTestCommand = {
id: 'hello-world-example-generated',
label: "Hello World"
};
theia.commands.registerCommand(informationMessageTestCommand, (...args: any[]) => {
theia.window.showInformationMessage('Hello World!');
});

}

export function stop() {

}
25 changes: 25 additions & 0 deletions ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"strict": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"emitDecoratorMetadata": true,
"downlevelIteration": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"lib": [
"es6",


"webworker"

],
"sourceMap": true,
"rootDir": "src",
"outDir": "lib"
},
"include": [
"src"
]
}
18 changes: 18 additions & 0 deletions ui/tsfmt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"baseIndentSize": 0,
"newLineCharacter": "\n",
"indentSize": 4,
"tabSize": 4,
"indentStyle": 4,
"convertTabsToSpaces": true,
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
Loading

0 comments on commit 619609b

Please sign in to comment.