Skip to content

Commit

Permalink
version 5 (rewrite) (#84)
Browse files Browse the repository at this point in the history
* Initial TS rewrite

* Add tests for v5

* add negative test

* Add error emitting, more docs

* Update CI and exports

* use valid DNS chars for test redis host

* attempt to use the node container

* test and support older versions of node

* 5.0.0-alpha.0
  • Loading branch information
mike-marcacci authored Jul 25, 2021
1 parent 870778c commit 4e5df01
Show file tree
Hide file tree
Showing 24 changed files with 1,645 additions and 3,758 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
service_name: travis-ci
service_name: travis-ci
Empty file added .dockerignore
Empty file.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/node_modules
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": [0],
"@typescript-eslint/no-use-before-define": [0],
"@typescript-eslint/no-inferrable-types": [0],
"@typescript-eslint/array-type": [0],
"@typescript-eslint/explicit-function-return-type": [
1,
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true
}
]
},
"plugins": ["@typescript-eslint", "prettier"]
}
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Continuous Integration

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
name: Test with Node.js v${{ matrix.node }} and ${{ matrix.os }}
runs-on: "ubuntu-latest"
container: "node:${{matrix.node}}"
strategy:
matrix:
node: ["12", "14", "16"]
services:
redis-single-instance:
image: redis
redis-multi-instance-a:
image: redis
redis-multi-instance-b:
image: redis
redis-multi-instance-c:
image: redis
steps:
- uses: actions/checkout@v2
- name: Install dependancies
run: yarn install --frozen-lockfile
- name: Lint the source
run: yarn lint
- name: Transpile into dist
run: yarn build
- name: Run tests
run: yarn test
29 changes: 29 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "43 22 * * 6"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ["javascript"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
34 changes: 9 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
.DS_Store
*.sublime-workspace
/dist
/node_modules
/npm-debug.log
/package-lock.json
/yarn-error.log
/yarn.lock

# Redis database
*.rdb
Expand All @@ -14,20 +14,4 @@ pids
lib-cov

# Coverage directory used by tools like istanbul
coverage

# 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 directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# OS Files
.DS_Store
coverage
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/node_modules
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"overrides": [
{
"files": ".ts",
"options": { "parser": "typescript" }
}
]
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ node_js:
- "10"
services:
- redis-server
script: npm run test-ci
script: npm run test-ci
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@
- Stop testing on node version 8. (Due to dev dependency requirements only.)
- Update docs (@ricmatsui via [#80](https://github.com/mike-marcacci/node-redlock/pull/80)).
- Use evalsha for scripts (@yosiat via [#77](https://github.com/mike-marcacci/node-redlock/pull/77)).

## v5.0.0-alpha1

- Complete rewrite using TypeScript.
- **BREAKING** Significant API changes; see [README.md](./README.md)
- **BREAKING** Remove all production dependencies (replacing Bluebird with native promises).
- **BREAKING** Drop support for Node < 12
Loading

0 comments on commit 4e5df01

Please sign in to comment.