Skip to content

Commit

Permalink
Download extras plugins as vsix to extensions dir
Browse files Browse the repository at this point in the history
  • Loading branch information
giflw committed Aug 11, 2023
1 parent c7ebb17 commit f85c693
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 22 deletions.
13 changes: 11 additions & 2 deletions applications/data/backend/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"window.titleBarStyle": "custom",
"security.workspace.trust.startupPrompt": "once",
"editor.wordWrap": "on",
"editor.minimap.enabled": true,
"editor.minimap.enabled": false,
"editor.fontFamily": "\"MesloLGM NF\", Consolas, 'Courier New', monospace",
"workbench.colorTheme": "Synthax",
"workbench.iconTheme": "material-icon-theme",
Expand All @@ -20,7 +20,16 @@
"files.watcherExclude": {
"**/.bloop": true,
"**/.metals": true,
"**/.ammonite": true
"**/.ammonite": true,
"**/target": true
},
"redhat.telemetry.enabled": false,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
}
}

54 changes: 54 additions & 0 deletions jakefile.d/plugins-list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"plugins": {
"redhat.java": "https://open-vsx.org/api/redhat/java/1.22.2023081104/file/redhat.java-1.22.2023081104.vsix",
"vscjava.vscode-java-debug": "https://open-vsx.org/api/vscjava/vscode-java-debug/0.53.0/file/vscjava.vscode-java-debug-0.53.0.vsix",
"vscjava.vscode-java-test": "https://open-vsx.org/api/vscjava/vscode-java-test/0.39.1/file/vscjava.vscode-java-test-0.39.1.vsix",
"vscjava.vscode-maven": "https://open-vsx.org/api/vscjava/vscode-maven/0.42.0/file/vscjava.vscode-maven-0.42.0.vsix",
"vscjava.vscode-java-dependency": "https://open-vsx.org/api/vscjava/vscode-java-dependency/0.23.1/file/vscjava.vscode-java-dependency-0.23.1.vsix",
"a5hk.paper": "https://open-vsx.org/api/a5hk/paper/1.1.2/file/a5hk.paper-1.1.2.vsix",
"akamud.vscode-theme-onelight": "https://open-vsx.org/api/akamud/vscode-theme-onelight/2.3.0/file/akamud.vscode-theme-onelight-2.3.0.vsix",
"asabil.meson": "https://open-vsx.org/api/asabil/meson/1.3.0/file/asabil.meson-1.3.0.vsix",
"asciidoctor.asciidoctor-vscode": "https://open-vsx.org/api/asciidoctor/asciidoctor-vscode/3.1.3/file/asciidoctor.asciidoctor-vscode-3.1.3.vsix",
"buianhthang.gitflow": "https://open-vsx.org/api/buianhthang/gitflow/2.1.0/file/buianhthang.gitflow-2.1.0.vsix",
"darkriszty.markdown-table-prettify": "https://open-vsx.org/api/darkriszty/markdown-table-prettify/3.6.0/file/darkriszty.markdown-table-prettify-3.6.0.vsix",
"devsense.composer-php-vscode": "https://open-vsx.org/api/devsense/composer-php-vscode/1.36.13505/file/devsense.composer-php-vscode-1.36.13505.vsix",
"donjayamanne.githistory": "https://open-vsx.org/api/donjayamanne/githistory/0.6.20/file/donjayamanne.githistory-0.6.20.vsix",
"EditorConfig.EditorConfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.16.6/file/EditorConfig.EditorConfig-0.16.6.vsix",
"esbenp.prettier-vscode": "https://open-vsx.org/api/esbenp/prettier-vscode/10.1.0/file/esbenp.prettier-vscode-10.1.0.vsix",
"felixfbecker.php-debug": "https://open-vsx.org/api/felixfbecker/php-debug/1.22.0/file/felixfbecker.php-debug-1.22.0.vsix",
"felixfbecker.php-intellisense": "https://open-vsx.org/api/felixfbecker/php-intellisense/2.3.14/file/felixfbecker.php-intellisense-2.3.14.vsix",
"foxhoundn.synthax": "https://open-vsx.org/api/foxhoundn/synthax/0.1.13/file/foxhoundn.synthax-0.1.13.vsix",
"fwcd.kotlin": "https://open-vsx.org/api/fwcd/kotlin/0.2.31/file/fwcd.kotlin-0.2.31.vsix",
"Hamza-Aziane.obsidian-dark": "https://open-vsx.org/api/Hamza-Aziane/obsidian-dark/1.0.0/file/Hamza-Aziane.obsidian-dark-1.0.0.vsix",
"jeandeaual.lilypond-syntax": "https://open-vsx.org/api/jeandeaual/lilypond-syntax/0.1.1/file/jeandeaual.lilypond-syntax-0.1.1.vsix",
"jebbs.plantuml": "https://open-vsx.org/api/jebbs/plantuml/2.17.5/file/jebbs.plantuml-2.17.5.vsix",
"jeff-hykin.better-dockerfile-syntax": "https://open-vsx.org/api/jeff-hykin/better-dockerfile-syntax/1.0.2/file/jeff-hykin.better-dockerfile-syntax-1.0.2.vsix",
"jetmartin.bats": "https://open-vsx.org/api/jetmartin/bats/0.1.9/file/jetmartin.bats-0.1.9.vsix",
"jock.svg": "https://open-vsx.org/api/jock/svg/1.5.3/file/jock.svg-1.5.3.vsix",
"johnsoncodehk.volar": "https://open-vsx.org/api/johnsoncodehk/volar/0.30.1/file/johnsoncodehk.volar-0.30.1.vsix",
"mads-hartmann.bash-ide-vscode": "https://open-vsx.org/api/mads-hartmann/bash-ide-vscode/1.38.0/file/mads-hartmann.bash-ide-vscode-1.38.0.vsix",
"marcostazi.VS-code-vagrantfile": "https://open-vsx.org/api/marcostazi/VS-code-vagrantfile/0.0.7/file/marcostazi.VS-code-vagrantfile-0.0.7.vsix",
"max-SS.Cyberpunk": "https://open-vsx.org/api/max-SS/Cyberpunk/1.2.14/file/max-SS.Cyberpunk-1.2.14.vsix",
"MehediDracula.php-namespace-resolver": "https://open-vsx.org/api/MehediDracula/php-namespace-resolver/1.1.9/file/MehediDracula.php-namespace-resolver-1.1.9.vsix",
"mike-flanigan.daobeam": "https://open-vsx.org/api/mike-flanigan/daobeam/1.3.12/file/mike-flanigan.daobeam-1.3.12.vsix",
"mikestead.dotenv": "https://open-vsx.org/api/mikestead/dotenv/1.0.1/file/mikestead.dotenv-1.0.1.vsix",
"mtxr.sqltools": "https://open-vsx.org/api/mtxr/sqltools/0.28.0/file/mtxr.sqltools-0.28.0.vsix",
"mtxr.sqltools-driver-mssql": "https://open-vsx.org/api/mtxr/sqltools-driver-mssql/0.4.1/file/mtxr.sqltools-driver-mssql-0.4.1.vsix",
"mtxr.sqltools-driver-mysql": "https://open-vsx.org/api/mtxr/sqltools-driver-mysql/0.5.1/file/mtxr.sqltools-driver-mysql-0.5.1.vsix",
"mtxr.sqltools-driver-pg": "https://open-vsx.org/api/mtxr/sqltools-driver-pg/0.5.1/file/mtxr.sqltools-driver-pg-0.5.1.vsix",
"mtxr.sqltools-driver-sqlite": "https://open-vsx.org/api/mtxr/sqltools-driver-sqlite/0.5.0/file/mtxr.sqltools-driver-sqlite-0.5.0.vsix",
"njzy.stats-bar": "https://open-vsx.org/api/njzy/stats-bar/0.5.2/file/njzy.stats-bar-0.5.2.vsix",
"olifink.fedora-gnome-light-dark": "https://open-vsx.org/api/olifink/fedora-gnome-light-dark/0.0.4/file/olifink.fedora-gnome-light-dark-0.0.4.vsix",
"phil294.git-log--graph": "https://open-vsx.org/api/phil294/git-log--graph/0.1.12/file/phil294.git-log--graph-0.1.12.vsix",
"piousdeer.adwaita-theme": "https://open-vsx.org/api/piousdeer/adwaita-theme/1.1.0/file/piousdeer.adwaita-theme-1.1.0.vsix",
"PKief.material-icon-theme": "https://open-vsx.org/api/PKief/material-icon-theme/4.28.0/file/PKief.material-icon-theme-4.28.0.vsix",
"rogalmic.bash-debug": "https://open-vsx.org/api/rogalmic/bash-debug/0.3.9/file/rogalmic.bash-debug-0.3.9.vsix",
"rust-lang.rust": "https://open-vsx.org/api/rust-lang/rust/0.7.8/file/rust-lang.rust-0.7.8.vsix",
"rvest.vs-code-prettier-eslint": "https://open-vsx.org/api/rvest/vs-code-prettier-eslint/5.0.2/file/rvest.vs-code-prettier-eslint-5.0.2.vsix",
"scala-lang.scala": "https://open-vsx.org/api/scala-lang/scala/0.5.6/file/scala-lang.scala-0.5.6.vsix",
"scalameta.metals": "https://open-vsx.org/api/scalameta/metals/1.24.0/file/scalameta.metals-1.24.0.vsix",
"syler.sass-indented": "https://open-vsx.org/api/syler/sass-indented/1.8.27/file/syler.sass-indented-1.8.27.vsix",
"techygrrrl.techygrrrl-cmyk-colourrrs": "https://open-vsx.org/api/techygrrrl/techygrrrl-cmyk-colourrrs/0.2.2/file/techygrrrl.techygrrrl-cmyk-colourrrs-0.2.2.vsix",
"iliazeus.vscode-ansi": "https://open-vsx.org/api/iliazeus/vscode-ansi/1.1.6/file/iliazeus.vscode-ansi-1.1.6.vsix"
}
}
36 changes: 18 additions & 18 deletions jakefile.d/plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { attempt, logger, download, get, sleep, unzip, PACKAGE_JSON, PLUGINS_DIR } = require('./utils.cjs');
const { attempt, logger, download, get, sleep, unzip, PLUGINS_FILE, PLUGINS_DIR } = require('./utils.cjs');

