├── .npmrc ├── .eslintignore ├── .prettierrc.json ├── .gitignore ├── .prettierignore ├── bin └── index.js ├── .vscode ├── extensions.json └── settings.json ├── tsconfig.esm.json ├── tsconfig.json ├── jest.config.ts ├── .github └── workflows │ ├── test.yml │ └── release.yml ├── .eslintrc.json ├── tests └── index.test.ts ├── src ├── cli.ts └── index.ts ├── LICENSE ├── package.json └── README.md /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | dist/ -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .env 4 | .DS_Store 5 | dist/ 6 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | dist/ 4 | package-lock.json -------------------------------------------------------------------------------- /bin/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const { cli } = require('../dist/cli.js'); 3 | cli(process.argv); 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // もし上記2つの拡張がインストールされていない場合、インストールの推奨を表示します 3 | "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] 4 | } 5 | -------------------------------------------------------------------------------- /tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ".", 3 | "compilerOptions": { 4 | "module": "ESNext", 5 | "outDir": "dist/esm", 6 | "declaration": true, 7 | "declarationMap": true 8 | }, 9 | "include": ["src"], 10 | "exclude": ["src/bin", "node_modules", "dist"] 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "CommonJS", 5 | "moduleResolution": "Node", 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "lib": ["ESNext"], 9 | "types": ["node", "jest"], 10 | "outDir": "dist" 11 | }, 12 | "include": ["src"] 13 | } 14 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | // 型定義のインポート 2 | import { Config } from '@jest/types'; 3 | 4 | // オプションを設定 5 | const config: Config.InitialOptions = { 6 | preset: 'ts-jest', 7 | testMatch: ['/tests/**/*.test.ts'], 8 | testEnvironment: 'node', 9 | collectCoverage: true, 10 | errorOnDeprecated: true, 11 | }; 12 | 13 | // 設定を default エクスポートします 14 | export default config; 15 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | # Triggers when pushed to master branch 4 | on: 5 | push: 6 | branches: 7 | - master 8 | pull_request: 9 | workflow_dispatch: 10 | 11 | jobs: 12 | test: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: checkout 16 | uses: actions/checkout@v3 17 | - name: setup-node 18 | uses: actions/setup-node@v3 19 | with: 20 | node-version: 16 21 | cache: 'npm' 22 | - run: npm ci 23 | - run: npm run lint 24 | - run: npm run test 25 | - run: npm run build 26 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // 保存時に eslint によるリントを行います 3 | "editor.codeActionsOnSave": { 4 | "source.fixAll": "explicit" 5 | }, 6 | // デフォルトのフォーマッターを prettier にします 7 | "editor.defaultFormatter": "esbenp.prettier-vscode", 8 | // 保存時に prettier によって整形します 9 | "editor.formatOnSave": true, 10 | // タブ幅を 2 とします 11 | "editor.tabSize": 2, 12 | // タブにはスペースを使います 13 | "editor.insertSpaces": true, 14 | // 改行コードは LF とします 15 | "files.eol": "\n", 16 | // ファイル末尾には自動的に空行を挿入します 17 | "files.insertFinalNewline": true, 18 | // 拡張機能のインストール推奨を非表示にできないようにします 19 | "extensions.ignoreRecommendations": false 20 | } 21 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | // 適用する環境 3 | "env": { 4 | "es6": true, 5 | "node": true, 6 | "commonjs": true 7 | }, 8 | // 構文解析(パーサー) 9 | "parser": "@typescript-eslint/parser", 10 | "parserOptions": { 11 | // モジュール形式のソースコードを用います 12 | "sourceType": "module", 13 | // JS のバージョンは最新とします 14 | "ecmaVersion": "latest" 15 | }, 16 | // プラグイン 17 | "plugins": ["@typescript-eslint"], 18 | /** 19 | * ルールのインポート 20 | * ここでは基本的に 'recommended' に従います 21 | */ 22 | "extends": [ 23 | "eslint:recommended", 24 | "plugin:@typescript-eslint/eslint-recommended", 25 | "plugin:@typescript-eslint/recommended", 26 | "prettier" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /tests/index.test.ts: -------------------------------------------------------------------------------- 1 | // 名前付きでインポートします 2 | import { genbaneko } from '../src'; 3 | 4 | describe('genbaneko() のテスト', () => { 5 | it('ヨシのAAを出力', () => { 6 | // コンソールのログ出力を監視し、その文字列を返します 7 | const log = jest.spyOn(console, 'log').mockReturnValue(); 8 | 9 | // hello メソッドの実行 10 | genbaneko(); 11 | 12 | // 1番目のログ出力が 'Hello.' と一致するかチェック 13 | expect(log).toHaveBeenNthCalledWith( 14 | 1, 15 | '          ∧  /ヽ\n         // ̄ ̄\|\n         ∠__╋__〉\n        /  ①八① \\n        工ニ f(_人_) エ |′\n        \ ヽノ ノ ヘ \n      ⊂⌒)_>―――イ (_) /\n       `ー、_ノ/ ̄ヽ |/\n         _||  | |\n        (  人_ノ Λ\n         \ス ̄ ̄レ-Λ \\n        ( ̄ ) / / \ノ\\n          ̄ ̄ ( ヽ  \_)\n            \ノ' 16 | ); 17 | 18 | // 'jest.spyOn()' によって作成されたモックをリセットします 19 | log.mockRestore(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/cli.ts: -------------------------------------------------------------------------------- 1 | import { Command } from 'commander'; 2 | import { mGenbaneko } from '.'; 3 | 4 | const CLI_VERSION = '0.0.0'; 5 | 6 | /** 7 | * Run the command line interface program. 8 | * @param argv process.argv. 9 | */ 10 | export const cli = (argv: string[]) => { 11 | if (process.argv.length === 2) { 12 | mGenbaneko.normal(); 13 | return; 14 | } 15 | const program = new Command(); 16 | 17 | program 18 | .name('genbaneko') 19 | .description(`Let's display "Yoshi!" on the console.`) 20 | .version(CLI_VERSION); 21 | 22 | program 23 | .command('say') 24 | .description('say something') 25 | .argument('[string]', 'serif') 26 | .action((serif) => { 27 | mGenbaneko.say(serif); 28 | }); 29 | 30 | program 31 | .command('think') 32 | .description('think something') 33 | .argument('[string]', 'thought') 34 | .action((thought) => { 35 | mGenbaneko.think(thought); 36 | }); 37 | 38 | program.parse(argv); 39 | }; 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 moons14 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, 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: CICD 2 | 3 | # Triggers when pushed to master branch 4 | on: 5 | push: 6 | branches: 7 | - master 8 | tags: 9 | - '!*' 10 | 11 | jobs: 12 | release: 13 | name: release-npm-package 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: checkout 17 | uses: actions/checkout@v2 18 | - name: setup-node 19 | uses: actions/setup-node@v2 20 | with: 21 | node-version: 14.x 22 | registry-url: 'https://registry.npmjs.org' 23 | 24 | # Get current package version 25 | - name: current-package-version 26 | run: node -p -e '`CURRENT_PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV 27 | 28 | # Create tag with current package version 29 | - name: current-package-version-to-git-tag 30 | uses: pkgdeps/git-tag-action@v2 31 | with: 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | github_repo: ${{ github.repository }} 34 | git_commit_sha: ${{ github.sha }} 35 | git_tag_prefix: '' 36 | version: ${{ env.CURRENT_PACKAGE_VERSION }} 37 | 38 | # Publish to npm 39 | - name: publish-to-npm 40 | run: npm publish 41 | env: 42 | NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} 43 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { say, think } from 'cowsayjs/lib/box'; 2 | export const genbaneko = () => { 3 | console.log( 4 | '          ∧  /ヽ\n         // ̄ ̄\|\n         ∠__╋__〉\n        /  ①八① \\n        工ニ f(_人_) エ |′\n        \ ヽノ ノ ヘ \n      ⊂⌒)_>―――イ (_) /\n       `ー、_ノ/ ̄ヽ |/\n         _||  | |\n        (  人_ノ Λ\n         \ス ̄ ̄レ-Λ \\n        ( ̄ ) / / \ノ\\n          ̄ ̄ ( ヽ  \_)\n            \ノ' 5 | ); 6 | }; 7 | 8 | class mGenbaneko_class { 9 | _genbaneko(action: string = '〇' || '\' || ' ') { 10 | return ( 11 | '  ' + 12 | action + 13 | '       ∧  /ヽ\n   ' + 14 | action + 15 | '     // ̄ ̄\|\n    ' + 16 | action + 17 | '    ∠__╋__〉\n     ' + 18 | action + 19 | '  /  ①八① \\n        工ニ f(_人_) エ |′\n        \ ヽノ ノ ヘ \n      ⊂⌒)_>―――イ (_) /\n       `ー、_ノ/ ̄ヽ |/\n         _||  | |\n        (  人_ノ Λ\n         \ス ̄ ̄レ-Λ \\n        ( ̄ ) / / \ノ\\n          ̄ ̄ ( ヽ  \_)\n            \ノ' 20 | ); 21 | } 22 | think(message: string) { 23 | console.log(think(message ? message : 'Yoshi!!') + this._genbaneko('〇')); 24 | } 25 | say(message: string) { 26 | console.log(say(message ? message : 'Yoshi!!') + this._genbaneko('\')); 27 | this._genbaneko(); 28 | } 29 | normal() { 30 | console.log(this._genbaneko(' ')); 31 | } 32 | } 33 | 34 | export const mGenbaneko = new mGenbaneko_class(); 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "genbaneko", 3 | "version": "2.1.3", 4 | "description": "On-site cat on the console!", 5 | "main": "dist/index.js", 6 | "module": "dist/esm/index.js", 7 | "types": "dist/esm/index.d.ts", 8 | "scripts": { 9 | "lint": "run-s lint:*", 10 | "lint:eslint": "eslint . --ext .ts,.tsx --fix", 11 | "lint:prettier": "prettier --write .", 12 | "prebuild": "rimraf dist", 13 | "build": "run-p build:*", 14 | "build:common": "tsc", 15 | "build:esm": "tsc -p tsconfig.esm.json", 16 | "test": "jest", 17 | "ts-esm": "node --loader ts-node/esm" 18 | }, 19 | "license": "MIT License", 20 | "devDependencies": { 21 | "@jest/types": "^28.1.3", 22 | "@types/jest": "^28.1.6", 23 | "@types/node": "^18.6.4", 24 | "@typescript-eslint/eslint-plugin": "^5.32.0", 25 | "@typescript-eslint/parser": "^5.32.0", 26 | "eslint": "^8.21.0", 27 | "eslint-config-prettier": "^8.5.0", 28 | "jest": "^28.1.3", 29 | "npm-run-all": "^4.1.5", 30 | "prettier": "^2.7.1", 31 | "rimraf": "^3.0.2", 32 | "simple-git-hooks": "^2.8.0", 33 | "ts-jest": "^28.0.7", 34 | "ts-node": "^10.9.1", 35 | "typescript": "^4.7.4" 36 | }, 37 | "files": [ 38 | "dist" 39 | ], 40 | "bin": { 41 | "genbaneko": "bin/index.js" 42 | }, 43 | "engines": { 44 | "node": ">=14" 45 | }, 46 | "keywords": [ 47 | "genbaneko", 48 | "cat", 49 | "console", 50 | "yoshi", 51 | "good", 52 | "joke" 53 | ], 54 | "homepage": "https://www.npmjs.com/package/genbaneko", 55 | "bugs": "https://github.com/moons-14/genbaneko/issues", 56 | "repository": "github:moons-14/genbaneko", 57 | "author": { 58 | "name": "moons14", 59 | "email": "moons@moons14.com", 60 | "url": "https://github.com/moons-14" 61 | }, 62 | "dependencies": { 63 | "commander": "^9.4.0", 64 | "cowsayjs": "^1.0.7" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CICD](https://github.com/moons-14/genbaneko/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/moons-14/genbaneko/actions/workflows/release.yml) 2 | [![npm version](https://badge.fury.io/js/genbaneko.svg)](https://badge.fury.io/js/genbaneko) 3 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) 4 | 5 | # Genbaneko 6 | 7 | Let's display "Yoshi!" on the console. 8 | When the code just won't work, when debugging is too tedious, this makes everything better! (It won't). 9 | 10 | \*Do not use it in a serious place. 11 | This "Yoshi!" may be a flag that something bad is about to happen! 12 | 13 | ``` 14 |           ∧  /ヽ 15 |          // ̄ ̄\| 16 |          ∠__╋__〉 17 |         /  ①八① \ 18 |         工ニ f(_人_) エ |′ 19 |         \ ヽノ ノ ヘ 20 |       ⊂⌒)_>―――イ (_) / 21 |        `ー、_ノ/ ̄ヽ |/ 22 |          _||  | | 23 |         (  人_ノ Λ 24 |          \ス ̄ ̄レ-Λ \ 25 |         ( ̄ ) / / \ノ\ 26 |           ̄ ̄ ( ヽ  \_) 27 |             \ノ 28 | ``` 29 | 30 | ## Prerequisites 31 | 32 | This project requires NodeJS (version 14 or later) and NPM. 33 | [Node](http://nodejs.org/) and [NPM](https://npmjs.org/) are really easy to install. 34 | To make sure you have them available on your machine, 35 | try running the following command. 36 | 37 | ```sh 38 | $ npm -v && node -v 39 | 8.11.0 40 | v16.16.0 41 | ``` 42 | 43 | ## Table of contents 44 | 45 | - [Genbaneko](#Genbaneko) 46 | - [Prerequisites](#prerequisites) 47 | - [Table of contents](#table-of-contents) 48 | - [Getting Started](#getting-started) 49 | - [Installation](#installation) 50 | - [Usage](#usage) 51 | - [Contributing](#contributing) 52 | - [ToDo](#ToDo) 53 | - [Credits](#credits) 54 | - [Authors](#authors) 55 | - [License](#license) 56 | 57 | ## Getting Started 58 | 59 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. 60 | 61 | ## Installation 62 | 63 | **BEFORE YOU INSTALL:** please read the [prerequisites](#prerequisites) 64 | 65 | To install and set up the library, run: 66 | 67 | ```sh 68 | $ npm install genbaneko 69 | ``` 70 | 71 | Or if you prefer using Yarn: 72 | 73 | ```sh 74 | $ yarn add genbaneko 75 | ``` 76 | 77 | ## Usage 78 | 79 | ```javascript 80 | import { genbaneko, mGenbaneko } from 'genbaneko'; 81 | // or 82 | const { genbaneko, mGenbaneko } = require('genbaneko'); 83 | 84 | // Only on-site cats are output 85 | genbaneko(); 86 | mGenbaneko.normal(); 87 | 88 | // Use this when you want your cat to speak or think 89 | mGenbaneko.think('Hello'); 90 | mGenbaneko.say('WTF'); 91 | 92 | // It works without any text arguments. 93 | // In that case, "Yoshi !!" is displayed by default. 94 | mGenbaneko.think(); 95 | mGenbaneko.say(); 96 | ``` 97 | 98 | Take advantage of the command line 99 | ``` 100 | $ genbaneko help # or, -h, --help 101 | Usage: genbaneko [options] [command] 102 | 103 | Let's display "Yoshi!" on the console. 104 | 105 | Options: 106 | -V, --version output the version number 107 | -h, --help display help for command 108 | 109 | Commands: 110 | say [string] say something 111 | think [string] think something 112 | help [command] display help for command 113 | 114 | ``` 115 | 116 | "Yoshi !!" is a Japanese word for "challenging during confirmation work". 117 | It is used in Japan as a net meme when bad things happen. 118 | If the code for your project doesn't work, write a comment saying "なんだか知らんがとにかくよし! " 119 | 120 | That's all there is to it. 121 | Pull requests to add other kinds of "genbaneko" are welcome! 122 | See [ToDo](#ToDo) for features we would like to add. 123 | 124 | ## Contributing 125 | 126 | 1. Fork it! 127 | 2. Create your feature branch: `git checkout -b my-new-feature` 128 | 3. Add your changes: `git add .` 129 | 4. Commit your changes: `git commit -am 'Add some feature'` 130 | 5. Push to the branch: `git push origin my-new-feature` 131 | 6. Submit a pull request :sunglasses: 132 | 133 | ## ToDo 134 | 135 | - Addition of "doushite" 136 | - Make the character speak 137 | - Colorful cats 138 | 139 | ## Contact us 140 | 141 | - Twitter:[moons_sub](https://twitter.com/moons_sub) 142 | 143 | - Discord:moons#7204 144 | 145 | ## Credits 146 | 147 | I wrote README.md with reference to [this](https://gist.github.com/andreasonny83/7670f4b39fe237d52636df3dec49cf3a#building-a-distribution-version) 148 | 149 | ## Authors 150 | 151 | **moons14** - [moons-14](https://github.com/moons-14) 152 | 153 | ## License 154 | 155 | [MIT License](https://andreasonny.mit-license.org/2022) © 2022 moons14 156 | --------------------------------------------------------------------------------