Skip to content

Commit

Permalink
Merge branch 'release/0.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
msudgh committed Jan 5, 2025
2 parents bbbc19d + af3c8dc commit d71a699
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ovm",
"description": "Obsidian Vaults Manager",
"type": "commonjs",
"version": "0.6.3",
"version": "0.6.4",
"license": "GPL-3.0-only",
"author": "Masoud Ghorbani",
"homepage": "https://github.com/msudgh/ovm",
Expand Down
13 changes: 8 additions & 5 deletions src/providers/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const removePluginDir = async (pluginId: string, vaultPath: string) => {
childLogger.debug(`Remove plugin`)

await rm(pluginDir, { recursive: true, force: true })
await modifyCommunityPlugins({ id: pluginId }, vaultPath, 'disable')

childLogger.debug(`Removed plugin`)
}
Expand All @@ -30,11 +29,15 @@ export const listInstalledPlugins = async (vaultPath: string) => {

await access(pluginsPath, constants.R_OK)

const existingDirs = await readdir(pluginsPath)
const entries = await readdir(pluginsPath, {
withFileTypes: true,
})

installedPlugins = existingDirs.map((plugin) => ({
id: plugin,
}))
installedPlugins = entries
.filter(({ isDirectory }) => isDirectory())
.map((dir) => ({
id: dir.name,
}))

return installedPlugins
}
Expand Down
7 changes: 6 additions & 1 deletion src/services/prune.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ArgInput } from '@oclif/core/lib/parser'
import { each } from 'async'
import { listInstalledPlugins, removePluginDir } from '../providers/plugins'
import {
listInstalledPlugins,
modifyCommunityPlugins,
removePluginDir,
} from '../providers/plugins'
import { getSelectedVaults, mapVaultsIteratorItem } from '../providers/vaults'
import {
FactoryFlagsWithVaults,
Expand Down Expand Up @@ -28,6 +32,7 @@ const pruneVaultIterator: PruneCommandIterator = async (item) => {

for (const plugin of toBePruned) {
await removePluginDir(plugin.id, vault.path)
await modifyCommunityPlugins({ id: plugin.id }, vault.path, 'disable')
}

childLogger.info(`Pruned ${toBePruned.length} plugins`, {
Expand Down

0 comments on commit d71a699

Please sign in to comment.