Skip to content

Commit

Permalink
Merge pull request #22 from saiichihashimoto/readme
Browse files Browse the repository at this point in the history
fix(docs): readme and descriptions
  • Loading branch information
kodiakhq[bot] authored Jan 16, 2024
2 parents f2b2968 + 8bbfc03 commit 9058a9b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
_extends: .github
repository:
name: vercel-cron
description: TODO
description: Vercel Crons for local development
private: false
branches:
- name: main
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Saiichi Hashimoto
Copyright (c) 2024 Saiichi Hashimoto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,39 @@

[![GitHub Sponsors](https://img.shields.io/github/sponsors/saiichihashimoto?style=flat)](https://github.com/sponsors/saiichihashimoto)

TODO
[Vercel Crons](https://vercel.com/docs/cron-jobs) for local development

## Getting Started

```bash
npm install --save-dev vercel-cron
npx vercel-cron
# See the other options!
npx vercel-cron --help
```

Crons will be loaded from your `vercel.json` and ping `localhost:3000`! Your config will be watched and reloaded on changes, so there's no need to restart.

`process.env.CRON_SECRET` will be used to [secure your cron jobs](https://vercel.com/docs/cron-jobs/manage-cron-jobs#securing-cron-jobs). You don't need to provide this any differently than you would `next dev`: we're loading your environment variables the [same way that next does](https://www.npmjs.com/package/@next/env).

## Running alongside server

My favorite is [concurrently](https://www.npmjs.com/search?q=concurrently), but there are many libraries that do this.

`package.json`

```json
{
"scripts": {
"dev": "concurrently npm:dev:*",
"dev:cron": "vercel-cron",
"dev:next": "next dev"
}
}
```

## Differences from Vercel

### Cron Expressions

Under the covers, we're using [croner](https://www.npmjs.com/package/croner), which has slightly different [cron expressions](https://vercel.com/docs/cron-jobs#cron-expressions) than vercel does. Until we can find an exact validation method, vercel's suggestion is to validate expressions against [crontab guru](https://crontab.guru/).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/package.json",
"name": "vercel-cron",
"version": "0.0.0-development",
"description": "TODO",
"description": "Vercel Crons for local development",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/saiichihashimoto"
Expand Down

0 comments on commit 9058a9b

Please sign in to comment.