Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/init-package-json/default-input.js')
-rw-r--r--node_modules/init-package-json/default-input.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/node_modules/init-package-json/default-input.js b/node_modules/init-package-json/default-input.js
index 7ae892229..3af2f62af 100644
--- a/node_modules/init-package-json/default-input.js
+++ b/node_modules/init-package-json/default-input.js
@@ -1,7 +1,8 @@
var fs = require('fs')
var glob = require('glob')
var path = require('path')
-var validateName = require("validate-npm-package-name")
+var validateName = require('validate-npm-package-name')
+var npa = require('npm-package-arg')
// more popular packages should go here, maybe?
function isTestPkg (p) {
@@ -40,10 +41,15 @@ function readDeps (test) { return function (cb) {
}}
var name = package.name || basename
+var spec = npa(name)
var scope = config.get('scope')
if (scope) {
if (scope.charAt(0) !== '@') scope = '@' + scope
- name = scope + '/' + name
+ if (spec.scope) {
+ name = scope + '/' + spec.name.split('/')[1]
+ } else {
+ name = scope + '/' + name
+ }
}
exports.name = yes ? name : prompt('name', name, function (data) {
var its = validateName(data)
@@ -202,7 +208,7 @@ if (!package.author) {
"url" : config.get('init.author.url') ||
config.get('init-author-url')
}
- : prompt('author')
+ : yes ? '' : prompt('author')
}
var license = package.license ||