nekos 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ # GitHub
2
+ .github/
3
+ archives/
4
+ img/
5
+
6
+ # Dependencies
7
+ node_modules/
8
+
9
+ # Dev
10
+ scripts/
11
+ test/
12
+
13
+ # No Format
14
+ aa/
15
+ dist/
16
+ private/
17
+ .gitignore
18
+ .npmignore
19
+ *.json
20
+ *.md
21
+
22
+ # Config
23
+ tsconfig.json
24
+ .env
@@ -0,0 +1,3 @@
1
+ {
2
+ "tabWidth": 2
3
+ }
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/nekos.svg)](https://badge.fury.io/js/nekos)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
6
  [![Validate AA Contribution](https://github.com/otoneko1102/nekos/actions/workflows/validate-aa.yml/badge.svg)](https://github.com/otoneko110/nekos/actions/workflows/validate-aa.yml)
6
7
 
7
8
  A simple CLI tool to display cat ASCII art in your console.
@@ -41,7 +42,7 @@ nekos({ colors: ["#ff00ff", "#00ffff"] });
41
42
  nekos({ id: "sad_cat", colors: ["RANDOM", "RANDOM"] });
42
43
  ```
43
44
 
44
- [ESM Example - demo.js](test/demo.js)
45
+ [ESM Example - demo.js](test/demo.js)
45
46
  [CJS Example - demo.cjs](test/demo.cjs)
46
47
 
47
48
  ---
@@ -147,7 +148,7 @@ nekos({ colors: ["#ff00ff", "#00ffff"] });
147
148
  nekos({ id: "sad_cat", colors: ["RANDOM", "RANDOM"] });
148
149
  ```
149
150
 
150
- [ESM Example - demo.js](test/demo.js)
151
+ [ESM Example - demo.js](test/demo.js)
151
152
  [CJS Example - demo.cjs](test/demo.cjs)
152
153
 
153
154
  ---
package/bin/nekos.js CHANGED
@@ -2,15 +2,32 @@
2
2
 
3
3
  import { program } from "commander";
4
4
  import nekos from "../dist/index.js";
5
+ import { consola } from "consola";
6
+ import { isPackageLatest } from "is-package-latest";
7
+ import pkg from "../package.json" with { type: "json" };
8
+
9
+ async function versionInfo(p) {
10
+ const res = await isPackageLatest(p);
11
+ if (!res.isLatest)
12
+ consola.warn(
13
+ `New version released! =^・w・^=\n\n${res.currentVersion} --> ${res.latestVersion}\n\nnpm install -g ${res.name}@latest`,
14
+ );
15
+ return p.version;
16
+ }
5
17
 
6
18
  program
19
+ .version(
20
+ await versionInfo(pkg),
21
+ "-v, --version",
22
+ "Check the current version.",
23
+ )
7
24
  .option(
8
25
  "-i, --id <id>",
9
- "Display a specific cat by its ID (filename without .txt)"
26
+ "Display a specific cat by its ID (filename without .txt)",
10
27
  )
11
28
  .option(
12
29
  "-c, --colors [colors...]",
13
- 'Specify colors (e.g., RANDOM, RAINBOW, #ff00ff, "#ff0000 #00ff00")'
30
+ 'Specify colors (e.g., RANDOM, RAINBOW, #ff00ff, "#ff0000 #00ff00")',
14
31
  );
15
32
 
16
33
  program.parse(process.argv);
@@ -24,7 +41,7 @@ if (options.id) {
24
41
 
25
42
  if (options.colors) {
26
43
  const finalColors = options.colors.flatMap((colorString) =>
27
- colorString.split(" ")
44
+ colorString.split(" "),
28
45
  );
29
46
 
30
47
  if (finalColors.length === 1) {
package/dist/index.cjs CHANGED
@@ -34,6 +34,7 @@ __export(cjs_entry_exports, {
34
34
  module.exports = __toCommonJS(cjs_entry_exports);
35
35
  var import_fs = __toESM(require("fs"));
36
36
  var import_path = __toESM(require("path"));
37
+ var import_consola = require("consola");
37
38
  var import_color = require("@randplus/color");
38
39
  var import_gradient_string = __toESM(require("gradient-string"));
39
40
  var aaDir = import_path.default.join(__dirname, "../aa");
@@ -80,8 +81,11 @@ function nekos(options = {}) {
80
81
  processedColors = [colors];
81
82
  }
82
83
  } else if (Array.isArray(colors)) {
84
+ if (colors.includes("RAINBOW")) {
85
+ import_consola.consola.warn("Cannot use the value, 'RAINBOW' in array.");
86
+ }
83
87
  processedColors = colors.map(
84
- (color) => typeof color === "string" && color.toUpperCase() === "RANDOM" ? (0, import_color.hex)("#") : color
88
+ (color2) => typeof color2 === "string" && color2.toUpperCase() === "RANDOM" ? (0, import_color.hex)("#") : color2
85
89
  );
86
90
  } else {
87
91
  processedColors = colors;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- type ColorKeyword = "RANDOM" | "RAINBOW";
1
+ type SingleColorKeyword = "RAINBOW";
2
+ type ColorKeyword = "RANDOM";
2
3
  type HexColor = `#${string}`;
3
4
  type ColorValue = ColorKeyword | HexColor;
4
5
  interface NekosOptions {
5
6
  id?: string;
6
- colors?: ColorValue | ColorValue[];
7
+ colors?: SingleColorKeyword | ColorValue | ColorValue[];
7
8
  }
8
9
  /**
9
10
  * Logs a cat ASCII art to the console.
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { fileURLToPath } from "url";
5
+ import { consola } from "consola";
5
6
  import { hex } from "@randplus/color";
6
7
  import gradient from "gradient-string";
7
8
  var __filename = fileURLToPath(import.meta.url);
@@ -50,8 +51,11 @@ function nekos(options = {}) {
50
51
  processedColors = [colors];
51
52
  }
52
53
  } else if (Array.isArray(colors)) {
54
+ if (colors.includes("RAINBOW")) {
55
+ consola.warn("Cannot use the value, 'RAINBOW' in array.");
56
+ }
53
57
  processedColors = colors.map(
54
- (color) => typeof color === "string" && color.toUpperCase() === "RANDOM" ? hex("#") : color
58
+ (color2) => typeof color2 === "string" && color2.toUpperCase() === "RANDOM" ? hex("#") : color2
55
59
  );
56
60
  } else {
57
61
  processedColors = colors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nekos",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Let's have cute cats mess around in the log!",
5
5
  "bin": {
6
6
  "nekos": "bin/nekos.js"
@@ -16,9 +16,11 @@
16
16
  "scripts": {
17
17
  "test": "cross-env FORCE_COLOR=1 node --experimental-vm-modules node_modules/jest/bin/jest.js",
18
18
  "clean": "rimraf dist",
19
+ "format": "prettier --write .",
20
+ "format:check": "prettier --check .",
19
21
  "build:types": "tsc",
20
22
  "build:js": "node scripts/build.js",
21
- "build": "npm run clean && npm run build:types && npm run build:js"
23
+ "build": "npm run clean && npm run format && npm run build:types && npm run build:js"
22
24
  },
23
25
  "repository": {
24
26
  "type": "git",
@@ -42,13 +44,16 @@
42
44
  "dependencies": {
43
45
  "@randplus/color": "^3.0.0",
44
46
  "commander": "^14.0.0",
45
- "gradient-string": "^3.0.0"
47
+ "consola": "^3.4.2",
48
+ "gradient-string": "^3.0.0",
49
+ "is-package-latest": "^1.0.0"
46
50
  },
47
51
  "devDependencies": {
48
52
  "@types/node": "^24.3.0",
49
53
  "cross-env": "^10.0.0",
50
54
  "esbuild": "^0.25.9",
51
55
  "jest": "^30.1.1",
56
+ "prettier": "3.6.2",
52
57
  "rimraf": "^6.0.1",
53
58
  "typescript": "^5.9.2"
54
59
  }