-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f043eb7
commit 99a950e
Showing
10 changed files
with
9,859 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,4 @@ | ||
node_modules | ||
/src-gen | ||
lib | ||
.browser_modules |
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,170 @@ | ||
# Taken from official Theia images | ||
# https://github.com/theia-ide/theia-apps/blob/master/theia-full-docker/Dockerfile | ||
FROM ubuntu:18.04 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
#Common deps | ||
RUN apt-get update && apt-get -y install curl xz-utils wget gpg | ||
|
||
#Install node and yarn | ||
#From: https://github.com/nodejs/docker-node/blob/6b8d86d6ad59e0d1e7a94cec2e909cad137a028f/8/Dockerfile | ||
|
||
# gpg keys listed at https://github.com/nodejs/node#release-keys | ||
RUN set -ex \ | ||
&& for key in \ | ||
4ED778F539E3634C779C87C6D7062848A1AB005C \ | ||
B9E2F5981AA6E0CD28160D9FF13993A75599653C \ | ||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | ||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | ||
77984A986EBC2AA786BC0F66B01FBB92821C587A \ | ||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | ||
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | ||
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | ||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | ||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | ||
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ | ||
; do \ | ||
gpg --batch --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys "$key" || \ | ||
gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --batch --keyserver pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ | ||
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ | ||
done | ||
|
||
ARG NODE_VERSION=10.15.3 | ||
ENV NODE_VERSION $NODE_VERSION | ||
|
||
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ | ||
&& case "${dpkgArch##*-}" in \ | ||
amd64) ARCH='x64';; \ | ||
ppc64el) ARCH='ppc64le';; \ | ||
s390x) ARCH='s390x';; \ | ||
arm64) ARCH='arm64';; \ | ||
armhf) ARCH='armv7l';; \ | ||
i386) ARCH='x86';; \ | ||
*) echo "unsupported architecture"; exit 1 ;; \ | ||
esac \ | ||
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ | ||
&& curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | ||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | ||
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | ||
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ | ||
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ | ||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs | ||
|
||
ENV YARN_VERSION 1.15.2 | ||
|
||
RUN set -ex \ | ||
&& for key in \ | ||
6A010C5166006599AA17F08146C2130DFD2497F5 \ | ||
; do \ | ||
gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --batch --keyserver pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ | ||
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ | ||
done \ | ||
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ | ||
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ | ||
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | ||
&& mkdir -p /opt/yarn \ | ||
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ | ||
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ | ||
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ | ||
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz | ||
|
||
#Developer tools | ||
|
||
## Git and sudo (sudo needed for user override) | ||
RUN apt-get -y install git sudo | ||
|
||
#LSPs | ||
|
||
##GO | ||
ENV GO_VERSION 1.11.4 | ||
ENV GOPATH=/usr/local/go-packages | ||
ENV GO_ROOT=/usr/local/go | ||
ENV PATH $PATH:/usr/local/go/bin | ||
ENV PATH $PATH:${GOPATH}/bin | ||
|
||
RUN curl -sS https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -C /usr/local -xzf - && \ | ||
go get -u -v github.com/nsf/gocode && \ | ||
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs && \ | ||
go get -u -v github.com/ramya-rao-a/go-outline && \ | ||
go get -u -v github.com/acroca/go-symbols && \ | ||
go get -u -v golang.org/x/tools/cmd/guru && \ | ||
go get -u -v golang.org/x/tools/cmd/gorename && \ | ||
go get -u -v github.com/fatih/gomodifytags && \ | ||
go get -u -v github.com/haya14busa/goplay/cmd/goplay && \ | ||
go get -u -v github.com/josharian/impl && \ | ||
go get -u -v github.com/tylerb/gotype-live && \ | ||
go get -u -v github.com/rogpeppe/godef && \ | ||
go get -u -v golang.org/x/tools/cmd/godoc && \ | ||
go get -u -v github.com/zmb3/gogetdoc && \ | ||
go get -u -v golang.org/x/tools/cmd/goimports && \ | ||
go get -u -v sourcegraph.com/sqs/goreturns && \ | ||
go get -u -v github.com/golang/lint/golint && \ | ||
go get -u -v github.com/cweill/gotests/... && \ | ||
go get -u -v github.com/alecthomas/gometalinter && \ | ||
go get -u -v honnef.co/go/tools/... && \ | ||
go get -u -v github.com/sourcegraph/go-langserver && \ | ||
go get -u -v github.com/derekparker/delve/cmd/dlv && \ | ||
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct | ||
|
||
#Java | ||
RUN apt-get update && apt-get -y install openjdk-8-jdk maven gradle | ||
|
||
|
||
#C/C++ | ||
# public LLVM PPA, development version of LLVM | ||
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ | ||
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" > /etc/apt/sources.list.d/llvm.list && \ | ||
apt-get update && apt-get install -y clang-tools-9 && \ | ||
ln -s /usr/bin/clangd-9 /usr/bin/clangd | ||
|
||
#Python 2 | ||
RUN apt-get update && apt-get install -y python python-pip && \ | ||
pip install python-language-server; | ||
|
||
#PHP | ||
RUN apt-get -y install php php-cli php-mbstring unzip | ||
|
||
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md | ||
# https://linuxconfig.org/how-to-install-php-composer-on-debian-linux | ||
RUN curl -s -o composer-setup.php https://getcomposer.org/installer \ | ||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ | ||
&& rm composer-setup.php | ||
|
||
#Ruby | ||
RUN apt-get -y install ruby ruby-dev zlib1g-dev && \ | ||
gem install solargraph | ||
|
||
|
||
## User account | ||
RUN adduser --disabled-password --gecos '' theia && \ | ||
adduser theia sudo && \ | ||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers; | ||
|
||
RUN chmod g+rw /home && \ | ||
mkdir -p /home/project && \ | ||
chown -R theia:theia /home/theia && \ | ||
chown -R theia:theia /home/project; | ||
|
||
#Theia | ||
##Needed for node-gyp, nsfw build | ||
RUN apt-get update && apt-get install -y python build-essential | ||
|
||
USER theia | ||
WORKDIR /home/theia | ||
ADD package.json yarn.lock ./ | ||
ADD packages packages | ||
ARG GITHUB_TOKEN | ||
# using "NODE_OPTIONS=..." to avoid out-of-memory problem in CI | ||
RUN yarn --cache-folder ./ycache && rm -rf ./ycache && \ | ||
NODE_OPTIONS="--max_old_space_size=4096" yarn build | ||
EXPOSE 3000 | ||
ENV SHELL /bin/bash | ||
|
||
ENTRYPOINT [ "yarn", "start", "/home/project", "--hostname=0.0.0.0" ] |
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,2 @@ | ||
# Customized Theia IDE for Code FREAK | ||
|
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 @@ | ||
{ | ||
"name": "freak-theia", | ||
"private": true, | ||
"dependencies": { | ||
"typescript": "latest", | ||
"@theia/typescript": "latest", | ||
"@theia/navigator": "latest", | ||
"@theia/terminal": "latest", | ||
"@theia/outline-view": "latest", | ||
"@theia/preferences": "latest", | ||
"@theia/messages": "latest", | ||
"@theia/git": "latest", | ||
"@theia/file-search": "latest", | ||
"@theia/markers": "latest", | ||
"@theia/preview": "latest", | ||
"@theia/callhierarchy": "latest", | ||
"@theia/merge-conflicts": "latest", | ||
"@theia/search-in-workspace": "latest", | ||
"@theia/json": "latest", | ||
"@theia/textmate-grammars": "latest", | ||
"@theia/mini-browser": "latest", | ||
"@code-freak/theia-branding": "0.0.0" | ||
}, | ||
"devDependencies": { | ||
"@theia/cli": "latest" | ||
}, | ||
"scripts": { | ||
"build": "yarn workspaces run prepare && theia build", | ||
"start": "theia start" | ||
}, | ||
"theia": { | ||
"frontend": { | ||
"config": { | ||
"defaultTheme": "light", | ||
"applicationName": "Code FREAK" | ||
} | ||
} | ||
}, | ||
"workspaces": { | ||
"packages": [ | ||
"packages/*" | ||
] | ||
} | ||
} |
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,31 @@ | ||
{ | ||
"name": "@code-freak/theia-branding", | ||
"license": "AGPL-3.0-or-later", | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"version": "0.0.0", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"dependencies": { | ||
"@theia/core": "latest", | ||
"@theia/filesystem": "latest" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "latest", | ||
"typescript": "^3.1.3" | ||
}, | ||
"scripts": { | ||
"prepare": "yarn run clean && yarn run build", | ||
"clean": "rimraf lib", | ||
"build": "tsc", | ||
"watch": "tsc -w" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/theia-branding-frontend-module" | ||
} | ||
] | ||
} |
77 changes: 77 additions & 0 deletions
77
theia/packages/theia-branding/src/browser/theia-branding-contribution.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,77 @@ | ||
import {injectable, inject} from "inversify"; | ||
import { | ||
FrontendApplication, | ||
FrontendApplicationContribution, | ||
OpenerService | ||
} from "@theia/core/lib/browser"; | ||
import {WorkspaceService} from '@theia/workspace/lib/browser'; | ||
import {FileNavigatorContribution} from "@theia/navigator/lib/browser/navigator-contribution"; | ||
import {PreviewUri, PreviewHandler} from "@theia/preview/lib/browser" | ||
import URI from "@theia/core/lib/common/uri" | ||
import {FileStat} from "@theia/filesystem/lib/common"; | ||
|
||
// list of files that will opened initially | ||
// the order is important if more than one file is found | ||
const DEFAULT_FILES = [ | ||
/^README\.md$/, | ||
/(^index|main)\.(md|js|ts|c|cpp|java|py|rb|php|htm|html)$/i | ||
]; | ||
|
||
/** | ||
* Tries the default files in the defined order to find one matching file | ||
* @param files | ||
*/ | ||
function findDefaultFile(files: FileStat[]): URI | undefined { | ||
for (let regex of DEFAULT_FILES) { | ||
for (let file of files) { | ||
const path = file.uri; | ||
const basename = path.substr(path.lastIndexOf('/') + 1); | ||
if (regex.test(basename)) { | ||
return new URI(file.uri); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@injectable() | ||
export class TheiaBrandingContribution implements FrontendApplicationContribution { | ||
|
||
constructor( | ||
@inject(FileNavigatorContribution) private readonly navigatorContribution: FileNavigatorContribution, | ||
@inject(WorkspaceService) private readonly workspaceService: WorkspaceService, | ||
@inject(OpenerService) private readonly openerService: OpenerService, | ||
@inject(PreviewHandler) private readonly previewHandler: PreviewHandler | ||
) { | ||
} | ||
|
||
async initializeLayout(app: FrontendApplication): Promise<void> { | ||
await this.openNavigator(); | ||
await this.openDefaultFile(); | ||
} | ||
|
||
/** | ||
* Open the file navigator in the sidebar | ||
*/ | ||
async openNavigator(): Promise<void> { | ||
await this.navigatorContribution.openView({reveal: true}); | ||
} | ||
|
||
/** | ||
* Try to open a README.md file or something else that looks like a good default | ||
*/ | ||
async openDefaultFile(): Promise<void> { | ||
const workspace = this.workspaceService.workspace; | ||
if (workspace && workspace.children) { | ||
const files = workspace.children; | ||
let uri = findDefaultFile(files); | ||
if (uri) { | ||
// show a nice preview if the preview handler can open the file | ||
if (this.previewHandler.canHandle(uri)) { | ||
uri = PreviewUri.encode(uri) | ||
} | ||
const opener = await this.openerService.getOpener(uri); | ||
opener.open(uri) | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
theia/packages/theia-branding/src/browser/theia-branding-frontend-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,7 @@ | ||
import { TheiaBrandingContribution } from './theia-branding-contribution'; | ||
import { ContainerModule } from "inversify"; | ||
import {FrontendApplicationContribution} from "@theia/core/lib/browser"; | ||
|
||
export default new ContainerModule(bind => { | ||
bind(FrontendApplicationContribution).to(TheiaBrandingContribution).inSingletonScope(); | ||
}); |
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,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"experimentalDecorators": true, | ||
"noUnusedLocals": true, | ||
"emitDecoratorMetadata": true, | ||
"downlevelIteration": true, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"target": "es5", | ||
"lib": [ | ||
"es6", | ||
"dom" | ||
], | ||
"sourceMap": true, | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
Oops, something went wrong.