mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 06:03:34 +01:00
18 lines
765 B
TypeScript
18 lines
765 B
TypeScript
|
import {PackageData} from "ep_etherpad-lite/node/types/PackageInfo";
|
||
|
import {writeFileSync} from "fs";
|
||
|
import {installedPluginsPath} from "ep_etherpad-lite/static/js/pluginfw/installer";
|
||
|
const pluginsModule = require('ep_etherpad-lite/static/js/pluginfw/plugins');
|
||
|
|
||
|
export const persistInstalledPlugins = async () => {
|
||
|
const plugins:PackageData[] = []
|
||
|
const installedPlugins = {plugins: plugins};
|
||
|
for (const pkg of Object.values(await pluginsModule.getPackages()) as PackageData[]) {
|
||
|
installedPlugins.plugins.push({
|
||
|
name: pkg.name,
|
||
|
version: pkg.version,
|
||
|
});
|
||
|
}
|
||
|
installedPlugins.plugins = [...new Set(installedPlugins.plugins)];
|
||
|
writeFileSync(installedPluginsPath, JSON.stringify(installedPlugins));
|
||
|
};
|