diff --git a/CHANGELOG.md b/CHANGELOG.md index f9acbdd..02c7aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,59 @@ +## [1.4.4](https://github.com/Airfooox/cron-validate/compare/v1.4.3...v1.4.4) (2022-10-12) + + +### Bug Fixes + +* update AWS cloudwatch preset ([f583267](https://github.com/Airfooox/cron-validate/commit/f583267a6c6c18792086160470a98baf5b0e2db7)) + +## [1.4.3](https://github.com/Airfooox/cron-validate/compare/v1.4.2...v1.4.3) (2021-03-31) + + +### Bug Fixes + +* remove import type for backwards compatibility ([3e4d8ab](https://github.com/Airfooox/cron-validate/commit/3e4d8ab37869b2ed2290a9ca6a58a5b3bcc0beaa)) +* **deps:** update dependency yup to v0.32.9 ([#166](https://github.com/Airfooox/cron-validate/issues/166)) ([0193a3f](https://github.com/Airfooox/cron-validate/commit/0193a3f5e767be95c34d80f965c631dab1cf5331)) + +## [1.4.2](https://github.com/Airfooox/cron-validate/compare/v1.4.1...v1.4.2) (2020-12-25) + + +### Bug Fixes + +* **deps:** update dependency yup to v0.32.8 ([#146](https://github.com/Airfooox/cron-validate/issues/146)) ([fc2783d](https://github.com/Airfooox/cron-validate/commit/fc2783dfbdf6488cded93d3e639519c9779b1fec)) + +## [1.4.1](https://github.com/Airfooox/cron-validate/compare/v1.4.0...v1.4.1) (2020-11-21) + + +### Bug Fixes + +* **deps:** update dependency yup to v0.30.0 ([#140](https://github.com/Airfooox/cron-validate/issues/140)) ([5679b0f](https://github.com/Airfooox/cron-validate/commit/5679b0f0310487e98c028444d9f2ca91d87c57fa)) + +# [1.4.0](https://github.com/Airfooox/cron-validate/compare/v1.3.1...v1.4.0) (2020-10-25) + + +### Features + +* add npm-cron-schedule preset ([#124](https://github.com/Airfooox/cron-validate/issues/124)) ([888bfa9](https://github.com/Airfooox/cron-validate/commit/888bfa925eeaf0ebaf1dd350e1acdd81827f18e6)) + +## [1.3.1](https://github.com/Airfooox/cron-validate/compare/v1.3.0...v1.3.1) (2020-08-21) + + +### Bug Fixes + +* fix wrong wildcard ('*') check with lower-/upperLimit ([df8b6f2](https://github.com/Airfooox/cron-validate/commit/df8b6f2be19a803d8927e6b25dd71875b5bc262a)) + +# [1.3.0](https://github.com/Airfooox/cron-validate/compare/v1.2.0...v1.3.0) (2020-08-14) + + +### Bug Fixes + +* try to fix default export ([3a66f3f](https://github.com/Airfooox/cron-validate/commit/3a66f3f8998f58537341bb8233ceb2086c86a9d5)) +* **deps:** update dependency yup to v0.29.3 ([#94](https://github.com/Airfooox/cron-validate/issues/94)) ([0080c06](https://github.com/Airfooox/cron-validate/commit/0080c06a1baaf68d591763aa76ca6e55e412ef60)) + + +### Features + +* Add support for alias ([#85](https://github.com/Airfooox/cron-validate/issues/85)) ([5193dd8](https://github.com/Airfooox/cron-validate/commit/5193dd8eb5f2ef30040d2edca2614e9fbc0c5364)) + # [1.2.0](https://github.com/Airfooox/cron-validate/compare/v1.1.5...v1.2.0) (2020-07-29) diff --git a/README.md b/README.md index 78679b9..d2fb4aa 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ [![typescript](https://camo.githubusercontent.com/56e4a1d9c38168bd7b1520246d6ee084ab9abbbb/68747470733a2f2f62616467656e2e6e65742f62616467652f69636f6e2f547970655363726970743f69636f6e3d74797065736372697074266c6162656c266c6162656c436f6c6f723d626c756526636f6c6f723d353535353535)](https://www.typescriptlang.org/) [![dependencies Status](https://img.shields.io/npm/v/cron-validate)](https://www.npmjs.com/package/cron-validate) -[![dependencies Status](https://david-dm.org/airfooox/cron-validate/status.svg)](https://david-dm.org/airfooox/cron-validate) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +![npm](https://img.shields.io/npm/dw/cron-validate) +[![dependencies Status](https://david-dm.org/airfooox/cron-validate/status.svg)](https://david-dm.org/airfooox/cron-validate) Cron-validate is a cron-expression validator written in TypeScript. The validation options are customizable and cron fields like seconds and years are supported. @@ -74,20 +75,13 @@ The following presets are already defined by cron-validate: - default (see: http://crontab.org/) - npm-node-cron (see: https://github.com/kelektiv/node-cron) - aws-cloud-watch (see: https://docs.aws.amazon.com/de_de/AmazonCloudWatch/latest/events/ScheduledEvents.html) +- npm-cron-schedule (see: https://github.com/P4sca1/cron-schedule) To select a preset for your validation, you can simply do this: ```typescript cron('* * * * *', { - preset: 'npm-node-cron', -}) -``` - -or - -```typescript -cron('* * * * *', { - preset: 'aws-cloud-watch', + preset: 'npm-cron-schedule', }) ``` diff --git a/src/presets.ts b/src/presets.ts index e454df5..3517ba3 100644 --- a/src/presets.ts +++ b/src/presets.ts @@ -74,7 +74,7 @@ export default (): void => { maxValue: 31, }, months: { - minValue: 0, + minValue: 1, maxValue: 12, }, daysOfWeek: { @@ -86,4 +86,47 @@ export default (): void => { maxValue: 2199, }, }) + + registerOptionPreset('npm-cron-schedule', { + // https://github.com/P4sca1/cron-schedule + presetId: 'npm-cron-schedule', + useSeconds: true, + useYears: false, + useAliases: true, + useBlankDay: false, + allowOnlyOneBlankDayField: false, + mustHaveBlankDayField: false, + useLastDayOfMonth: false, + useLastDayOfWeek: false, + useNearestWeekday: false, + useNthWeekdayOfMonth: false, + seconds: { + minValue: 0, + maxValue: 59, + }, + minutes: { + minValue: 0, + maxValue: 59, + }, + hours: { + minValue: 0, + maxValue: 23, + }, + daysOfMonth: { + minValue: 1, + maxValue: 31, + }, + months: { + minValue: 1, + maxValue: 12, + }, + daysOfWeek: { + minValue: 0, + maxValue: 7, + }, + years: { + minValue: 1970, + maxValue: 2099, + }, + }) }