Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Consume VS Code built-in extension
Browse files Browse the repository at this point in the history
Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
  • Loading branch information
vzhukovs committed Feb 13, 2020
1 parent 1d2ae62 commit c75d401
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 19 deletions.
1 change: 0 additions & 1 deletion dockerfiles/theia/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ RUN if [ -z $GITHUB_TOKEN ]; then unset GITHUB_TOKEN; fi && \

# Add yeoman generator & vscode git plug-ins
COPY asset-untagged-c11870b25a17d20bb7a7-theia_yeoman_plugin.theia /home/theia-dev/theia-source-code/production/plugins/theia_yeoman_plugin.theia
COPY asset-vscode-git-1.3.0.1.vsix /home/theia-dev/theia-source-code/production/plugins/vscode-git-1.3.0.1.vsix

# change permissions
RUN find production -exec sh -c "chgrp 0 {}; chmod g+rwX {}" \; 2>log.txt
Expand Down
7 changes: 0 additions & 7 deletions dockerfiles/theia/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ if [ ! -f "${THEIA_YEOMAN_PLUGIN}" ]; then
curl -L -o ${THEIA_YEOMAN_PLUGIN} https://github.com/eclipse/theia-yeoman-plugin/releases/download/untagged-c11870b25a17d20bb7a7/theia_yeoman_plugin.theia
fi

# VS Code git plug-in
VSCODE_GIT_PLUGIN="${DIR}/asset-vscode-git-1.3.0.1.vsix"
if [ ! -f "${VSCODE_GIT_PLUGIN}" ]; then
curl -L -o ${VSCODE_GIT_PLUGIN} https://github.com/che-incubator/vscode-git/releases/download/1.30.1/vscode-git-1.3.0.1.vsix
fi


init --name:theia "$@"

if [ "${CDN_PREFIX:-}" != "" ]; then
Expand Down
43 changes: 33 additions & 10 deletions generator/src/foreach_yarn
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,44 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
const fs = require('fs');
const path = require('path');
const spawnSync = require('child_process').spawnSync;

const currentDir = __dirname;
const targetDir = `${__dirname}/../production/plugins`

