charify 2.0.2 → 2.0.3

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 CrazyBrain Labs
3
+ Copyright (c) 2025 AbdoDev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charify",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "High-quality image to ASCII art CLI",
5
5
  "keywords": [
6
6
  "ascii",
package/src/loadSharp.js CHANGED
@@ -1,7 +1,22 @@
1
1
  import { execSync } from "child_process";
2
+ import readline from "readline";
2
3
 
3
4
  let sharpInstance;
4
5
 
6
+ function askYesNo(question) {
7
+ return new Promise((resolve) => {
8
+ const rl = readline.createInterface({
9
+ input: process.stdin,
10
+ output: process.stdout,
11
+ });
12
+
13
+ rl.question(question, (answer) => {
14
+ rl.close();
15
+ resolve(answer.trim().toLowerCase() === "y");
16
+ });
17
+ });
18
+ }
19
+
5
20
  export async function loadSharp() {
6
21
  if (sharpInstance) return sharpInstance;
7
22
 
@@ -10,9 +25,17 @@ export async function loadSharp() {
10
25
  return sharpInstance;
11
26
  } catch {
12
27
  console.warn(
13
- "[Warning]: 'sharp' package not found. Installing it now, please wait..."
28
+ "[Warning]: 'sharp' package not found. charify might not work without it."
14
29
  );
15
30
 
31
+ const install = await askYesNo(
32
+ "Do you want to install 'sharp' now? (y/n): "
33
+ );
34
+ if (!install) {
35
+ console.log("Skipping 'sharp' installation. Please install it manually.");
36
+ return null;
37
+ }
38
+
16
39
  try {
17
40
  execSync("npm install sharp", { stdio: "inherit" });
18
41
  sharpInstance = (await import("sharp")).default;