@opentermsarchive/engine 2.0.0 → 2.1.0
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/bin/ota-dataset.js +7 -2
- package/config/default.json +3 -1
- package/package.json +3 -2
- package/src/index.js +10 -2
- package/src/reporter/github.js +1 -1
package/bin/ota-dataset.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import './env.js';
|
|
3
3
|
|
|
4
4
|
import { program } from 'commander';
|
|
5
|
+
import config from 'config';
|
|
5
6
|
import cron from 'croner';
|
|
7
|
+
import cronstrue from 'cronstrue';
|
|
6
8
|
|
|
7
9
|
import { release } from '../scripts/dataset/index.js';
|
|
8
10
|
import logger from '../src/logger/index.js';
|
|
@@ -26,8 +28,11 @@ const options = {
|
|
|
26
28
|
if (!schedule) {
|
|
27
29
|
await release(options);
|
|
28
30
|
} else {
|
|
31
|
+
const trackingSchedule = config.get('@opentermsarchive/engine.dataset.publishingSchedule');
|
|
32
|
+
const humanReadableSchedule = cronstrue.toString(trackingSchedule);
|
|
33
|
+
|
|
29
34
|
logger.info('The scheduler is running…');
|
|
30
|
-
logger.info(
|
|
35
|
+
logger.info(`Dataset will be published ${humanReadableSchedule.toLowerCase()} in the timezone of this machine`);
|
|
31
36
|
|
|
32
|
-
cron('
|
|
37
|
+
cron(config.get('@opentermsarchive/engine.dataset.publishingSchedule'), () => release(options));
|
|
33
38
|
}
|
package/config/default.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@opentermsarchive/engine": {
|
|
3
|
+
"trackingSchedule": "30 */6 * * *",
|
|
3
4
|
"services": {
|
|
4
5
|
"declarationsPath": "./declarations"
|
|
5
6
|
},
|
|
@@ -57,7 +58,8 @@
|
|
|
57
58
|
},
|
|
58
59
|
"dataset": {
|
|
59
60
|
"title": "sandbox",
|
|
60
|
-
"versionsRepositoryURL": "https://github.com/OpenTermsArchive/sandbox"
|
|
61
|
+
"versionsRepositoryURL": "https://github.com/OpenTermsArchive/sandbox",
|
|
62
|
+
"publishingSchedule": "30 8 * * MON"
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentermsarchive/engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Tracks and makes visible changes to the terms of online services",
|
|
5
5
|
"homepage": "https://opentermsarchive.org",
|
|
6
6
|
"bugs": {
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"chai-exclude": "^2.1.0",
|
|
63
63
|
"commander": "^9.4.1",
|
|
64
64
|
"config": "^3.3.6",
|
|
65
|
-
"croner": "^
|
|
65
|
+
"croner": "^8.0.2",
|
|
66
|
+
"cronstrue": "^2.50.0",
|
|
66
67
|
"cross-env": "^7.0.3",
|
|
67
68
|
"datauri": "^4.1.0",
|
|
68
69
|
"dotenv": "^10.0.0",
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import config from 'config';
|
|
2
2
|
import cron from 'croner';
|
|
3
|
+
import cronstrue from 'cronstrue';
|
|
3
4
|
|
|
4
5
|
import Archivist from './archivist/index.js';
|
|
5
6
|
import logger from './logger/index.js';
|
|
@@ -71,8 +72,15 @@ export default async function track({ services, types, extractOnly, schedule })
|
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
const trackingSchedule = config.get('@opentermsarchive/engine.trackingSchedule');
|
|
76
|
+
const humanReadableSchedule = cronstrue.toString(trackingSchedule);
|
|
77
|
+
|
|
74
78
|
logger.info('The scheduler is running…');
|
|
75
|
-
logger.info(
|
|
79
|
+
logger.info(`Terms will be tracked ${humanReadableSchedule.toLowerCase()} in the timezone of this machine`);
|
|
76
80
|
|
|
77
|
-
cron(
|
|
81
|
+
cron(
|
|
82
|
+
trackingSchedule,
|
|
83
|
+
{ protect: job => logger.warn(`Tracking scheduled at ${new Date().toISOString()} were blocked by an unfinished tracking started at ${job.currentRun().toISOString()}`) },
|
|
84
|
+
() => archivist.track({ services, types }),
|
|
85
|
+
);
|
|
78
86
|
}
|