Skip to content

Commit

Permalink
feat: replace package-lock.json with yarn.lock and fix CI (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
tx2002 authored Oct 23, 2024
1 parent e3ae2c8 commit be90da4
Show file tree
Hide file tree
Showing 9 changed files with 6,905 additions and 7,115 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["warn", {"argsIgnorePattern": "^_"}],
"quotes": ["warn", "single"],
Expand Down
68 changes: 53 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
name: CI
name: Node.js CI

on: [push, pull_request]

jobs:
build:

test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [14.x, 15.x]
node-version: [^16, ^18, ^20]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build
- run: npm test
env:
CI: true
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- run: yarn install
- run: yarn typecheck
- run: yarn lint
- run: yarn build
- run: yarn test
- run: yarn coverage

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.node-version }}
parallel: true

report:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

release:
needs: report
runs-on: ubuntu-latest
if: github.repository == 'node-casbin/expression-eval' && github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ^20
cache: 'yarn'

- run: yarn install
- run: yarn build
- run: npx -p semantic-release -p @semantic-release/git -p @semantic-release/changelog semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function evaluate(_node: jsep.Expression, context: object) {
case 'BinaryExpression':
return binops[node.operator](evaluate(node.left, context), evaluate(node.right, context));

case 'CallExpression':
case 'CallExpression': {
let caller, fn, assign;
if (node.callee.type === 'MemberExpression') {
assign = evaluateMember(node.callee as jsep.MemberExpression, context);
Expand All @@ -136,6 +136,7 @@ function evaluate(_node: jsep.Expression, context: object) {
}
if (typeof fn !== 'function') { return undefined; }
return fn.apply(caller, evaluateArray(node.arguments, context));
}

case 'ConditionalExpression':
return evaluate(node.test, context)
Expand Down
Loading

0 comments on commit be90da4

Please sign in to comment.