Skip to content

Commit 2ccb567

Browse files
committed
Upgrade croner to v9
Croner v9 no longer provides default export
1 parent 7b902ac commit 2ccb567

File tree

5 files changed

+41
-11
lines changed

5 files changed

+41
-11
lines changed

bin/ota-dataset.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import './env.js';
33

44
import { program } from 'commander';
55
import config from 'config';
6-
import cron from 'croner';
6+
import { Cron } from 'croner';
77
import cronstrue from 'cronstrue';
88

99
import { release } from '../scripts/dataset/index.js';
@@ -34,5 +34,5 @@ if (!schedule) {
3434
logger.info('The scheduler is running…');
3535
logger.info(`Dataset will be published ${humanReadableSchedule.toLowerCase()} in the timezone of this machine`);
3636

37-
cron(config.get('@opentermsarchive/engine.dataset.publishingSchedule'), () => release(options));
37+
new Cron(config.get('@opentermsarchive/engine.dataset.publishingSchedule'), () => release(options)); // eslint-disable-line no-new
3838
}

package-lock.json

Lines changed: 34 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"chai-as-promised": "^8.0.2",
6464
"commander": "^9.4.1",
6565
"config": "^4.1.1",
66-
"croner": "^8.0.2",
66+
"croner": "^9.1.0",
6767
"cronstrue": "^2.50.0",
6868
"cross-env": "^7.0.3",
6969
"datauri": "^4.1.0",

scripts/metadata/index.mocha.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path';
44
import Ajv from 'ajv';
55
import addFormats from 'ajv-formats';
66
import config from 'config';
7-
import Croner from 'croner';
7+
import { Cron } from 'croner';
88
import yaml from 'js-yaml';
99

1010
import specsRouter from '../../src/collection-api/routes/docs.js';
@@ -15,7 +15,7 @@ describe('Metadata file validation', () => {
1515
'iso3166-2': code => /^[A-Z]{2}(-[A-Z0-9]{1,3})?$/.test(code),
1616
'cron-expression': cronExpression => {
1717
try {
18-
Croner(cronExpression); // eslint-disable-line new-cap
18+
new Cron(cronExpression); // eslint-disable-line no-new
1919

2020
return true;
2121
} catch {

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createRequire } from 'module';
22

33
import config from 'config';
4-
import cron from 'croner';
4+
import { Cron } from 'croner';
55
import cronstrue from 'cronstrue';
66

77
import { getCollection } from './archivist/collection/index.js';
@@ -83,7 +83,7 @@ export default async function track({ services, types, extractOnly, schedule })
8383
logger.info('The scheduler is running…');
8484
logger.info(`Terms will be tracked ${humanReadableSchedule.toLowerCase()} in the timezone of this machine`);
8585

86-
cron(
86+
new Cron( // eslint-disable-line no-new
8787
trackingSchedule,
8888
{ protect: job => logger.warn(`Tracking scheduled at ${new Date().toISOString()} were blocked by an unfinished tracking started at ${job.currentRun().toISOString()}`) },
8989
() => archivist.track({ services, types }),

0 commit comments

Comments
 (0)