Skip to content

Commit

Permalink
refc!: use new store, cleanup old files
Browse files Browse the repository at this point in the history
- rewrite the store to implement the new interface, introduced in express-rate-limit v6
- rewrite the tests for the new store
- add `locations` and `config` options
- require the `del`, `get, `set`, `add`, `incr` and `decr` functions on any memcached client passed to the store.
- store expiry time in new key `${prefix}expiry:${key}`.

- update readme to reflect new changes.

- bump all dependencies, to latest major versions
- use husky, lint staged, prettier and jest
- use erl config packages for tsconfig and prettier
- move config files around
- generate esm and cjs bundles using `pkgroll`

- update test matrix and actions versions in ci
  • Loading branch information
gamemaker1 authored Sep 17, 2023
2 parents 2c04518 + c3794cb commit 155a401
Show file tree
Hide file tree
Showing 27 changed files with 12,350 additions and 383 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# /.editorconfig
# Tells most editors what our style preferences are
# https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
indent_size = tab
tab_width = 2

[*.{ts,json,md}]
indent_style = tab

[*.yaml]
indent_style = spaces
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# /.gitattributes
# Makes sure all line endings are LF

* text=auto eol=lf
73 changes: 73 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# /.github/workflows/ci.yaml
# GitHub actions workflow

name: CI

on: [push, pull_request]

jobs:
lint:
name: Lint
strategy:
matrix:
node-version: [lts/*]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Lint code
run: |
npm ci
npm run lint
test:
name: Test
strategy:
matrix:
node-version: [lts/gallium, lts/*, latest]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Run tests
run: |
npm ci
npm run test:lib
publish:
name: Publish
needs: [lint, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build package to upload to GitHub releases
run: |
npm pack
mv rate-limit-memcached-*.tgz rate-limit-memcached.tgz
- name: Create a Github release
uses: softprops/action-gh-release@v1
with:
files: rate-limit-memcached.tgz
body:
You can view the changelog
[here](https://github.com/express-rate-limit/rate-limit-memcached/blob/main/changelog.md).
17 changes: 15 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
/package-lock.json
/lib
# /.gitignore
# Tells Git to ignore these files

node_modules/
dist/
coverage/
test/external/**/package-lock.json

.vscode/
.idea/

*.log
*.tmp
*.bak
*.tgz
11 changes: 0 additions & 11 deletions .npmignore

This file was deleted.

6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .npmrc
# Configuration for npm and pnpm

# Uses the exact version instead of any within-patch-range version of an
# installed package
save-exact=true
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# /.prettierignore
# Tells Prettier to ignore these files

package.json
package-lock.json
pnpm-lock.yaml

# The following is copied over from .gitignore

node_modules/
dist/
coverage/
test/external/**/package-lock.json

.vscode/
.idea/

*.log
*.tmp
*.bak
*.tgz
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

20 changes: 0 additions & 20 deletions MIT-LICENSE

This file was deleted.

73 changes: 0 additions & 73 deletions README.md

This file was deleted.

4 changes: 4 additions & 0 deletions config/husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run pre-commit
8 changes: 0 additions & 8 deletions index.js

This file was deleted.

12 changes: 12 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"verbose": true,
"preset": "ts-jest/presets/default-esm",
"collectCoverage": true,
"collectCoverageFrom": ["source/**/*.ts"],
"testTimeout": 30000,
"testMatch": ["**/test/**/*-test.[jt]s?(x)"],
"moduleFileExtensions": ["js", "jsx", "json", "ts", "tsx"],
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
}
}
20 changes: 20 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# MIT License

Copyright 2023 Tomohisa Oda, Nathan Friedly, and Vedant K

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.
Loading

0 comments on commit 155a401

Please sign in to comment.