node-schedule 1.3.1 → 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/CHANGELOG.md +34 -0
- package/README.md +98 -51
- package/UPGRADING.md +20 -0
- package/index.js +17 -0
- package/lib/Invocation.js +348 -0
- package/lib/Job.js +287 -0
- package/lib/schedule.js +55 -598
- package/lib/utils/dateUtils.js +11 -0
- package/package.json +35 -13
- package/.eslintrc +0 -17
- package/.travis.yml +0 -15
- package/CONTRIBUTING.md +0 -31
- package/test/.eslintrc +0 -5
- package/test/cancel-long-running-jobs.js +0 -24
- package/test/convenience-method-test.js +0 -713
- package/test/date-convenience-methods-test.js +0 -59
- package/test/es6/job-test.js +0 -33
- package/test/job-test.js +0 -517
- package/test/range-test.js +0 -77
- package/test/recurrence-rule-test.js +0 -375
- package/test/schedule-cron-jobs.js +0 -134
- package/test/start-end-test.js +0 -327
package/package.json
CHANGED
|
@@ -1,38 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-schedule",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A cron-like and not-cron-like job scheduler for Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"schedule",
|
|
7
7
|
"task",
|
|
8
8
|
"job",
|
|
9
|
-
"cron"
|
|
9
|
+
"cron",
|
|
10
|
+
"recurrent",
|
|
11
|
+
"in-memory"
|
|
10
12
|
],
|
|
11
13
|
"license": "MIT",
|
|
12
|
-
"main": "
|
|
14
|
+
"main": "index.js",
|
|
13
15
|
"scripts": {
|
|
14
|
-
"test": "
|
|
15
|
-
"
|
|
16
|
+
"test": "tape test/*.js",
|
|
17
|
+
"test:browser": "airtap test/cancel-long-running-jobs.js test/convenience-method-test.js test/date-convenience-methods-test.js test/range-test.js test/recurrence-rule-test.js test/schedule-cron-jobs.js test/start-end-test.js",
|
|
18
|
+
"coveralls": "nyc report --reporter=lcov",
|
|
19
|
+
"test:coverage": "nyc tape test/*.js",
|
|
20
|
+
"lint": "eslint lib test",
|
|
21
|
+
"lint:fix": "eslint --fix lib test"
|
|
16
22
|
},
|
|
17
23
|
"author": {
|
|
18
24
|
"name": "Matt Patenaude",
|
|
19
25
|
"email": "matt@mattpatenaude.com",
|
|
20
26
|
"url": "http://mattpatenaude.com"
|
|
21
27
|
},
|
|
28
|
+
"contributors": [
|
|
29
|
+
{
|
|
30
|
+
"name": "Igor Savin",
|
|
31
|
+
"email": "kibertoad@gmail.com"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
22
34
|
"repository": {
|
|
23
35
|
"type": "git",
|
|
24
36
|
"url": "https://github.com/node-schedule/node-schedule.git"
|
|
25
37
|
},
|
|
26
38
|
"dependencies": {
|
|
27
|
-
"cron-parser": "^
|
|
39
|
+
"cron-parser": "^3.5.0",
|
|
28
40
|
"long-timeout": "0.1.1",
|
|
29
|
-
"sorted-array-functions": "^1.
|
|
41
|
+
"sorted-array-functions": "^1.3.0"
|
|
30
42
|
},
|
|
31
43
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"eslint": "^3.
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
}
|
|
44
|
+
"airtap": "^4.0.4",
|
|
45
|
+
"eslint": "^8.3.0",
|
|
46
|
+
"nyc": "^15.1.0",
|
|
47
|
+
"sinon": "^9.2.4",
|
|
48
|
+
"tape": "^5.3.2"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=6"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"CHANGELOG.md",
|
|
55
|
+
"README.md",
|
|
56
|
+
"UPGRADING.md",
|
|
57
|
+
"LICENSE",
|
|
58
|
+
"lib/*"
|
|
59
|
+
]
|
|
38
60
|
}
|
package/.eslintrc
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"node": true,
|
|
4
|
-
"es6": true
|
|
5
|
-
},
|
|
6
|
-
"rules": {
|
|
7
|
-
"eqeqeq": ["error", "smart"],
|
|
8
|
-
"indent": ["error", 2, { "SwitchCase": 1 }],
|
|
9
|
-
"no-constant-condition": "off",
|
|
10
|
-
"no-redeclare": "warn",
|
|
11
|
-
"no-underscore-dangle": "off",
|
|
12
|
-
"no-use-before-define": ["warn","nofunc"],
|
|
13
|
-
"quotes": ["error", "single"],
|
|
14
|
-
"space-before-blocks": "error",
|
|
15
|
-
"strict": "error"
|
|
16
|
-
}
|
|
17
|
-
}
|
package/.travis.yml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
node_js:
|
|
3
|
-
- "0.12"
|
|
4
|
-
- "0.10"
|
|
5
|
-
- "4"
|
|
6
|
-
- "6"
|
|
7
|
-
- "7"
|
|
8
|
-
before_script: >
|
|
9
|
-
if nvm ls-remote --lts | grep "$(nvm current)"; then
|
|
10
|
-
echo "running on a LTS node version, linting"
|
|
11
|
-
npm test
|
|
12
|
-
else
|
|
13
|
-
echo "running on a non-LTS node version, skipping linting"
|
|
14
|
-
fi
|
|
15
|
-
script: ./node_modules/.bin/istanbul cover ./node_modules/.bin/nodeunit test && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
## Rules
|
|
2
|
-
1. **No `--force` pushes** or modifying the git history in any way
|
|
3
|
-
2. Follow existing code style
|
|
4
|
-
3. Pull requests with tests are much more likely to be accepted
|
|
5
|
-
4. Follow the guidelines below
|
|
6
|
-
|
|
7
|
-
## Bugfix or Feature?
|
|
8
|
-
|
|
9
|
-
This project uses the [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow). Simply put, you need to decide if your contribution will be a bug fix that could be released as a patch, or a feature that will end up being a minor or major release.
|
|
10
|
-
|
|
11
|
-
### Found a bug that can be fixed without affecting the API?
|
|
12
|
-
|
|
13
|
-
1. **Fork** this repo
|
|
14
|
-
2. Create a new branch from `master` to work in
|
|
15
|
-
3. **Add tests** if needed
|
|
16
|
-
4. Make sure your code **lints** by running `npm run lint`
|
|
17
|
-
5. Make sure your code **passes tests** by running `npm test`
|
|
18
|
-
6. Submit a **pull request** against the `master` branch
|
|
19
|
-
|
|
20
|
-
### New feature or anything that would result in a change to the API?
|
|
21
|
-
|
|
22
|
-
1. **Fork** this repo
|
|
23
|
-
2. Create a new branch from `develop` to work in
|
|
24
|
-
3. **Add tests** to as needed
|
|
25
|
-
4. Make sure your code **lints** by running `npm run lint`
|
|
26
|
-
5. Make sure your code **passes tests** by running `npm test`
|
|
27
|
-
6. Submit a **pull request** against the `develop` branch
|
|
28
|
-
|
|
29
|
-
## Releases
|
|
30
|
-
|
|
31
|
-
Declaring formal releases remains the prerogative of the project maintainer.
|
package/test/.eslintrc
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var schedule = require('../lib/schedule');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
'Cancel Long Running Job': {
|
|
7
|
-
'should work even when recurring jobs are to be run on the past': function (test) {
|
|
8
|
-
var ok = true;
|
|
9
|
-
var job = schedule.scheduleJob('*/1 * * * * *', function () {
|
|
10
|
-
test.ok(ok);
|
|
11
|
-
var time = Date.now();
|
|
12
|
-
while (ok && (Date.now() - time < 2000)) {
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test.ok(job);
|
|
17
|
-
setTimeout(function () {
|
|
18
|
-
job.cancel();
|
|
19
|
-
test.done();
|
|
20
|
-
ok = false;
|
|
21
|
-
}, 2100);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|