diff options
author | Gar <gar+gh@danger.computer> | 2022-07-28 00:04:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-28 00:04:53 +0300 |
commit | 0e3660eb39bd12a25517d745701bf841811b4623 (patch) | |
tree | 39d2de07a468e4a7a9771bc50ae29a605862f01f /lib | |
parent | 77bf2e10236b72613101ac21d151f5974240f3aa (diff) |
fix(init): allow for spec on scope-only arg (#5206)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/commands/init.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/commands/init.js b/lib/commands/init.js index b8b6bd5d5..cff8340dc 100644 --- a/lib/commands/init.js +++ b/lib/commands/init.js @@ -85,8 +85,13 @@ class Init extends BaseCommand { const [initerName, ...otherArgs] = args let packageName = initerName + // Only a scope, possibly with a version if (/^@[^/]+$/.test(initerName)) { - packageName = initerName + '/create' + const [, scope, version] = initerName.split('@') + packageName = `@${scope}/create` + if (version) { + packageName = `${packageName}@${version}` + } } else { const req = npa(initerName) if (req.type === 'git' && req.hosted) { |