cron 2.2.0 → 2.3.1
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/CHANGELOG.md +0 -0
- package/LICENSE +0 -0
- package/README.md +85 -141
- package/lib/cron.js +2 -2
- package/lib/job.js +19 -18
- package/lib/time.js +356 -52
- package/package.json +22 -16
- package/.editorconfig +0 -5
- package/.eslintrc +0 -26
- package/.github/ISSUE_TEMPLATE/bug_issue.yaml +0 -26
- package/.github/ISSUE_TEMPLATE/feature.yaml +0 -31
- package/.github/workflows/nodejs.yml +0 -39
- package/.prettierrc +0 -7
- package/bower.json +0 -29
- package/examples/at_10_minutes.js +0 -9
- package/examples/at_midnight.js +0 -9
- package/examples/basic.js +0 -9
- package/examples/complex_expr.js +0 -9
- package/examples/every_10_minutes.js +0 -9
- package/examples/every_30_minutes_between_9_and_5.js +0 -9
- package/examples/get_next_runs.js +0 -24
- package/examples/in_the_past.js +0 -19
- package/examples/is_crontime_valid.js +0 -9
- package/examples/is_job_running.js +0 -10
- package/examples/long_running_on_tick.js +0 -20
- package/examples/mon_to_fri_at_11_30.js +0 -9
- package/examples/multiple_jobs.js +0 -15
- package/examples/object_param.js +0 -23
- package/examples/run_at_specific_date.js +0 -11
- package/examples/time_dom_syntax_with_tz.js +0 -13
- package/tests/cron.test.js +0 -937
- package/tests/crontime.test.js +0 -477
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Bug
|
|
2
|
-
description: Report a bug found in the bot's source code
|
|
3
|
-
labels: ["🛠 goal: fix"]
|
|
4
|
-
body:
|
|
5
|
-
- type: textarea
|
|
6
|
-
id: description
|
|
7
|
-
attributes:
|
|
8
|
-
label: Description
|
|
9
|
-
description: A brief description of the question or issue, also include what you tried and what didn't work
|
|
10
|
-
validations:
|
|
11
|
-
required: true
|
|
12
|
-
- type: textarea
|
|
13
|
-
id: screenshots
|
|
14
|
-
attributes:
|
|
15
|
-
label: Screenshots
|
|
16
|
-
description: Please add screenshots if applicable
|
|
17
|
-
validations:
|
|
18
|
-
required: false
|
|
19
|
-
- type: textarea
|
|
20
|
-
id: extrainfo
|
|
21
|
-
attributes:
|
|
22
|
-
label: Additional information
|
|
23
|
-
description: Is there anything else we should know about this bug?
|
|
24
|
-
validations:
|
|
25
|
-
required: false
|
|
26
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: Feature request
|
|
2
|
-
description: Suggest features, propose improvements, discuss new ideas
|
|
3
|
-
title: "[FEATURE] <description>"
|
|
4
|
-
labels: ["⭐ goal: addition"]
|
|
5
|
-
body:
|
|
6
|
-
- type: textarea
|
|
7
|
-
id: suggestion
|
|
8
|
-
attributes:
|
|
9
|
-
label: ⭐ Suggestion
|
|
10
|
-
description: A summary of what you'd like to see added or changed
|
|
11
|
-
validations:
|
|
12
|
-
required: true
|
|
13
|
-
- type: textarea
|
|
14
|
-
id: usecases
|
|
15
|
-
attributes:
|
|
16
|
-
label: 💻 Use Cases
|
|
17
|
-
description: |
|
|
18
|
-
What are possible test cases for your suggested feature?
|
|
19
|
-
Are you using any workarounds in the meantime?
|
|
20
|
-
validations:
|
|
21
|
-
required: false
|
|
22
|
-
- type: textarea
|
|
23
|
-
id: relatedproblems
|
|
24
|
-
attributes:
|
|
25
|
-
label: ❌ Related Problems
|
|
26
|
-
description: |
|
|
27
|
-
Is your Request related to a problem?
|
|
28
|
-
Think about linking existing Issues here!
|
|
29
|
-
validations:
|
|
30
|
-
required: false
|
|
31
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
build:
|
|
16
|
-
|
|
17
|
-
runs-on: ${{ matrix.os }}
|
|
18
|
-
|
|
19
|
-
strategy:
|
|
20
|
-
matrix:
|
|
21
|
-
node: [14.x, 16.x, 18.x]
|
|
22
|
-
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v2
|
|
26
|
-
- name: Use Node.js ${{ matrix.node }}
|
|
27
|
-
uses: actions/setup-node@v1
|
|
28
|
-
with:
|
|
29
|
-
node-version: ${{ matrix.node }}
|
|
30
|
-
- run: npm ci
|
|
31
|
-
- run: npm run build --if-present
|
|
32
|
-
- run: npm test
|
|
33
|
-
env:
|
|
34
|
-
CI: true
|
|
35
|
-
- run: npm run lint
|
|
36
|
-
|
|
37
|
-
- name: Codecov
|
|
38
|
-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '12.x' }}
|
|
39
|
-
uses: codecov/codecov-action@v1.0.6
|
package/.prettierrc
DELETED
package/bower.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cronjs",
|
|
3
|
-
"homepage": "https://github.com/ncb000gt/node-cron",
|
|
4
|
-
"authors": [
|
|
5
|
-
"Romain Beauxis<toots@rastageeks.org>",
|
|
6
|
-
"James Padoulsey<@padolsey>",
|
|
7
|
-
"Craig Condon<craig@browsertap.com>",
|
|
8
|
-
"Finn Herpich",
|
|
9
|
-
"cliftonc",
|
|
10
|
-
"neyric",
|
|
11
|
-
"humanchimp",
|
|
12
|
-
"danhbear",
|
|
13
|
-
"Jordan Abderrachid<jabderrachid@gmail.com>"
|
|
14
|
-
],
|
|
15
|
-
"description": "js cron handler",
|
|
16
|
-
"main": ["lib/cron.js"],
|
|
17
|
-
"keywords": [
|
|
18
|
-
"cron",
|
|
19
|
-
"js"
|
|
20
|
-
],
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"ignore": [
|
|
23
|
-
"**/.*",
|
|
24
|
-
"node_modules",
|
|
25
|
-
"bower_components",
|
|
26
|
-
"test",
|
|
27
|
-
"tests"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('* 10 * * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('At Ten Minutes:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
package/examples/at_midnight.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('00 00 00 * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Midnight:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
package/examples/basic.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('* * * * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Every second:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
package/examples/complex_expr.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('* 4-22 * * 1-5', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Every Minute Between hours 4-22, Monday through Friday:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('0 */10 * * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Every Tenth Minute:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('0 */30 9-17 * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Every 30 minutes between 9-17:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
const job = new CronJob(
|
|
4
|
-
'0 * * * * *',
|
|
5
|
-
function() {
|
|
6
|
-
console.log('Date: ', new Date());
|
|
7
|
-
},
|
|
8
|
-
null,
|
|
9
|
-
true
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
console.log('System TZ next 5: ', job.nextDates(5));
|
|
13
|
-
|
|
14
|
-
const jobUTC = new CronJob(
|
|
15
|
-
'0 * * * * *',
|
|
16
|
-
function() {
|
|
17
|
-
console.log('Date: ', new Date());
|
|
18
|
-
},
|
|
19
|
-
null,
|
|
20
|
-
true,
|
|
21
|
-
'UTC'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
console.log('UTC next 5: ', jobUTC.nextDates(5));
|
package/examples/in_the_past.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
// XXX: SEE README GOTCHAS ABOUT WHY THIS COULD BE IN THE PAST!
|
|
4
|
-
let d = new Date();
|
|
5
|
-
d.setMilliseconds(d.getMilliseconds() + 1);
|
|
6
|
-
|
|
7
|
-
console.log('Before job instantiation');
|
|
8
|
-
const job = new CronJob(
|
|
9
|
-
d,
|
|
10
|
-
() => {
|
|
11
|
-
const d2 = new Date();
|
|
12
|
-
console.log('Tick @:', d2);
|
|
13
|
-
},
|
|
14
|
-
() => {
|
|
15
|
-
console.log('complete');
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
console.log('After job instantiation');
|
|
19
|
-
job.start();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('* * * * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('Every second:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
|
10
|
-
console.log('is job running? ', job.running);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
let isRunning = false;
|
|
4
|
-
console.log('Before job instantiation');
|
|
5
|
-
const job = new CronJob('* * * * * *', function() {
|
|
6
|
-
const d = new Date();
|
|
7
|
-
console.log('Check every second:', d, ', isRunning: ', isRunning);
|
|
8
|
-
|
|
9
|
-
if (!isRunning) {
|
|
10
|
-
isRunning = true;
|
|
11
|
-
|
|
12
|
-
setTimeout(function() {
|
|
13
|
-
console.log('Long running onTick complete:', new Date());
|
|
14
|
-
isRunning = false;
|
|
15
|
-
}, 3000);
|
|
16
|
-
console.log('setTimeout triggered:', new Date());
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
console.log('After job instantiation');
|
|
20
|
-
job.start();
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('00 30 11 * * 1-5', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('onTick:', d);
|
|
7
|
-
});
|
|
8
|
-
console.log('After job instantiation');
|
|
9
|
-
job.start();
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
const job = new CronJob('*/5 * * * * *', function() {
|
|
5
|
-
const d = new Date();
|
|
6
|
-
console.log('First:', d);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const job2 = new CronJob('*/8 * * * * *', function() {
|
|
10
|
-
const d = new Date();
|
|
11
|
-
console.log('Second:', d);
|
|
12
|
-
});
|
|
13
|
-
console.log('After job instantiation');
|
|
14
|
-
job.start();
|
|
15
|
-
job2.start();
|
package/examples/object_param.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
let isRunning = false;
|
|
4
|
-
console.log('Before job instantiation');
|
|
5
|
-
const job = new CronJob({
|
|
6
|
-
cronTime: '* * * * * *',
|
|
7
|
-
onTick: function() {
|
|
8
|
-
const d = new Date();
|
|
9
|
-
console.log('Check every second:', d, ', isRunning: ', isRunning);
|
|
10
|
-
|
|
11
|
-
if (!isRunning) {
|
|
12
|
-
isRunning = true;
|
|
13
|
-
|
|
14
|
-
setTimeout(function() {
|
|
15
|
-
console.log('Long running onTick complete:', new Date());
|
|
16
|
-
isRunning = false;
|
|
17
|
-
}, 3000);
|
|
18
|
-
console.log('setTimeout triggered:', new Date());
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
console.log('After job instantiation');
|
|
23
|
-
job.start();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const CronJob = require('../lib/cron.js').CronJob;
|
|
2
|
-
|
|
3
|
-
console.log('Before job instantiation');
|
|
4
|
-
let date = new Date();
|
|
5
|
-
date.setSeconds(date.getSeconds()+2);
|
|
6
|
-
const job = new CronJob(date, function() {
|
|
7
|
-
const d = new Date();
|
|
8
|
-
console.log('Specific date:', date, ', onTick at:', d);
|
|
9
|
-
});
|
|
10
|
-
console.log('After job instantiation');
|
|
11
|
-
job.start();
|