├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── cli.js ├── license ├── package.json ├── readme.md └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{package.json,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 'stable' 4 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const logSymbols = require('log-symbols'); 4 | const meow = require('meow'); 5 | const bowerName = require('bower-name'); 6 | 7 | const cli = meow(` 8 | Usage 9 | $ bower-name 10 | 11 | Examples 12 | $ bower-name multiline 13 | ${logSymbols.error} Unavailable 14 | $ bower-name unicorn-cake 15 | ${logSymbols.success} Available 16 | 17 | Exits with code 0 when the name is available or 2 when taken 18 | `); 19 | 20 | if (cli.input.length === 0) { 21 | console.error('Package name required'); 22 | process.exit(1); 23 | } 24 | 25 | bowerName(cli.input[0]).then(available => { 26 | console.log(available ? `${logSymbols.success} Available` : `${logSymbols.error} Unavailable`); 27 | process.exit(available ? 0 : 2); 28 | }); 29 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bower-name-cli", 3 | "version": "2.0.0", 4 | "description": "Check whether a package name is available on bower", 5 | "license": "MIT", 6 | "repository": "sindresorhus/bower-name-cli", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "bin": { 13 | "bower-name": "cli.js" 14 | }, 15 | "engines": { 16 | "node": ">=4" 17 | }, 18 | "scripts": { 19 | "test": "xo && ava" 20 | }, 21 | "files": [ 22 | "cli.js" 23 | ], 24 | "keywords": [ 25 | "cli-app", 26 | "cli", 27 | "app", 28 | "bower", 29 | "package", 30 | "name", 31 | "check", 32 | "available", 33 | "taken" 34 | ], 35 | "dependencies": { 36 | "bower-name": "^2.0.0", 37 | "log-symbols": "^1.0.2", 38 | "meow": "^3.4.2" 39 | }, 40 | "devDependencies": { 41 | "ava": "*", 42 | "pify": "^2.2.0", 43 | "xo": "*" 44 | }, 45 | "xo": { 46 | "esnext": true 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Deprecated 2 | 3 | Deprecated as Bower is practically unmaintained. Check out [`npm-name-cli`](https://github.com/sindresorhus/npm-name-cli) instead. 4 | 5 | --- 6 | 7 | # bower-name-cli [![Build Status](https://travis-ci.org/sindresorhus/bower-name-cli.svg?branch=master)](https://travis-ci.org/sindresorhus/bower-name-cli) 8 | 9 | > Check whether a package name is available on bower 10 | 11 | 12 | ## Install 13 | 14 | ``` 15 | $ npm install --global bower-name-cli 16 | ``` 17 | 18 | 19 | ## Usage 20 | 21 | ``` 22 | $ bower-name --help 23 | 24 | Usage 25 | $ bower-name 26 | 27 | Examples 28 | $ bower-name multiline 29 | ✖ Unavailable 30 | $ bower-name unicorn-cake 31 | ✔ Available 32 | 33 | Exits with code 0 when the name is available or 2 when taken 34 | ``` 35 | 36 | 37 | ## Related 38 | 39 | - [bower-name](https://github.com/sindresorhus/bower-name) - API for this module 40 | 41 | 42 | ## License 43 | 44 | MIT © [Sindre Sorhus](http://sindresorhus.com) 45 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import childProcess from 'child_process'; 2 | import test from 'ava'; 3 | import pify from 'pify'; 4 | import logSymbols from 'log-symbols'; 5 | 6 | test(async t => { 7 | const stdout = await pify(childProcess.execFile)('./cli.js', ['unicorn-rainbow-2524342', '--color'], {cwd: __dirname}); 8 | t.is(stdout.trim(), `${logSymbols.success} Available`); 9 | }); 10 | --------------------------------------------------------------------------------