const fs = require('fs');
const fse = require('fs-extra');
Expand All @@ -18,12 +18,12 @@ task('plugins', ['plugins:download', 'plugins:prune'], () => {
namespace('plugins', function () {
desc('Update Eos Thesis plugins versions/urls on package.json');
task('update', async () => {
await updatePluginsOnFile(PACKAGE_JSON);
await updatePluginsOnFile(PLUGINS_FILE);
});

desc('Remove undeclared plugins');
task('prune', () => {
const plugins = loadPackageJson().theiaPlugins;
const plugins = loadPluginsListJson().plugins;
fs.readdirSync(PLUGINS_DIR).forEach(async (file) => {
const parts = file.split('-');
const version = parts.splice(-1)[0];
Expand All @@ -50,7 +50,7 @@ namespace('plugins', function () {

desc('Remove all downloaded plugins');
task('purge', async () => {
let target = PLUGINS_DIR + "\\*";
let target = PLUGINS_DIR + "\\*.vsix";
logger.warn(`Purging ${target}`);
await sleep(3000);

Expand All @@ -73,22 +73,22 @@ namespace('plugins', function () {

desc('Update plantuml on jebbs.plantuml plugin');
task('plantuml', async () => {
const filepath = path.resolve(
/*const filepath = path.resolve(
PLUGINS_DIR,
fs.readdirSync(PLUGINS_DIR).find(f => f.startsWith('jebbs.plantuml')),
'extension',
'plantuml.jar'
);
const releases = await get('https://api.github.com/repos/plantuml/plantuml/releases/latest');
const latest = releases.assets.find(r => r.name === 'plantuml.jar');
await download(latest.browser_download_url, filepath, { prefix: 'plantuml.jar' });
await download(latest.browser_download_url, filepath, { prefix: 'plantuml.jar' });*/
});

desc('Download declared all plugins on package.json theiaPlugins');
desc('Download all declared plugins on plugins-list.json plugins');
task('download', async () => {
const plugins = loadPackageJson();
for (let plugin in plugins.theiaPlugins) {
const url = plugins.theiaPlugins[plugin];
const plugins = loadPluginsListJson();
for (let plugin in plugins.plugins) {
const url = plugins.plugins[plugin];
const dirpath = path.resolve(PLUGINS_DIR, plugin + '-' + versionFromUrl(url));
const filepath = dirpath + '.vsix';
if (fs.existsSync(dirpath)) {
Expand All @@ -99,7 +99,7 @@ namespace('plugins', function () {
async () => await download(url, filepath, { prefix: plugin }),
{ delay: 100, prefix: plugin }
);
await unzip(filepath, dirpath, { prefix: plugin });
/*await unzip(filepath, dirpath, { prefix: plugin });
fs.unlinkSync(filepath);
if (plugin.includes('plantuml')) {
let t = Task['plugins:plantuml'];
Expand All @@ -109,7 +109,7 @@ namespace('plugins', function () {
});
t.invoke();
});
}
}*/
}
}
logger.info('All plugins downloaded!');
Expand All @@ -122,8 +122,8 @@ namespace('plugins', function () {
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function loadPackageJson() {
return JSON.parse(fs.readFileSync(PACKAGE_JSON));
function loadPluginsListJson() {
return JSON.parse(fs.readFileSync(PLUGINS_FILE));
}

async function updatePluginsOnFile(filename) {
Expand Down Expand Up @@ -152,15 +152,15 @@ async function updatePluginsOnFile(filename) {
return url;
};

const total = plugins.theiaPlugins.lenght;
const total = Object.keys(plugins.plugins).length;
let index = 0;
for (let plugin in plugins.theiaPlugins) {
for (let plugin in plugins.plugins) {
console.log('Updating ', index++, ' of ', total, '...');
let url = null;
while (url === null) {
try {
url = await updatePluginVersion(plugin, plugins.theiaPlugins[plugin]);
plugins.theiaPlugins[plugin] = url;
url = await updatePluginVersion(plugin, plugins.plugins[plugin]);
plugins.plugins[plugin] = url;
} catch (err) {
console.log(err);
}
Expand Down
3 changes: 2 additions & 1 deletion jakefile.d/utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module.exports = {
DIST_DIR: path.resolve(BASEDIR, "applications/electron/dist"),
ELECTRON_DIR: path.resolve(BASEDIR, "applications/electron"),
PACKAGE_JSON: path.resolve(BASEDIR, "applications/electron/package.json"),
PLUGINS_DIR: path.resolve(BASEDIR, "applications/electron/plugins"),
PLUGINS_DIR: path.resolve(BASEDIR, "applications/data/backend/extensions"),
PLUGINS_FILE: path.resolve(BASEDIR, "jakefile.d/plugins-list.json"),
logger,
sleep,
get: async (url) => {
Expand Down
2 changes: 1 addition & 1 deletion jakefile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('dotenv').config();
//require('dotenv').config();

const { task, desc, Task } = require("jake");
const { logger } = require("./jakefile.d/utils.cjs");
Expand Down

0 comments on commit f85c693

Please sign in to comment.