thepopebot 1.2.40 → 1.2.41
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/lib/cron.js +5 -1
- package/package.json +1 -1
package/lib/cron.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import cron from 'node-cron';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
3
5
|
import { cronsFile, cronDir } from './paths.js';
|
|
4
6
|
import { executeAction } from './actions.js';
|
|
5
7
|
|
|
6
8
|
// Read installed version once at module load (doesn't change while server runs)
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
7
11
|
const _installedVersion = JSON.parse(
|
|
8
|
-
fs.readFileSync(
|
|
12
|
+
fs.readFileSync(join(__dirname, '..', 'package.json'), 'utf8')
|
|
9
13
|
).version;
|
|
10
14
|
|
|
11
15
|
// In-memory flag for available update (read by sidebar, written by cron)
|