apexify.js 3.3.0 → 3.3.1
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/README.md +0 -4
- package/lib/index.ts +0 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
Greetings everyone! 🌟 This marks the release of a beta version for our package. If you encounter any issues or need assistance, feel free to reach out. Direct message me on Discord at `jedi.jsx` (ID: 1130583393176920095).
|
|
6
6
|
|
|
7
|
-
# Added new 🆕
|
|
8
|
-
|
|
9
|
-
- Finally Supporting Ts and Js
|
|
10
|
-
|
|
11
7
|
## 🚀 Usage Guidelines
|
|
12
8
|
|
|
13
9
|
### 🤖 Ai Chat & Imagine
|
package/lib/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as child_process from "child_process";
|
|
2
1
|
import axios from "axios";
|
|
3
2
|
import * as path from "path";
|
|
4
3
|
import * as fs from "fs";
|
|
@@ -6,55 +5,6 @@ import * as fs from "fs";
|
|
|
6
5
|
const CYAN: string = "\x1b[36m";
|
|
7
6
|
const RESET: string = "\x1b[0m";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const nodeVersion = process.version;
|
|
12
|
-
|
|
13
|
-
let sharpVersion;
|
|
14
|
-
if (compareVersions(nodeVersion, ">=", "v18.17.0")) {
|
|
15
|
-
sharpVersion = "^0.32.0";
|
|
16
|
-
} else {
|
|
17
|
-
sharpVersion = "^0.30.0";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function compareVersions(version1: string, operator: string, version2: string): boolean {
|
|
21
|
-
const v1 = parseNodeVersion(version1);
|
|
22
|
-
const v2 = parseNodeVersion(version2);
|
|
23
|
-
|
|
24
|
-
switch (operator) {
|
|
25
|
-
case ">":
|
|
26
|
-
return v1 > v2;
|
|
27
|
-
case ">=":
|
|
28
|
-
return v1 >= v2;
|
|
29
|
-
case "<":
|
|
30
|
-
return v1 < v2;
|
|
31
|
-
case "<=":
|
|
32
|
-
return v1 <= v2;
|
|
33
|
-
default:
|
|
34
|
-
throw new Error("Invalid comparison operator");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function parseNodeVersion(version: string): number {
|
|
39
|
-
const parts = version.slice(1).split(".");
|
|
40
|
-
return parseInt(parts[0], 10) * 10000 +
|
|
41
|
-
parseInt(parts[1], 10) * 100 +
|
|
42
|
-
parseInt(parts[2], 10);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let installCommand;
|
|
46
|
-
if (process.env.npm_execpath && process.env.npm_execpath.includes("yarn")) {
|
|
47
|
-
installCommand = `yarn add sharp@${sharpVersion}`;
|
|
48
|
-
} else if (process.env.npm_execpath && process.env.npm_execpath.includes("pnpm")) {
|
|
49
|
-
installCommand = `pnpm add sharp@${sharpVersion}`;
|
|
50
|
-
} else if (process.env.npm_execpath && process.env.npm_execpath.includes("bun")) {
|
|
51
|
-
installCommand = `bun add sharp@${sharpVersion}`;
|
|
52
|
-
} else {
|
|
53
|
-
installCommand = `npm install sharp@${sharpVersion}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
child_process.execSync(installCommand, {stdio: 'inherit'});
|
|
57
|
-
|
|
58
8
|
const packageJsonPath: string = path.resolve(process.cwd(), "package.json");
|
|
59
9
|
const packageJson: any = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
60
10
|
|