From 5d902aa5f3675b2627aac3f931ca49ccb8511479 Mon Sep 17 00:00:00 2001 From: Eduard Predescu Date: Sun, 13 Aug 2023 19:12:11 +0300 Subject: [PATCH] fix: adjust tree file path if it's a plugin (fix #276) (#570) --- packages/histoire/src/node/tree.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/histoire/src/node/tree.ts b/packages/histoire/src/node/tree.ts index 8e850024..22a7d7f0 100644 --- a/packages/histoire/src/node/tree.ts +++ b/packages/histoire/src/node/tree.ts @@ -14,6 +14,14 @@ export function createPath (config: HistoireConfig, file: ServerTreeFile) { if (config.tree.file === 'path') { const paths = file.path.split('/').slice(0, -1) + + // check if tree file path is a plugin + const index = paths.findIndex(p => p.includes('.histoire')) + + if (index !== -1) { + return ['plugins', file.title] + } + return [...paths, file.title] }