bower-name
Advanced tools
Comparing version 1.0.3 to 1.0.4
39
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var logSymbols = require('log-symbols'); | ||
var pkg = require('./package.json'); | ||
var meow = require('meow'); | ||
var bowerName = require('./'); | ||
var argv = process.argv.slice(2); | ||
var input = argv[0]; | ||
function help() { | ||
console.log([ | ||
var cli = meow({ | ||
help: [ | ||
'Usage', | ||
' $ bower-name <name>', | ||
'', | ||
' ' + pkg.description, | ||
'Examples', | ||
' $ bower-name multiline', | ||
' ' + logSymbols.error + ' Unavailable', | ||
' $ bower-name unicorn-cake', | ||
' ' + logSymbols.success + ' Available', | ||
'', | ||
' Usage', | ||
' bower-name <name>', | ||
'', | ||
' Exits with code 0 when the name is available or 2 when taken' | ||
].join('\n')); | ||
} | ||
'Exits with code 0 when the name is available or 2 when taken' | ||
] | ||
}); | ||
if (!input || argv.indexOf('--help') !== -1) { | ||
help(); | ||
return; | ||
if (cli.input.length === 0) { | ||
console.error('Package name required'); | ||
process.exit(1); | ||
} | ||
if (argv.indexOf('--version') !== -1) { | ||
console.log(pkg.version); | ||
return; | ||
} | ||
bowerName(input, function (err, available) { | ||
bowerName(cli.input[0], function (err, available) { | ||
if (err) { | ||
console.error(err); | ||
process.exit(1); | ||
return; | ||
} | ||
@@ -37,0 +32,0 @@ |
@@ -6,3 +6,7 @@ 'use strict'; | ||
module.exports = function (name, cb) { | ||
got.head(endpoint + encodeURIComponent(name.toLowerCase()), function (err, data) { | ||
if (!(typeof name === 'string' && name.length !== 0)) { | ||
throw new Error('Package name required'); | ||
} | ||
got.head(endpoint + encodeURIComponent(name.toLowerCase()), function (err) { | ||
if (err && err.code === 404) { | ||
@@ -9,0 +13,0 @@ cb(null, true); |
{ | ||
"name": "bower-name", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Check whether a package name is available on bower", | ||
@@ -26,3 +26,2 @@ "license": "MIT", | ||
"cli", | ||
"bin", | ||
"app", | ||
@@ -37,3 +36,4 @@ "bower", | ||
"got": "^3.2.0", | ||
"log-symbols": "^1.0.0" | ||
"log-symbols": "^1.0.0", | ||
"meow": "^3.3.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
@@ -8,3 +8,3 @@ # bower-name [![Build Status](https://travis-ci.org/sindresorhus/bower-name.svg?branch=master)](https://travis-ci.org/sindresorhus/bower-name) | ||
```sh | ||
``` | ||
$ npm install --save bower-name | ||
@@ -28,3 +28,3 @@ ``` | ||
```sh | ||
``` | ||
$ npm install --global bower-name | ||
@@ -37,4 +37,10 @@ ``` | ||
Usage | ||
bower-name <name> | ||
$ bower-name <name> | ||
Examples | ||
$ bower-name multiline | ||
✖ Unavailable | ||
$ bower-name unicorn-cake | ||
✔ Available | ||
Exits with code 0 when the name is available or 2 when taken | ||
@@ -41,0 +47,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3841
50
3
50
+ Addedmeow@^3.3.0
+ Addedarray-find-index@1.0.2(transitive)
+ Addedcamelcase@2.1.1(transitive)
+ Addedcamelcase-keys@2.1.0(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@1.1.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedindent-string@2.1.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedis-utf8@0.2.1(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedmap-obj@1.0.1(transitive)
+ Addedmeow@3.7.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedread-pkg-up@1.0.1(transitive)
+ Addedredent@1.0.0(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@2.0.0(transitive)
+ Addedstrip-indent@1.0.1(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)