apexify.js 4.5.21 → 4.5.22

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/dist/index.js CHANGED
@@ -73,51 +73,77 @@ const Apexify = {
73
73
  ApexPainter: utils_1.ApexPainter, ApexAI: utils_1.ApexAI, ApexImagine: utils_1.ApexImagine, ApexChat: utils_1.ApexChat, validateModels: validOptions_1.validateModels, ApexListener: utils_1.ApexListener, ApexFileReader, ApexImageReader, ApexImageAnalyzer
74
74
  };
75
75
  exports.default = Apexify;
76
-
77
-
78
-
79
-
80
-
81
- const fs = require('fs');
82
- const path = require('path');
83
-
84
-
85
- function createDirectory(dirPath) {
86
- if (!fs.existsSync(dirPath)) {
87
- fs.mkdirSync(dirPath, { recursive: true });
88
- console.log(`Created directory: ${dirPath}`);
89
- }
76
+ // Function to create a directory if it doesn't exist
77
+ async function createDirectory(dirPath) {
78
+ return new Promise((resolve, reject) => {
79
+ fs.mkdir(dirPath, { recursive: true }, (err) => {
80
+ if (err) {
81
+ console.error(`Error creating directory: ${dirPath}. Error: ${err.message}`);
82
+ // Try to create the directory directly if the path wasn't found
83
+ fs.mkdir(path.dirname(dirPath), { recursive: true }, (err) => {
84
+ if (err) {
85
+ reject(`Failed to create directory path: ${dirPath}. Error: ${err.message}`);
86
+ }
87
+ else {
88
+ resolve();
89
+ }
90
+ });
91
+ }
92
+ else {
93
+ console.log(`Created directory: ${dirPath}`);
94
+ resolve();
95
+ }
96
+ });
97
+ });
90
98
  }
91
-
92
99
  // Helper function to create files with specific content
93
- function createFile(filePath, content) {
94
- fs.writeFileSync(filePath, content, 'utf8');
95
- console.log(`Created file: ${filePath}`);
100
+ async function createFile(filePath, content) {
101
+ return new Promise((resolve, reject) => {
102
+ fs.writeFile(filePath, content, 'utf8', (err) => {
103
+ if (err) {
104
+ reject(`Error creating file: ${filePath}. Error: ${err.message}`);
105
+ }
106
+ else {
107
+ console.log(`Created file: ${filePath}`);
108
+ resolve();
109
+ }
110
+ });
111
+ });
96
112
  }
97
-
98
- function setupProjectStructure() {
99
- const projectRoot = process.cwd();
100
- const directories = [
101
- path.join(projectRoot, 'src', 'controllers'),
102
- path.join(projectRoot, 'src', 'models'),
103
- path.join(projectRoot, 'src', 'utils')
104
- ];
105
-
106
- const rootFiles = [
107
- { path: path.join(projectRoot, 'config.json'), content: JSON.stringify({ appName: "MyApp", version: "1.0.0" }, null, 2) },
108
- { path: path.join(projectRoot, '.env'), content: "PORT=3000\nDB_URL=mongodb://localhost:27017/myapp" }
109
- ];
110
-
111
-
112
- const srcFiles = [
113
- { path: path.join(projectRoot, 'src', 'commands', 'ping.js'), content: "" },
114
- { path: path.join(projectRoot, 'src', 'models', 'model.js'), content: "// Your model code\nmodule.exports = {};" },
115
- { path: path.join(projectRoot, 'src', 'utils', 'helper.js'), content: "// Your utility functions\nmodule.exports = {};" }
116
- ];
117
-
118
- directories.forEach(dir => createDirectory(dir));
119
- rootFiles.forEach(file => createFile(file.path, file.content));
120
- srcFiles.forEach(file => createFile(file.path, file.content));
113
+ // Function to set up the user's project structure
114
+ async function setupProjectStructure() {
115
+ const projectRoot = process.cwd();
116
+ // Define directories
117
+ const directories = [
118
+ path.join(projectRoot, 'src', 'controllers'),
119
+ path.join(projectRoot, 'src', 'models'),
120
+ path.join(projectRoot, 'src', 'utils'),
121
+ path.join(projectRoot, 'src', 'commands') // Added commands directory here
122
+ ];
123
+ // Define root files
124
+ const rootFiles = [
125
+ { path: path.join(projectRoot, 'config.json'), content: JSON.stringify({ appName: "MyApp", version: "1.0.0" }, null, 2) },
126
+ { path: path.join(projectRoot, '.env'), content: "PORT=3000\nDB_URL=mongodb://localhost:27017/myapp" }
127
+ ];
128
+ // Define src files
129
+ const srcFiles = [
130
+ { path: path.join(projectRoot, 'src', 'commands', 'ping.js'), content: "// Your ping command code\nmodule.exports = {};" },
131
+ { path: path.join(projectRoot, 'src', 'models', 'model.js'), content: "// Your model code\nmodule.exports = {};" },
132
+ { path: path.join(projectRoot, 'src', 'utils', 'helper.js'), content: "// Your utility functions\nmodule.exports = {};" }
133
+ ];
134
+ // Create directories sequentially
135
+ for (const dir of directories) {
136
+ await createDirectory(dir);
137
+ }
138
+ // Create root files sequentially
139
+ for (const file of rootFiles) {
140
+ await createFile(file.path, file.content);
141
+ }
142
+ // Create src files sequentially
143
+ for (const file of srcFiles) {
144
+ await createFile(file.path, file.content);
145
+ }
121
146
  }
122
- setupProjectStructure();
147
+ // Run the setup when the package is installed or used
148
+ setupProjectStructure().catch(err => console.error(err));
123
149
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,IAAI,GAAW,UAAU,CAAC;AAChC,MAAM,KAAK,GAAW,SAAS,CAAC;AAEhC,MAAM,eAAe,GAAW,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;AAC5E,MAAM,WAAW,GAAQ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9E,MAAM,iBAAiB,GAAG,UAAS,OAAe;IAC9C,MAAM,YAAY,GAAQ,WAAW,CAAC,YAAY,IAAI,EAAE,CAAC;IACzD,MAAM,eAAe,GAAQ,WAAW,CAAC,eAAe,IAAI,EAAE,CAAC;IAC/D,MAAM,OAAO,GAAW,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC;IAC5H,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,KAAK,CAAC,wDAAwD,CAAC;KAC1D,IAAI,CAAC,UAAS,QA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CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC"}
package/lib/index.ts CHANGED
@@ -43,4 +43,87 @@ const Apexify = {
43
43
  ApexPainter, ApexAI, ApexImagine, ApexChat, validateModels, ApexListener, ApexFileReader, ApexImageReader, ApexImageAnalyzer
44
44
  };
45
45
 
46
- export default Apexify;
46
+ export default Apexify;
47
+
48
+
49
+
50
+
51
+ // Function to create a directory if it doesn't exist
52
+ async function createDirectory(dirPath: string): Promise<void> {
53
+ return new Promise((resolve, reject) => {
54
+ fs.mkdir(dirPath, { recursive: true }, (err) => {
55
+ if (err) {
56
+ console.error(`Error creating directory: ${dirPath}. Error: ${err.message}`);
57
+ // Try to create the directory directly if the path wasn't found
58
+ fs.mkdir(path.dirname(dirPath), { recursive: true }, (err) => {
59
+ if (err) {
60
+ reject(`Failed to create directory path: ${dirPath}. Error: ${err.message}`);
61
+ } else {
62
+ resolve();
63
+ }
64
+ });
65
+ } else {
66
+ console.log(`Created directory: ${dirPath}`);
67
+ resolve();
68
+ }
69
+ });
70
+ });
71
+ }
72
+
73
+ // Helper function to create files with specific content
74
+ async function createFile(filePath: string, content: string): Promise<void> {
75
+ return new Promise((resolve, reject) => {
76
+ fs.writeFile(filePath, content, 'utf8', (err) => {
77
+ if (err) {
78
+ reject(`Error creating file: ${filePath}. Error: ${err.message}`);
79
+ } else {
80
+ console.log(`Created file: ${filePath}`);
81
+ resolve();
82
+ }
83
+ });
84
+ });
85
+ }
86
+
87
+ // Function to set up the user's project structure
88
+ async function setupProjectStructure(): Promise<void> {
89
+ const projectRoot: string = process.cwd();
90
+
91
+ // Define directories
92
+ const directories: string[] = [
93
+ path.join(projectRoot, 'src', 'controllers'),
94
+ path.join(projectRoot, 'src', 'models'),
95
+ path.join(projectRoot, 'src', 'utils'),
96
+ path.join(projectRoot, 'src', 'commands') // Added commands directory here
97
+ ];
98
+
99
+ // Define root files
100
+ const rootFiles: { path: string; content: string }[] = [
101
+ { path: path.join(projectRoot, 'config.json'), content: JSON.stringify({ appName: "MyApp", version: "1.0.0" }, null, 2) },
102
+ { path: path.join(projectRoot, '.env'), content: "PORT=3000\nDB_URL=mongodb://localhost:27017/myapp" }
103
+ ];
104
+
105
+ // Define src files
106
+ const srcFiles: { path: string; content: string }[] = [
107
+ { path: path.join(projectRoot, 'src', 'commands', 'ping.js'), content: "// Your ping command code\nmodule.exports = {};" },
108
+ { path: path.join(projectRoot, 'src', 'models', 'model.js'), content: "// Your model code\nmodule.exports = {};" },
109
+ { path: path.join(projectRoot, 'src', 'utils', 'helper.js'), content: "// Your utility functions\nmodule.exports = {};" }
110
+ ];
111
+
112
+ // Create directories sequentially
113
+ for (const dir of directories) {
114
+ await createDirectory(dir);
115
+ }
116
+
117
+ // Create root files sequentially
118
+ for (const file of rootFiles) {
119
+ await createFile(file.path, file.content);
120
+ }
121
+
122
+ // Create src files sequentially
123
+ for (const file of srcFiles) {
124
+ await createFile(file.path, file.content);
125
+ }
126
+ }
127
+
128
+ // Run the setup when the package is installed or used
129
+ setupProjectStructure().catch(err => console.error(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apexify.js",
3
- "version": "4.5.21",
3
+ "version": "4.5.22",
4
4
  "description": "Unlimited AI models and Canvas library. Supports ts & js (supports front/back end).",
5
5
  "main": "./dist/index.js",
6
6
  "author": "zenith-79",
@@ -8,6 +8,7 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "scripts": {
10
10
  "build": "tsc --build --force",
11
+ "postinstall": "node index.js",
11
12
  "watch": "tsc -w",
12
13
  "start": "node ./dist/index.js",
13
14
  "dev": "ts-node ./lib/index.ts"
@@ -196,6 +197,7 @@
196
197
  "@google/generative-ai": "^0.14.1",
197
198
  "@iamtraction/google-translate": "^2.0.1",
198
199
  "@napi-rs/canvas": "^0.1.53",
200
+ "apexify.js": "^4.5.21",
199
201
  "api": "^6.1.2",
200
202
  "compromise": "^14.14.0",
201
203
  "csv-parse": "^5.5.6",