removed MS excel support, moved to plugin

This commit is contained in:
Jan Prochazka
2020-11-22 17:25:41 +01:00
parent e23e749cc5
commit a22320e141
13 changed files with 64 additions and 257 deletions

View File

@@ -1,12 +0,0 @@
const xlsx = require('xlsx');
const _ = require('lodash');
module.exports = {
openedReaders: {},
analyseExcel_meta: 'get',
async analyseExcel({ filePath }) {
const workbook = xlsx.readFile(filePath, { bookSheets: true });
return workbook.SheetNames;
},
};

View File

@@ -4,6 +4,7 @@ const path = require('path');
const pacote = require('pacote');
const { pluginstmpdir, pluginsdir } = require('../utility/directories');
const socket = require('../utility/socket');
const requirePlugin = require('../shell/requirePlugin');
async function loadPackageInfo(dir) {
const readmeFile = path.join(dir, 'README.md');
@@ -85,4 +86,10 @@ module.exports = {
await fs.rmdir(dir, { recursive: true });
socket.emitChanged(`installed-plugins-changed`);
},
command_meta: 'post',
async command({ packageName, command, args }) {
const content = requirePlugin(packageName);
return content.commands[command](args);
},
};

View File

@@ -19,7 +19,7 @@ const requirePluginsTemplate = (plugins) =>
.map(
(packageName) => `const ${_.camelCase(packageName)} = require(process.env.PLUGIN_${_.camelCase(packageName)});\n`
)
.join('');
.join('') + `dbgateApi.registerPlugins(${plugins.map((x) => _.camelCase(x)).join(',')});\n`;
const scriptTemplate = (script) => `
const dbgateApi = require(process.env.DBGATE_API);