@fastify/schedule
Advanced tools
Comparing version 3.0.0 to 3.0.1
37
index.js
@@ -1,15 +0,28 @@ | ||
const { fastifySchedulePlugin } = require("./lib/schedulePlugin"); | ||
"use strict"; | ||
const { ToadScheduler } = require("toad-scheduler"); | ||
const fp = require("fastify-plugin"); | ||
function plugin(fastify, opts, next) { | ||
const scheduler = new ToadScheduler(); | ||
fastify.decorate("scheduler", scheduler); | ||
fastify.addHook("onClose", (fastify, done) => { | ||
scheduler.stop(); | ||
done(); | ||
}); | ||
next(); | ||
} | ||
const fastifySchedulePlugin = fp(plugin, { | ||
fastify: "4.x", | ||
name: "@fastify/schedule", | ||
}); | ||
module.exports = fastifySchedulePlugin; | ||
/** | ||
* These export configurations enable JS and TS developers | ||
* to consume fastify-schedule in whatever way best suits their needs. | ||
* Some examples of supported import syntax includes: | ||
* - `const fastifySchedulePlugin = require('fastify-schedule')` | ||
* - `const { fastifySchedulePlugin } = require('fastify-schedule')` | ||
* - `import * as fastifySchedulePlugin from 'fastify-schedule'` | ||
* - `import { fastifySchedulePlugin } from 'fastify-schedule'` | ||
* - `import fastifySchedulePlugin from 'fastify-schedule'` | ||
* TODO: Should be removed in the next major release | ||
*/ | ||
fastifySchedulePlugin.fastifySchedulePlugin = fastifySchedulePlugin; | ||
fastifySchedulePlugin.default = fastifySchedulePlugin; | ||
module.exports = fastifySchedulePlugin; | ||
module.exports.fastifySchedulePlugin = fastifySchedulePlugin; |
{ | ||
"name": "@fastify/schedule", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Fastify plugin for scheduling periodic jobs", | ||
@@ -13,16 +13,14 @@ "license": "MIT", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"test": "jest --config=jest.config.json", | ||
"test:coverage": "jest --config=jest.config.json --coverage", | ||
"test": "npm run test:unit && npm run test:typescript", | ||
"test:unit": "tap", | ||
"test:typescript": "tsd", | ||
"lint": "eslint \"lib/**/*.js\" \"test/**/*.js\" index.js", | ||
"lint": "eslint \"test/**/*.js\" index.js", | ||
"lint:everything": "npm run lint && npm run test:typescript", | ||
"prettier": "prettier --write \"{lib,test}/**/*.js\" index.js index.d.ts", | ||
"_postinstall": "husky install", | ||
"prepublishOnly": "pinst --disable", | ||
"postpublish": "pinst --enable" | ||
"prettier": "prettier --write \"{lib,test}/**/*.js\" index.js index.d.ts" | ||
}, | ||
"dependencies": { | ||
"fastify-plugin": "^3.0.0" | ||
"@fastify/pre-commit": "^2.0.2", | ||
"fastify-plugin": "^4.0.0" | ||
}, | ||
@@ -34,4 +32,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@types/jest": "^27.0.0", | ||
"@types/node": "^17.0.0", | ||
"@sinonjs/fake-timers": "^9.1.2", | ||
"@types/node": "^18.0.0", | ||
"eslint": "^8.0.0", | ||
@@ -41,9 +39,6 @@ "eslint-config-prettier": "^8.0.0", | ||
"fastify": "^4.0.0-rc.3", | ||
"husky": "^8.0.0", | ||
"jest": "^26.6.3", | ||
"pinst": "^3.0.0", | ||
"prettier": "^2.2.1", | ||
"tap": "^16.3.0", | ||
"toad-scheduler": "^1.0.2", | ||
"tsd": "^0.20.0", | ||
"typescript": "^4.1.3" | ||
"tsd": "^0.24.1" | ||
}, | ||
@@ -68,7 +63,11 @@ "homepage": "http://github.com/fastify/fastify-schedule", | ||
"index.js", | ||
"index.d.ts" | ||
"types/index.d.ts" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
}, | ||
"pre-commit": [ | ||
"lint", | ||
"test" | ||
] | ||
} |
# @fastify/schedule | ||
![CI](https://github.com/fastify/fastify-schedule/workflows/CI/badge.svg) | ||
[![NPM Version][npm-image]][npm-url] | ||
[![NPM version](https://img.shields.io/npm/v/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule) | ||
[![NPM downloads](https://img.shields.io/npm/dm/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule) | ||
[![Coverage Status](https://coveralls.io/repos/fastify/fastify-schedule/badge.svg?branch=main)](https://coveralls.io/r/fastify/fastify-schedule?branch=main) | ||
@@ -43,4 +44,1 @@ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier) | ||
For more detailed instructions, see the [documentation](https://github.com/kibertoad/toad-scheduler) of `toad-scheduler`. | ||
[npm-image]: https://img.shields.io/npm/v/@fastify/schedule.svg | ||
[npm-url]: https://npmjs.org/package/@fastify/schedule |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10
5350
4
5
31
44
1
+ Added@fastify/pre-commit@^2.0.2
+ Added@fastify/pre-commit@2.1.0(transitive)
+ Addedcross-spawn@7.0.3(transitive)
+ Addedfastify-plugin@4.5.1(transitive)
+ Addedisexe@2.0.03.1.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedwhich@2.0.24.0.0(transitive)
- Removedfastify-plugin@3.0.1(transitive)
Updatedfastify-plugin@^4.0.0