Skip to content

Commit be90da4

Browse files
authored
feat: replace package-lock.json with yarn.lock and fix CI (#4)
1 parent e3ae2c8 commit be90da4

File tree

9 files changed

+6905
-7115
lines changed

9 files changed

+6905
-7115
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"sourceType": "module"
1919
},
2020
"rules": {
21+
"@typescript-eslint/no-explicit-any": "off",
2122
"@typescript-eslint/no-use-before-define": "off",
2223
"@typescript-eslint/no-unused-vars": ["warn", {"argsIgnorePattern": "^_"}],
2324
"quotes": ["warn", "single"],

.github/workflows/ci.yml

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,62 @@
1-
name: CI
1+
name: Node.js CI
22

33
on: [push, pull_request]
44

55
jobs:
6-
build:
7-
6+
test:
87
runs-on: ubuntu-latest
9-
108
strategy:
9+
fail-fast: false
1110
matrix:
12-
node-version: [14.x, 15.x]
11+
node-version: [^16, ^18, ^20]
1312

1413
steps:
15-
- uses: actions/checkout@v2
16-
- name: Use Node.js ${{ matrix.node-version }}
17-
uses: actions/setup-node@v1
18-
with:
19-
node-version: ${{ matrix.node-version }}
20-
- run: npm install
21-
- run: npm run build
22-
- run: npm test
23-
env:
24-
CI: true
14+
- uses: actions/checkout@v2
15+
- name: Use Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
cache: 'yarn'
20+
21+
- run: yarn install
22+
- run: yarn typecheck
23+
- run: yarn lint
24+
- run: yarn build
25+
- run: yarn test
26+
- run: yarn coverage
27+
28+
- name: Coveralls
29+
uses: coverallsapp/github-action@master
30+
with:
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
flag-name: run-${{ matrix.node-version }}
33+
parallel: true
34+
35+
report:
36+
needs: test
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Coveralls Finished
40+
uses: coverallsapp/github-action@master
41+
with:
42+
github-token: ${{ secrets.github_token }}
43+
parallel-finished: true
44+
45+
release:
46+
needs: report
47+
runs-on: ubuntu-latest
48+
if: github.repository == 'node-casbin/expression-eval' && github.event_name == 'push'
49+
steps:
50+
- uses: actions/checkout@v2
51+
- name: Use Node.js
52+
uses: actions/setup-node@v2
53+
with:
54+
node-version: ^20
55+
cache: 'yarn'
56+
57+
- run: yarn install
58+
- run: yarn build
59+
- run: npx -p semantic-release -p @semantic-release/git -p @semantic-release/changelog semantic-release
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function evaluate(_node: jsep.Expression, context: object) {
125125
case 'BinaryExpression':
126126
return binops[node.operator](evaluate(node.left, context), evaluate(node.right, context));
127127

128-
case 'CallExpression':
128+
case 'CallExpression': {
129129
let caller, fn, assign;
130130
if (node.callee.type === 'MemberExpression') {
131131
assign = evaluateMember(node.callee as jsep.MemberExpression, context);
@@ -136,6 +136,7 @@ function evaluate(_node: jsep.Expression, context: object) {
136136
}
137137
if (typeof fn !== 'function') { return undefined; }
138138
return fn.apply(caller, evaluateArray(node.arguments, context));
139+
}
139140

140141
case 'ConditionalExpression':
141142
return evaluate(node.test, context)

0 commit comments

Comments
 (0)