Skip to content

Commit

Permalink
Support for scoped templates
Browse files Browse the repository at this point in the history
Add support for templates published as scoped packages. Partially fixes facebook#18973.
  • Loading branch information
piranna authored Apr 22, 2018
1 parent 5c8596d commit 070d05c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local-cli/generator/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ function createFromRemoteTemplate(template, destPath, newProjectName, yarnVersio
templateName = template.substr(template.lastIndexOf('/') + 1);
} else {
// e.g 'demo'
installPackage = 'react-native-template-' + template;
let scope = ''
if(template[0] === '@' && template.length > 3 && template.includes('/', 2)) {
[scope, ...template] = template.split('/')
scope += '/'
template = template.join('/')
}
installPackage = `${scope}react-native-template-${template}`;
templateName = installPackage;
}

Expand Down

0 comments on commit 070d05c

Please sign in to comment.