mirror of
https://github.com/dbgate/dbgate
synced 2024-11-22 07:48:06 +00:00
2f5f0ab54c
This reverts commit 074a75075d
.
24 lines
745 B
JavaScript
24 lines
745 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function load() {
|
|
const plugins = {};
|
|
|
|
for (const packageName of fs.readdirSync('plugins')) {
|
|
if (!packageName.startsWith('dbgate-plugin-')) continue;
|
|
const dir = path.join('plugins', packageName);
|
|
const frontend = fs.readFileSync(path.join(dir, 'dist', 'frontend.js'), 'utf-8');
|
|
const readme = fs.readFileSync(path.join(dir, 'README.md'), 'utf-8');
|
|
const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
|
|
plugins[packageName] = {
|
|
manifest,
|
|
frontend,
|
|
readme,
|
|
};
|
|
}
|
|
|
|
return plugins;
|
|
}
|
|
|
|
fs.writeFileSync('packages/api/src/packagedPluginsContent.js', `module.exports = () => (${JSON.stringify(load())});`);
|