xypriss 1.3.2 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xypriss",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "XyPriss is a Node.js framework that extends Express.js with additional performance, security, and scalability features. Built with TypeScript, it maintains full Express.js compatibility while adding enterprise-level capabilities for production applications.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -5,14 +5,18 @@
5
5
  * Downloads platform-specific memory CLI binary during npm install
6
6
  */
7
7
 
8
- const https = require("https");
9
- const fs = require("fs");
10
- const path = require("path");
11
- const { execSync } = require("child_process");
8
+ import https from "https";
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import { execSync, spawn } from "child_process";
12
+ import { fileURLToPath } from "url";
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
12
16
 
13
17
  const CDN_BASE_URL = "https://sdk.nehonix.space/dl/mds/xypriss/bin";
14
18
  const BIN_DIR = path.join(__dirname, "..", "bin");
15
- const TIMEOUT = 30000; // 30 seconds
19
+ const TIMEOUT = 40000; // 40 seconds
16
20
 
17
21
  /**
18
22
  * Get platform-specific binary information
@@ -138,7 +142,7 @@ function makeExecutable(filePath) {
138
142
  function verifyBinary(filePath) {
139
143
  return new Promise((resolve) => {
140
144
  try {
141
- const { spawn } = require("child_process");
145
+ // spawn is already imported at the top
142
146
  const child = spawn(filePath, ["--help"], {
143
147
  stdio: "pipe",
144
148
  timeout: 5000,
@@ -223,11 +227,10 @@ async function installMemoryCLI() {
223
227
  return;
224
228
  }
225
229
 
226
- console.log("🎉 XyPriss Memory CLI installed successfully!");
227
- console.log(`📍 Binary location: ${binaryInfo.localPath}`);
230
+ console.log("🎉 XyPriss MCLI installed successfully!");
228
231
  } catch (error) {
229
232
  console.error("❌ Failed to install Memory CLI:", error.message);
230
- console.log("📝 Memory CLI will use fallback mode (Node.js os module)");
233
+ console.log("Memory CLI will use fallback mode (Node.js os module)");
231
234
 
232
235
  // Clean up partial downloads
233
236
  if (fs.existsSync(binaryInfo.localPath)) {
@@ -249,22 +252,23 @@ function shouldSkipInstall() {
249
252
  process.env.CI === "true" ||
250
253
  process.env.SKIP_BINARY_DOWNLOAD === "true"
251
254
  ) {
252
- console.log("⏭️ Skipping binary download (CI environment detected)");
255
+ console.log("Skipping binary download (CI environment detected)");
253
256
  return true;
254
257
  }
255
258
 
256
- // Skip if binary already exists and is valid
259
+ // Remove if binary already exists and is valid
257
260
  const binaryInfo = getPlatformBinary();
258
261
  if (binaryInfo && fs.existsSync(binaryInfo.localPath)) {
259
- console.log("✅ Memory CLI binary already exists");
260
- return true;
262
+ const unLinkPath = path.dirname(binaryInfo.localPath);
263
+ console.log("Removing MCLI dir to download latest version...");
264
+ fs.rmdirSync(unLinkPath, { recursive: true });
261
265
  }
262
266
 
263
267
  return false;
264
268
  }
265
269
 
266
270
  // Run installation if this script is executed directly
267
- if (require.main === module) {
271
+ if (import.meta.url === `file://${process.argv[1]}`) {
268
272
  if (!shouldSkipInstall()) {
269
273
  installMemoryCLI().catch((error) => {
270
274
  console.error("💥 Installation failed:", error);
@@ -273,10 +277,5 @@ if (require.main === module) {
273
277
  }
274
278
  }
275
279
 
276
- module.exports = {
277
- installMemoryCLI,
278
- getPlatformBinary,
279
- downloadFile,
280
- verifyBinary,
281
- };
280
+ export { installMemoryCLI, getPlatformBinary, downloadFile, verifyBinary };
282
281
 
@@ -5,27 +5,31 @@
5
5
  * Runs after npm install to set up platform-specific binaries
6
6
  */
7
7
 
8
- const { installMemoryCLI } = require('./install-memory-cli');
8
+ import { installMemoryCLI } from "./install-memory-cli.js";
9
9
 
10
10
  async function postInstall() {
11
- console.log('🔧 Running XyPriss post-install setup...');
12
-
11
+ console.log("🔧 Running XyPriss post-install setup...");
12
+
13
13
  try {
14
14
  await installMemoryCLI();
15
- console.log('✅ XyPriss setup complete!');
15
+ console.log("✅ XyPriss setup complete!");
16
16
  } catch (error) {
17
- console.warn('⚠️ Post-install setup encountered issues:', error.message);
18
- console.log('📝 XyPriss will continue to work with fallback mode.');
17
+ console.warn(
18
+ "⚠️ Post-install setup encountered issues:",
19
+ error.message
20
+ );
21
+ console.log("📝 XyPriss will continue to work with fallback mode.");
19
22
  }
20
23
  }
21
24
 
22
- // Only run if this is the main module (not being required)
23
- if (require.main === module) {
25
+ // Only run if this is the main module (not being imported)
26
+ if (import.meta.url === `file://${process.argv[1]}`) {
24
27
  postInstall().catch((error) => {
25
- console.error('💥 Post-install failed:', error);
28
+ console.error("💥 Post-install failed:", error);
26
29
  // Don't exit with error code to avoid breaking npm install
27
30
  process.exit(0);
28
31
  });
29
32
  }
30
33
 
31
- module.exports = { postInstall };
34
+ export { postInstall };
35
+