├── .travis.yml ├── .editorconfig ├── package.json ├── license ├── .gitignore ├── readme.md └── cli.js /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 'stable' 4 | sudo: false 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "canibekikked", 3 | "version": "1.5.1", 4 | "description": "Tool to check if any of your NPM repository name is trademarked", 5 | "repository": "parro-it/canibekikked", 6 | "license": "MIT", 7 | "author": "parro-it", 8 | "scripts": { 9 | "test": "eslint ." 10 | }, 11 | "bin": { 12 | "canibekikked": "cli.js" 13 | }, 14 | "main": "cli.js", 15 | "keywords": [ 16 | "trademark", 17 | "trademarks", 18 | "check", 19 | "registered" 20 | ], 21 | "engines": { 22 | "node": ">=4" 23 | }, 24 | "eslintConfig": { 25 | "extends": [ 26 | "js", 27 | "features" 28 | ] 29 | }, 30 | "devDependencies": { 31 | "eslint": "^1.10.3", 32 | "eslint-config-features": "^1.1.5", 33 | "eslint-config-js": "^4.0.0" 34 | }, 35 | "files": [ 36 | "cli.js" 37 | ], 38 | "dependencies": { 39 | "canibekikked-api": "^1.1.0", 40 | "chalk": "^1.1.1", 41 | "log-symbols": "^1.0.2", 42 | "meow": "^3.7.0", 43 | "ora": "^0.2.0", 44 | "pify": "^2.3.0", 45 | "update-notifier": "^0.6.3" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 parro-it 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 all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 19 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #### joe made this: https://goel.io/joe 2 | 3 | #####=== SublimeText ===##### 4 | # cache files for sublime text 5 | *.tmlanguage.cache 6 | *.tmPreferences.cache 7 | *.stTheme.cache 8 | 9 | # workspace files are user-specific 10 | *.sublime-workspace 11 | 12 | # project files should be checked into the repository, unless a significant 13 | # proportion of contributors will probably not be using SublimeText 14 | # *.sublime-project 15 | 16 | # sftp configuration file 17 | sftp-config.json 18 | 19 | #####=== Node ===##### 20 | 21 | # Logs 22 | logs 23 | *.log 24 | 25 | # Runtime data 26 | pids 27 | *.pid 28 | *.seed 29 | 30 | # Directory for instrumented libs generated by jscoverage/JSCover 31 | lib-cov 32 | 33 | # Coverage directory used by tools like istanbul 34 | coverage 35 | 36 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 37 | .grunt 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (http://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directory 46 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 47 | node_modules 48 | 49 | # Debug log from npm 50 | npm-debug.log 51 | 52 | #####=== OSX ===##### 53 | .DS_Store 54 | .AppleDouble 55 | .LSOverride 56 | 57 | # Icon must end with two \r 58 | Icon 59 | 60 | # Thumbnails 61 | ._* 62 | 63 | # Files that might appear on external disk 64 | .Spotlight-V100 65 | .Trashes 66 | 67 | # Directories potentially created on remote AFP share 68 | .AppleDB 69 | .AppleDesktop 70 | Network Trash Folder 71 | Temporary Items 72 | .apdisk 73 | 74 | #####=== Linux ===##### 75 | *~ 76 | 77 | # KDE directory preferences 78 | .directory 79 | 80 | # Linux trash folder which might appear on any partition or disk 81 | .Trash-* 82 | 83 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # canibekikked 2 | 3 | Tool to check if any of your NPM repository name is trademarked. 4 | 5 | 6 | > This tool was originally named "canibekiked". 7 | 8 | > I'm not a native speaker, I had no idea what "kike" means in english before reading [this issue](https://github.com/parro-it/canibekikked/issues/2). 9 | 10 | > I intended the word only in the sense "to suffer the same fate as the azer/kik project". 11 | 12 | > I renamed the project, my apologies to anyone who could be offended by this. 13 | 14 | 15 | ![image](https://cloud.githubusercontent.com/assets/11197111/14062535/d72486c8-f3a2-11e5-84d7-9c590cfacfeb.png) 16 | 17 | 18 | [![Travis Build Status](https://img.shields.io/travis/parro-it/canibekikked.svg)](http://travis-ci.org/parro-it/canibekikked) 19 | [![NPM module](https://img.shields.io/npm/v/canibekikked.svg)](https://npmjs.org/package/canibekikked) 20 | [![NPM downloads](https://img.shields.io/npm/dt/canibekikked.svg)](https://npmjs.org/package/canibekikked) 21 | 22 | # Installation 23 | 24 | You need Node 4.0.0 or greater in order to use `canibekikked`. 25 | 26 | ```bash 27 | npm install -g canibekikked 28 | ``` 29 | 30 | # Usage 31 | 32 | Check all repositories of logged user on NPM: 33 | 34 | ```bash 35 | $ canibekikked 36 | ``` 37 | 38 | Check all repositories of a particular user: 39 | 40 | ```bash 41 | $ canibekikked parroit 42 | ``` 43 | 44 | # Your own API token 45 | 46 | Since the API has rate-limit, you can supply your own API token. Sign up to [markerapi](http://www.markerapi.com/) to get one for free. 47 | 48 | ```bash 49 | # replace with your token 50 | $ canibekikked -t yZ32rW4Pq6 51 | ``` 52 | 53 | # Related projects 54 | 55 | * [is-trademarked](https://github.com/egoist/is-trademarked) - Check if a word is trademarked. 56 | 57 | This project is inspired by this [issue on is-trademarked repo](https://github.com/egoist/is-trademarked/issues/3). 58 | 59 | canibekikked API module depends on this project. 60 | 61 | * [canibekikked-api](https://github.com/parro-it/canibekikked-api) - API used by this cli module. 62 | 63 | 64 | # License 65 | 66 | The MIT License (MIT) 67 | 68 | Copyright (c) 2016 parro-it 69 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const ora = require('ora'); 4 | const canibekikked = require('canibekikked-api').default; 5 | const logSymbols = require('log-symbols'); 6 | const meow = require('meow'); 7 | const chalk = require('chalk'); 8 | const updateNotifier = require('update-notifier'); 9 | 10 | const cli = meow(` 11 | Usage: 12 | canibekikked [user] 13 | 14 | * user - NPM username, defaults to currently logged. 15 | * options: 16 | -t/--token Use your own API token 17 | -v/--version Print version 18 | -h/--help Print help 19 | `, { 20 | alias: { 21 | v: 'version', 22 | h: 'help', 23 | t: 'token' 24 | }, 25 | string: ['_'] 26 | }); 27 | 28 | 29 | function fail(err) { 30 | process.stderr.write(`Unexpected error:\n${err.stack}\n`); 31 | } 32 | 33 | function trademarkedLog(p) { 34 | const description = tr => 35 | tr.description.toLowerCase().replace(/\n/g, '\n\t'); 36 | 37 | return `\n${logSymbols.error} ` + 38 | p.trademarks.map(t => 39 | `${chalk.cyan(t.wordmark.trim())} is a trademark registered in ${t.reg.getFullYear()}\n` + 40 | `S/N:\t${t.sn}\n` + 41 | `Service code:\t${t.serviceCode}\n` + 42 | `${chalk.gray(description(t))}\n` 43 | ).join(''); 44 | } 45 | 46 | const resultsLog = (spinner, results) =>{ 47 | results.on('package-checking', pkg => { 48 | spinner.color = 'yellow'; 49 | spinner.text = `Checking ${pkg.name}`; 50 | }); 51 | 52 | results.on('error', fail); 53 | 54 | results.on('package-checked', pkg => { 55 | if (pkg.trademarks) { 56 | spinner.color = 'red'; 57 | spinner.text = `Package ${pkg.name} has a trademarked name!`; 58 | } else { 59 | spinner.color = 'green'; 60 | spinner.text = `Package ${pkg.name} is not trademarked.`; 61 | } 62 | }); 63 | 64 | results.on('end', (passed, failed) => { 65 | spinner.stop(); 66 | process.stdout.write(`${logSymbols.success} ${passed} package names have not been trademarked.\n`); 67 | process.stdout.write(failed.map(trademarkedLog).join('')); 68 | }); 69 | 70 | return results.start(); 71 | }; 72 | 73 | 74 | const spinner = ora('Retrieving packages'); 75 | 76 | const run = () => { 77 | spinner.start(); 78 | 79 | const token = cli.flags.token; 80 | const options = token ? { token } : undefined; 81 | const results = canibekikked(cli.input[0], options); 82 | resultsLog(spinner, results).catch(fail); 83 | }; 84 | 85 | updateNotifier({ 86 | pkg: cli.pkg, 87 | callback: function(err, update) { 88 | if (err) { 89 | return fail(err); 90 | } 91 | if (update.latest !== update.current) { 92 | this.update = update; 93 | this.notify(); 94 | } 95 | 96 | run(); 97 | 98 | } 99 | }); 100 | --------------------------------------------------------------------------------