Delete Plugin - Hertox82/lt-pm GitHub Wiki
Delete Plugin from Repo
this is an example to delete a plugin from repo
import * as path from 'path';
import {PackageManager, Plugin} from 'lt-pm';
const cwd = path.resolve(__dirname+'/../test/plugins'); // <- Folder to take the Plugins Source
const compr = path.resolve(__dirname+'/../test/compressed'); // <- Folder to put Compressed plugin
const depl = path.resolve(__dirname+'/../test/toDeploy'); // <- Folder to Decompress Plugin
const pm = new PackageManager(compr,cwd,depl);
//this info passed by third party
const listOfInstalled =[
new Plugin('namePlugin','vendor1','1.0.0'),
new Plugin('namePlugin2','vendor1','1.2.0');
];
// Passing to PackageManager the list of Installed Plugin
pm.setListPluginInstalled(listOfInstalled);
// Get the list of avaiable Plugin into the Repo
let listPluginRepo = pm.getLatestPluginRepo();
let randomIndex = Math.floor(Math.random() * listPluginRepo.length);
pm.deletePlugin(listPluginRepo[randomIndex]);
listPluginRepo = pm.getLatestPluginRepo();