Skip to content

Commit 58d9939

Browse files
alexmaingot-sfRobbieTheWagner
authored andcommitted
Fix namespaced bug with nav items generated (ember-learn#379)
1 parent 245a69a commit 58d9939

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/broccoli/docs-compiler/navigation-index-generator.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ module.exports = class NavigationIndexGenerator {
5252
return resolvedType || 'modules';
5353
}
5454

55-
_resolvedTypeForModule(module) {
56-
let [ , type ] = module.file.split('/');
55+
_resolvedTypeForModule(module) {
56+
let path = module.file.split('/');
5757

58-
return RESOLVED_TYPES.includes(type) && type;
58+
// By default we assume that the type is at index 1
59+
let type = path[1];
60+
61+
// If the module is a scoped package, then the type will be at index 2
62+
if (path[0].charAt(0) === '@') {
63+
type = path[2];
5964
}
6065

66+
return RESOLVED_TYPES.includes(type) && type;
67+
}
68+
6169
_isResolvedType(module) {
6270
return this._resolvedTypeForModule(module);
6371
}

0 commit comments

Comments
 (0)