Skip to content

Commit

Permalink
fix: resolve @scope/package namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Mar 30, 2020
1 parent 0936065 commit 90831ff
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion addon/resolvers/classic/index.js
Expand Up @@ -44,7 +44,27 @@ function parseName(fullName) {
let prefix, type, name;
let fullNameParts = fullName.split('@');

if (fullNameParts.length === 2) {
if (fullNameParts.length === 3) {
if (fullNameParts[0].length === 0) {
// leading scoped namespace: `@scope/pkg@type:name`
prefix = `@${fullNameParts[1]}`;
let prefixParts = fullNameParts[2].split(':');
type = prefixParts[0];
name = prefixParts[1];
} else {
// interweaved scoped namespace: `type:@scope/pkg@name`
console.log(fullNameParts)

prefix = `@${fullNameParts[1]}`;
type = fullNameParts[0].slice(0, -1);
name = fullNameParts[2];
}

if (type === 'template:components') {
name = `components/${name}`;
type = 'template';
}
} else if (fullNameParts.length === 2) {
let prefixParts = fullNameParts[0].split(':');

if (prefixParts.length === 2) {
Expand Down

0 comments on commit 90831ff

Please sign in to comment.