Skip to content

Commit

Permalink
Merge pull request awatcloud#1 from whisthub/feature/publish-to-npm
Browse files Browse the repository at this point in the history
feat: add support for `mongodb@6`
  • Loading branch information
sebamarynissen committed Jan 31, 2024
2 parents 16a7e8b + 6cc0685 commit 36e6e18
Show file tree
Hide file tree
Showing 28 changed files with 1,676 additions and 669 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = {
project: './tsconfig.eslint.json'
},
overrides: [
{
files: ['*ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
},
},
{
files: ['*.test.ts'],
env: {
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/docs.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Node.js package

on:
release:
types: [created]

jobs:
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: npm
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm whoami; npm --ignore-scripts publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
21 changes: 9 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Run Test
name: Run tests
on: [push, pull_request, workflow_dispatch]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16, 18]
mongodb-version: [3.6, 4.4, 5.0]
node-version: [18, 20, 21]
mongodb-version: [6.0, 7.0]
steps:
- name: Git checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -23,7 +23,7 @@ jobs:
mongodb-version: ${{ matrix.mongodb-version }}

- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -33,11 +33,8 @@ jobs:
restore-keys: |
${{ runner.os }}-build-agenda-
- name: Update npm
run: npm -g install npm@latest

- name: Install Packages
run: npm install
run: npm ci

- name: Run Lint
run: npm run lint
Expand All @@ -48,6 +45,6 @@ jobs:
CI: true

- name: Test
run: npm run test
run: npm test
env:
CI: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ docs/agenda/*
dist
.nyc_output
coverage
*.tsbuildinfo
2 changes: 1 addition & 1 deletion .mocharc.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"diff": true,
"spec": "./test/*.test.ts",
"require": ["ts-node/register", "source-map-support/register"],
"import": ["tsx/esm"],
"extension": ["js", "ts"],
"package": "./package.json",
"recursive": true,
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# AgendaTS
**DISCLAIMER**: I **do not** intend to actively maintain this repository.
I forked it from https://github.com/hokify/agenda because I desperately needed support for [mongodb@6](https://www.npmjs.com/package/mongodb) for my website www.whisthub.com.
Ideally this gets merged back eventually into [@hokify/agenda](https://github.com/hokify/agenda), or even better in [agenda/agenda](https://github.com/agenda/agenda).

(full typed version of agendaJS)
However, I *do* intend to keep this up to date with the latest version of the [mongodb](https://www.npmjs.com/package/mongodb) package, but that's all.
Agenda is a great library and I would hate to see it dying because new mongodb versions are not supported.

Key differences with the [original repo](https://github.com/hokify/agenda) are:

- MongoDB is now a peer dependency, so it must be installed separately.
- The module is now [esm only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). This is to prepare for any of the dependencies - most notably `mongodb` - becoming esm-only one day too. It also helps push the ecosystem forward.
- The library is only tested against `mongodb@6`, but it should work for version 5 and even 4.

# Agenda

<p align="center">
<img src="https://cdn.jsdelivr.net/gh/hokify/agenda@master/agendats.png" alt="Agenda TS" width="100" height="100">
Expand All @@ -13,7 +24,7 @@ This was originally a fork of agenda.js,
it differs from the original version in following points:

- Complete rewrite in Typescript (fully typed!)
- mongodb4 driver (supports mongodb 5.x)
- [mongodb@6](https://www.npmjs.com/package/mongodb) driver (supports mongodb 5.x and mongodb 4.x too)
- Supports mongoDB sharding by name
- touch() can have an optional progress parameter (0-100)
- Bugfixes and improvements for locking & job processing (concurrency, lockLimit,..)
Expand Down
Loading

0 comments on commit 36e6e18

Please sign in to comment.