From 571c9d9b6600daf4291696abaaf6b261df765ac0 Mon Sep 17 00:00:00 2001 From: Alex Maingot Date: Wed, 5 Jun 2019 13:17:51 -0500 Subject: [PATCH] Fix namespaced bug with nav items generated --- .../docs-compiler/navigation-index-generator.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/broccoli/docs-compiler/navigation-index-generator.js b/lib/broccoli/docs-compiler/navigation-index-generator.js index a43b49a13..81f6ba711 100644 --- a/lib/broccoli/docs-compiler/navigation-index-generator.js +++ b/lib/broccoli/docs-compiler/navigation-index-generator.js @@ -52,12 +52,20 @@ module.exports = class NavigationIndexGenerator { return resolvedType || 'modules'; } - _resolvedTypeForModule(module) { - let [ , type ] = module.file.split('/'); +_resolvedTypeForModule(module) { + let path = module.file.split('/'); - return RESOLVED_TYPES.includes(type) && type; + // By default we assume that the type is at index 1 + let type = path[1]; + + // If the module is a scoped package, then the type will be at index 2 + if (path[0].charAt(0) === '@') { + type = path[2]; } + return RESOLVED_TYPES.includes(type) && type; +} + _isResolvedType(module) { return this._resolvedTypeForModule(module); }