pax_global_header 0000666 0000000 0000000 00000000064 14343711453 0014517 g ustar 00root root 0000000 0000000 52 comment=1d716245d1a5d2face0be7cc0a793d6778b84c5d
cRonstrue-2.21.0/ 0000775 0000000 0000000 00000000000 14343711453 0013565 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/.editorconfig 0000664 0000000 0000000 00000000223 14343711453 0016237 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8
cRonstrue-2.21.0/.github/ 0000775 0000000 0000000 00000000000 14343711453 0015125 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000025 14343711453 0016737 0 ustar 00root root 0000000 0000000 github: [bradymholt]
cRonstrue-2.21.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14343711453 0017162 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/.github/workflows/build.yml 0000664 0000000 0000000 00000001075 14343711453 0021007 0 ustar 00root root 0000000 0000000 name: Build
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
# Base branches for PR
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 18]
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm install
- name: npm test
run: npm test
env:
CI: true
cRonstrue-2.21.0/.github/workflows/publish.yml 0000664 0000000 0000000 00000003250 14343711453 0021353 0 ustar 00root root 0000000 0000000 name: Publish
on:
workflow_dispatch:
inputs:
version_type:
type: choice
description: Version type
default: minor
options:
- major
- minor
- patch
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: refs/heads/master
- name: Setup git repo
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
git remote add gh-origin https://${GITHUB_ACTOR}:${{secrets.PUBLISH_GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- name: Version
run: |
npm version ${{ github.event.inputs.version_type }} --force -m "Version %s"
- name: Push release commit and tag to GitHub
id: push
run: |
git push gh-origin HEAD:master --tags
echo "::set-output name=tag-name::$(git describe --tags --abbrev=0)"
- name: Publish to npm
run: |
npm set //registry.npmjs.org/:_authToken ${{ secrets.NODE_AUTH_TOKEN }}
npm publish
- uses: actions/upload-artifact@v2
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
- name: Package release assets
run: |
zip assets.zip i18n.js i18n.d.ts
zip -gr assets.zip dist/ locales/
- name: Create a Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.push.outputs.tag-name }}
generate_release_notes: true
files: assets.zip
cRonstrue-2.21.0/.gitignore 0000664 0000000 0000000 00000001355 14343711453 0015561 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
build/
# dist/ # We will commit dist/ so that the packaged module is easily accesible from the repo.
# OS X files
.DS_Store
# Jetbrains IDE
.idea/
/locales
/dist
/.vs
cRonstrue-2.21.0/.tool-versions 0000664 0000000 0000000 00000000017 14343711453 0016407 0 ustar 00root root 0000000 0000000 nodejs 16.14.2
cRonstrue-2.21.0/.vscode/ 0000775 0000000 0000000 00000000000 14343711453 0015126 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/.vscode/launch.json 0000664 0000000 0000000 00000000643 14343711453 0017276 0 ustar 00root root 0000000 0000000 {
"version": "0.2.0",
"configurations": [
{
"name": "Debug Mocha tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": ["-r", "ts-node/register", "./test/**/*.ts"],
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true
}
]
}
cRonstrue-2.21.0/.vscode/settings.json 0000664 0000000 0000000 00000000036 14343711453 0017660 0 ustar 00root root 0000000 0000000 {
"files.exclude": {
}
}
cRonstrue-2.21.0/.vscode/tasks.json 0000664 0000000 0000000 00000000715 14343711453 0017151 0 ustar 00root root 0000000 0000000 {
"version": "2.0.0",
"command": "npm",
"runner": "terminal",
"suppressTaskName": true,
"tasks": [
{
"label": "build",
"type": "npm",
"group": {
"kind": "build",
"isDefault": true
},
"script": "build",
"problemMatcher": "$tsc"
},
{
"label": "test",
"type": "npm",
"group": {
"kind": "test",
"isDefault": true
},
"script": "test"
}
]
}
cRonstrue-2.21.0/CHANGELOG.md 0000664 0000000 0000000 00000000216 14343711453 0015375 0 ustar 00root root 0000000 0000000 To see what has changed in a release version, see the release notes on the [Releases](https://github.com/bradymholt/cRonstrue/releases) page.
cRonstrue-2.21.0/CONTRIBUTING.md 0000664 0000000 0000000 00000001467 14343711453 0016026 0 ustar 00root root 0000000 0000000 Hello there 👋. Are you interested in contributing to this project? If so, it is appreciated!
Adding new i18n translations is always welcome. Referencing previously merged PRs ([like this one](https://github.com/bradymholt/cRonstrue/pull/106)) is a good way to learn what is needed to add a translation.
If you would like to make a non-trivial change to this project, please first discuss the change you wish to make via an issue so that it can be vetted first. Contributions are appreciated but there may be a case where a change would not align with the intended direction of the project and doing work on a PR and then not getting it merged is never fun.
Here are some helpful scripts that should help you get up and running:
- Install dependencies - `npm install`
- Build - `npm start`
- Run Tests - `npm test`
cRonstrue-2.21.0/LICENSE 0000664 0000000 0000000 00000002065 14343711453 0014575 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2017 Brady Holt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
cRonstrue-2.21.0/README.md 0000664 0000000 0000000 00000023255 14343711453 0015053 0 ustar 00root root 0000000 0000000 # cRonstrue  [](https://www.npmjs.com/package/cronstrue)
cRonstrue is a JavaScript library that parses a cron expression and outputs a human readable description of the cron schedule. For example, given the expression "*/5 * * * *" it will output "Every 5 minutes".
This library was ported from the original C# implementation called [cron-expression-descriptor](https://github.com/bradymholt/cron-expression-descriptor) and is also available in a [few other languages](https://github.com/bradymholt/cron-expression-descriptor#ports).
## Features
- Zero dependencies
- Supports all cron expression special characters including * / , - ? L W, #
- Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions
- Supports [Quartz Job Scheduler](http://www.quartz-scheduler.org/) cron expressions
- i18n support with 34 languages
## Demo
A demo is available [here](http://bradymholt.github.io/cRonstrue/#cronstrue-demo).
## Installation
cRonstrue is exported as an [UMD](https://github.com/umdjs/umd) module so it will work in an [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD), [CommonJS](http://wiki.commonjs.org/wiki/CommonJS) or browser global context.
First, install the module:
```
npm install cronstrue
```
Then, depending upon your usage context, add a reference to it:
### Node / CommonJS
```js
const cronstrue = require('cronstrue');
```
### ESM / webpack / TypeScript
```js
import cronstrue from 'cronstrue';
```
### Browser
The `cronstrue.min.js` file from the `/dist` folder in the npm package should be served to the browser. There are no dependencies so you can simply include the library in a `
```
#### CDN
A simple way to load the library in a browser is by using the [unpkg](https://unpkg.com/) CDN, which is a
"fast, global content delivery network for everything on npm". To use it, include a script tag like this in your file:
```html
```
Using the "latest" tag will result in a 302 redirect to the latest version tag so it is recommended to use a specific version tag such as https://unpkg.com/cronstrue@1.48.0/dist/cronstrue.min.js to avoid this redirect.
## Usage
```js
cronstrue.toString("* * * * *");
> "Every minute"
cronstrue.toString("0 23 ? * MON-FRI");
> "At 11:00 PM, Monday through Friday"
cronstrue.toString("0 23 * * *", { verbose: true });
> "At 11:00 PM, every day"
cronstrue.toString("23 12 * * SUN#2");
> "At 12:23 PM, on the second Sunday of the month"
cronstrue.toString("23 14 * * SUN#2", { use24HourTimeFormat: true });
> "At 14:23, on the second Sunday of the month"
cronstrue.toString("* * * ? * 2-6/2", { dayOfWeekStartIndexZero: false });
> "Every second, every 2 days of the week, Monday through Friday"
cronstrue.toString("* * * 6-8 *", { monthStartIndexZero: true });
> "Every minute, July through September"
```
For more usage examples, including a demonstration of how cRonstrue can handle some very complex cron expressions, you can [reference the unit tests](https://github.com/bradymholt/cRonstrue/blob/master/test/cronstrue.ts).
### CLI Usage
```sh
$ npm install -g cronstrue
$ cronstrue 1 2 3 4 5
At 02:01 AM, on day 3 of the month, and on Friday, only in April
$ cronstrue 1 2 3
Error: too few arguments (3): 1 2 3
Usage (5 args): cronstrue minute hour day-of-month month day-of-week
or
Usage (6 args): cronstrue second minute hour day-of-month month day-of-week
or
Usage (7 args): cronstrue second minute hour day-of-month month day-of-week year
```
## Options
An options object can be passed as the second parameter to `cronstrue.toString`. The following options are available:
- **throwExceptionOnParseError: boolean** - If exception occurs when trying to parse expression and generate description, whether to throw or catch and output the Exception message as the description. (Default: true)
- **verbose: boolean** - Whether to use a verbose description (Default: false)
- **dayOfWeekStartIndexZero: boolean** - Whether to interpret cron expression DOW `1` as Sunday or Monday. (Default: true)
- **monthStartIndexZero: boolean** - Wether to interpret January as `0` or `1`. (Default: false)
- **use24HourTimeFormat: boolean** - If true, descriptions will use a [24-hour clock](https://en.wikipedia.org/wiki/24-hour_clock) (Default: false but some translations will default to true)
- **locale: string** - The locale to use (Default: "en")
## i18n
To use the i18n support cRonstrue provides, you can either import all the supported locales at once (using `cronstrue/i18n`) or import individual locales (using `cronstrue/locales/[locale]`). Then, when calling `toString` you pass in the name of the locale you want to use. For example, for the es (Spanish) locale, you would use: `cronstrue.toString("* * * * *", { locale: "es" })`.
### All Locales
You can import all locales at once with `cronstrue/i18n`. This approach has the advantage of only having to load one module and having access to all supported locales. The tradeoff with this approach is a larger module (~130k, minified) that will take longer to load, particularly when sending down to a browser.
```js
// Node / CommonJS
const cronstrue = require('cronstrue/i18n');
// ESM / webpack / TypeScript
import cronstrue from 'cronstrue/i18n';
// Browser
cronstrue.toString("*/5 * * * *", { locale: "fr" }); // => Toutes les 5 minutes
cronstrue.toString("*/5 * * * *", { locale: "es" }); // => Cada 5 minutos
```
### Individual Locales
You can also load the main cronstrue module and then load individual locale modules you want to have access to. This works well when you have one or more locales you know you need access to and want to minimize load time, particularly when sending down to a browser. The main cronstrue module is about 42k (minified) and each locale is about 4k (minified) in size.
```js
// Node / CommonJS
const cronstrue = require('cronstrue');
require('cronstrue/locales/fr');
require('cronstrue/locales/es');
// ESM / webpack / TypeScript
import cronstrue from 'cronstrue';
import 'cronstrue/locales/fr';
import 'cronstrue/locales/es';
// Browser
cronstrue.toString("*/5 * * * *", { locale: "fr" }); // => Toutes les 5 minutes
cronstrue.toString("*/5 * * * *", { locale: "es" }); // => Cada 5 minutos
```
## Frequently Asked Questions
> The cron expression I am passing in is not valid and this library is giving strange output. What should I do?
This library does not do full validation of cron expressions and assumes the expression passed in is valid. If you need to validate an expression consider using a library like [cron-validator](https://www.npmjs.com/package/cron-validator) or [cron-parser](https://www.npmjs.com/package/cron-parser).
> Can cRonstrue output the next occurrence of the cron expression?
No, cRonstrue does not support this. This library simply describes a cron expression that is passed in.
### Supported Locales
- en - English ([Brady Holt](https://github.com/bradymholt))
- ar - Arabic ([Mohamed Nehad Shalabi](https://github.com/mohamednehad450))
- ca - Catalan ([Francisco Javier Barrena](https://github.com/fjbarrena))
- cs - Czech ([hanbar](https://github.com/hanbar))
- es - Spanish ([Ivan Santos](https://github.com/ivansg))
- da - Danish ([Rasmus Melchior Jacobsen](https://github.com/rmja))
- de - German ([Michael Schuler](https://github.com/mschuler))
- fi - Finnish ([Mikael Rosenberg](https://github.com/MR77FI))
- fr - French ([Arnaud TAMAILLON](https://github.com/Greybird))
- fa - Farsi ([A. Bahrami](https://github.com/alirezakoo))
- he - Hebrew ([Ilan Firsov](https://github.com/IlanF))
- it - Italian ([rinaldihno](https://github.com/rinaldihno))
- id - Indonesia ([Hasan Basri](https://github.com/hasanbasri1993))
- ja - Japanese ([Alin Sarivan](https://github.com/asarivan))
- ko - Korean ([Ion Mincu](https://github.com/ionmincu))
- nb - Norwegian ([Siarhei Khalipski](https://github.com/KhalipskiSiarhei))
- nl - Dutch ([TotalMace](https://github.com/TotalMace))
- pl - Polish ([foka](https://github.com/foka))
- pt_BR - Portuguese (Brazil) ([Renato Lima](https://github.com/natenho))
- pt_PT - Portuguese (Portugal) ([POFerro](https://github.com/POFerro))
- ro - Romanian ([Illegitimis](https://github.com/illegitimis))
- ru - Russian ([LbISS](https://github.com/LbISS))
- sk - Slovakian ([hanbar](https://github.com/hanbar))
- sl - Slovenian ([Jani Bevk](https://github.com/jenzy))
- sw - Swahili ([Leylow Lujuo](https://github.com/leyluj))
- sv - Swedish ([roobin](https://github.com/roobin))
- th - Thai ([Teerapat Prommarak](https://github.com/xeusteerapat))
- tr - Turkish ([Mustafa SADEDİL](https://github.com/sadedil))
- uk - Ukrainian ([Taras](https://github.com/tbudurovych))
- zh_CN - Chinese (Simplified) ([Star Peng](https://github.com/starpeng))
- zh_TW - Chinese (Traditional) ([Ricky Chiang](https://github.com/metavige))
- be - Belarusian ([Kirill Mikulich](https://github.com/KirillMikulich))
- hu - Hungarian ([Orcsity Norbert](https://github.com/Northber), Szabó Dániel)
- af - Afrikaans (Michael van Niekerk(https://github.com/mvniekerk))
## License
cRonstrue is freely distributable under the terms of the [MIT license](https://github.com/bradymholt/cronstrue/blob/master/LICENSE).
cRonstrue-2.21.0/RELEASING.md 0000664 0000000 0000000 00000000423 14343711453 0015417 0 ustar 00root root 0000000 0000000 The [.github/workflows/publish.yml](https://github.com/bradymholt/cRonstrue/actions?query=workflow%3A%22Publish+to+npm+Registry%22) GitHub Actions Workflow handling publishing new versions of cRonstrue when a pull request is merged. It can also be run manually at any time.
cRonstrue-2.21.0/bin/ 0000775 0000000 0000000 00000000000 14343711453 0014335 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/bin/cli.js 0000775 0000000 0000000 00000001436 14343711453 0015451 0 ustar 00root root 0000000 0000000 #!/usr/bin/env node
const cronstrue = require('../dist/cronstrue');
function usage() {
console.error("Usage (5 args): cronstrue minute hour day-of-month month day-of-week");
console.error("or")
console.error("Usage (6 args): cronstrue second minute hour day-of-month month day-of-week");
console.error("or")
console.error("Usage (7 args): cronstrue second minute hour day-of-month month day-of-week year");
}
const args = process.argv.slice(2).join(" ");
const argCount = args.trim().split(/\s+/).length;
if (argCount < 5) {
console.error(`Error: too few arguments (${argCount}): ${args}`);
usage()
process.exit(1);
}
if (argCount > 7) {
console.error(`Error: too many arguments (${argCount}): ${args}`);
usage();
process.exit(2);
}
console.log(cronstrue.toString(args));
cRonstrue-2.21.0/bower.json 0000664 0000000 0000000 00000001241 14343711453 0015574 0 ustar 00root root 0000000 0000000 {
"name": "cronstrue",
"description": "Convert cron expressions into human readable descriptions",
"main": "dist/cronstrue.js",
"authors": ["Brady Holt"],
"license": "MIT",
"keywords": [
"cron",
"cronjob",
"crontab",
"schedule",
"parser",
"cron",
"expression",
"cron",
"description",
"pretty",
"cron",
"cron",
"for",
"humans",
"cron",
"translated",
"cron",
"english",
"cron",
"schedule",
"cron",
"english",
"cron",
"schedule"
],
"homepage": "https://github.com/bradymholt/cronstrue",
"ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"]
}
cRonstrue-2.21.0/docs/ 0000775 0000000 0000000 00000000000 14343711453 0014515 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/docs/assets/ 0000775 0000000 0000000 00000000000 14343711453 0016017 5 ustar 00root root 0000000 0000000 cRonstrue-2.21.0/docs/assets/body-bg.jpg 0000664 0000000 0000000 00000004351 14343711453 0020047 0 ustar 00root root 0000000 0000000 JFIF C
C
] TaG:r!ƭe#CDKJYX25BIVHTI4#BUC#Q0ƲXHMD0ЍQBՙ4HZ*bCQUM$6tk5T0*fr4sJf49bMf , !1AQaq"2Bb ? Ufo*r}e3xV/npkDgofO1"/OψN~EُڨAt79u 8b]L ߈AoNYsˎUe]-Lt MeZ|G7a#9\\S˜َT
aoq[ơuE6My'
@?Ӓ1IJ;0̇'KsΗPO"7J}̥^#;[?K358'"cԸ&.KQY!.ɴ1tg<