Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
Airfooox authored Nov 20, 2022
2 parents 62cbb9b + b6963fc commit b2cb92a
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 11 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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',
})
```

Expand Down
45 changes: 44 additions & 1 deletion src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default (): void => {
maxValue: 31,
},
months: {
minValue: 0,
minValue: 1,
maxValue: 12,
},
daysOfWeek: {
Expand All @@ -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,
},
})
}

0 comments on commit b2cb92a

Please sign in to comment.