From 070d05cf9f8a2f894d029ae2011f6ec2dcf7de64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro?= Date: Sun, 22 Apr 2018 13:52:33 +0200 Subject: [PATCH] Support for scoped templates Add support for templates published as scoped packages. Partially fixes #18973. --- local-cli/generator/templates.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/local-cli/generator/templates.js b/local-cli/generator/templates.js index 99e63ec2e99c1c..4639731982b6ab 100644 --- a/local-cli/generator/templates.js +++ b/local-cli/generator/templates.js @@ -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; }