mkdirSyncRecursive(targetDir);
fs.readdirSync(currentDir).forEach((pluginFolderName) => {
console.log(pluginFolderName);
const pluginFolderPath = `${currentDir}/${pluginFolderName}`;
if (fs.existsSync(`${pluginFolderPath}/package.json`)) {
console.log(`\n✍️ Running \`yarn\` on ${pluginFolderPath}`);

fs.readdirSync(currentDir).forEach((pluginEntryName) => {
console.log(`\n✍️ Process plugin ${pluginEntryName}`);

const pluginEntryPath = `${currentDir}/${pluginEntryName}`;

if (fs.existsSync(`${pluginEntryPath}/package.json`)) {
console.log(`\n✍️ Running \`yarn\` on ${pluginEntryPath}`);

const r = spawnSync('yarn', [], {
cwd: `${pluginFolderPath}`,
cwd: `${pluginEntryPath}`,
detached: true,
stdio: "inherit"
});

if (r.status === 1) {
process.exit(1);
}

fs.readdirSync(`${pluginFolderPath}`).forEach((fileName) => {
fs.readdirSync(`${pluginEntryPath}`).forEach((fileName) => {
if(fileName.endsWith('.theia')){
console.log(`\n✍️ Copying ${pluginFolderPath}/${fileName} theia package to ${targetDir}/${fileName}`);
fs.copyFileSync(`${pluginFolderPath}/${fileName}`, `${targetDir}/${fileName}`);
console.log(`\n✍️ Copying ${pluginEntryPath}/${fileName} theia package to ${targetDir}/${fileName}`);
fs.copyFileSync(`${pluginEntryPath}/${fileName}`, `${targetDir}/${fileName}`);
}
})
} else if (pluginEntryName.endsWith('.vsix') || pluginEntryName.endsWith('.tar.gz')) {
console.log(`\n✍️ Copying ${pluginEntryPath} VSCode built-in extension to ${targetDir}/${pluginEntryName}`);
fs.copyFileSync(`${pluginEntryPath}`, `${targetDir}/${pluginEntryName}`);
} else if (fs.existsSync(`${pluginEntryPath}/extension.vsixmanifest`)) {
console.log(`\n✍️ Copying ${pluginEntryPath} VSCode built-in unpacked extension to ${targetDir}/${pluginEntryName}`);
copyFolderSync(`${pluginEntryPath}`, `${targetDir}/${pluginEntryName}`);
}
});

Expand All @@ -45,3 +57,14 @@ function mkdirSyncRecursive(dir) {
curPath.length > 0 && !fs.existsSync(curPath) ? fs.mkdirSync(curPath) : null;
}
};

function copyFolderSync(from, to) {
fs.mkdirSync(to);
fs.readdirSync(from).forEach(element => {
if (fs.lstatSync(path.join(from, element)).isFile()) {
fs.copyFileSync(path.join(from, element), path.join(to, element));
} else {
copyFolderSync(path.join(from, element), path.join(to, element));
}
});
}
18 changes: 18 additions & 0 deletions generator/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,22 @@ export class Init {
await fs.writeFile(theiaPackagePath, json);
}

async updatePluginsConfigurtion(): Promise<void> {
const theiaPackagePath = path.join(this.rootFolder, 'package.json');
const theiaPackage = await readPkg(theiaPackagePath);

theiaPackage['theiaPlugins'] = await this.getPluginsList();

const json = JSON.stringify(theiaPackage, undefined, 2);
await fs.writeFile(theiaPackagePath, json);
}

private async getPluginsList(): Promise<any> {
const srcDir = path.resolve(__dirname, '../src');
const templateDir = path.join(srcDir, 'templates');
const pluginsJsonContent = await fs.readFile(path.join(templateDir, 'theiaPlugins.json'));

return JSON.parse(pluginsJsonContent.toString());
}

}
1 change: 0 additions & 1 deletion generator/src/templates/assembly-package.mst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@theia/process": "^{{ version }}",
"@theia/search-in-workspace": "^{{ version }}",
"@theia/task": "^{{ version }}",
"@theia/textmate-grammars": "^{{ version }}",
"@theia/tslint": "^{{ version }}",
"@theia/userstorage": "^{{ version }}",
"@theia/variable-resolver": "^{{ version }}",
Expand Down
49 changes: 49 additions & 0 deletions generator/src/templates/theiaPlugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"vscode-builtin-bat": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/bat-1.39.1-prel.vsix",
"vscode-builtin-clojure": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/clojure-1.39.1-prel.vsix",
"vscode-builtin-coffeescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/coffeescript-1.39.1-prel.vsix",
"vscode-builtin-configuration-editing": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/configuration-editing-1.39.1-prel.vsix",
"vscode-builtin-cpp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/cpp-1.39.1-prel.vsix",
"vscode-builtin-csharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/csharp-1.39.1-prel.vsix",
"vscode-builtin-css": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/css-1.39.1-prel.vsix",
"vscode-builtin-debug-auto-launch": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/debug-auto-launch-1.39.1-prel.vsix",
"vscode-builtin-docker": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/docker-1.39.1-prel.vsix",
"vscode-builtin-fsharp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/fsharp-1.39.1-prel.vsix",
"vscode-builtin-go": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/go-1.39.1-prel.vsix",
"vscode-builtin-groovy": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/groovy-1.39.1-prel.vsix",
"vscode-builtin-grunt": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/grunt-1.39.1-prel.vsix",
"vscode-builtin-gulp": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/gulp-1.39.1-prel.vsix",
"vscode-builtin-handlebars": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/handlebars-1.39.1-prel.vsix",
"vscode-builtin-hlsl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/hlsl-1.39.1-prel.vsix",
"vscode-builtin-html": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/html-1.39.1-prel.vsix",
"vscode-builtin-ini": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ini-1.39.1-prel.vsix",
"vscode-builtin-jake": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/jake-1.39.1-prel.vsix",
"vscode-builtin-java": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/java-1.39.1-prel.vsix",
"vscode-builtin-javascript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/javascript-1.39.1-prel.vsix",
"vscode-builtin-json": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/json-1.39.1-prel.vsix",
"vscode-builtin-less": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/less-1.39.1-prel.vsix",
"vscode-builtin-log": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/log-1.39.1-prel.vsix",
"vscode-builtin-lua": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/lua-1.39.1-prel.vsix",
"vscode-builtin-make": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/make-1.39.1-prel.vsix",
"vscode-builtin-markdown": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-1.39.1-prel.vsix",
"vscode-builtin-npm": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/npm-1.39.1-prel.vsix",
"vscode-builtin-objective-c": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/objective-c-1.39.1-prel.vsix",
"vscode-builtin-perl": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/perl-1.39.1-prel.vsix",
"vscode-builtin-powershell": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/powershell-1.39.1-prel.vsix",
"vscode-builtin-pug": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/pug-1.39.1-prel.vsix",
"vscode-builtin-python": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/python-1.39.1-prel.vsix",
"vscode-builtin-r": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/r-1.39.1-prel.vsix",
"vscode-builtin-razor": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/razor-1.39.1-prel.vsix",
"vscode-builtin-ruby": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/ruby-1.39.1-prel.vsix",
"vscode-builtin-rust": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/rust-1.39.1-prel.vsix",
"vscode-builtin-scss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/scss-1.39.1-prel.vsix",
"vscode-builtin-shaderlab": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shaderlab-1.39.1-prel.vsix",
"vscode-builtin-shellscript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/shellscript-1.39.1-prel.vsix",
"vscode-builtin-sql": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/sql-1.39.1-prel.vsix",
"vscode-builtin-swift": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/swift-1.39.1-prel.vsix",
"vscode-builtin-typescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-1.39.1-prel.vsix",
"vscode-builtin-vb": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/vb-1.39.1-prel.vsix",
"vscode-builtin-xml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/xml-1.39.1-prel.vsix",
"vscode-builtin-yaml": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/yaml-1.39.1-prel.vsix",
"vscode-git": "https://github.com/che-incubator/vscode-git/releases/download/vscode-git-1.30.1_0.0.1/vscode-git-1.30.1_0.0.1.vsix"
}
1 change: 1 addition & 0 deletions generator/src/yargs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const commandArgs = yargs
const version = await init.getCurrentVersion();
await init.generate();
await init.updadeBuildConfiguration();
await init.updatePluginsConfigurtion();
const extensions = new InitSources(process.cwd(), packagesFolder, pluginsFolder, cheFolder, assemblyFolder, version);
await extensions.initSourceLocationAliases(args.alias);
await extensions.readConfigurationAndGenerate(args.config, args.dev);
Expand Down

0 comments on commit c75d401

Please sign in to comment.