Skip to content

feat: replace package-lock.json with yarn.lock and fix CI #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
}
if (typeof fn !== 'function') { return undefined; }
return fn.apply(caller, evaluateArray(node.arguments, context));
}

case 'ConditionalExpression':
return evaluate(node.test, context)
Expand Down Expand Up @@ -269,7 +270,7 @@
}

// Added functions to inject Custom Binary Operators (and override existing ones)
function addBinaryOp(operator: string, precedence_or_fn: number | binaryCallback, _function: binaryCallback): void {

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^16)

This line has a length of 116. Maximum allowed is 100

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^16)

This line has a length of 116. Maximum allowed is 100

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^18)

This line has a length of 116. Maximum allowed is 100

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^18)

This line has a length of 116. Maximum allowed is 100

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^20)

This line has a length of 116. Maximum allowed is 100

Check warning on line 273 in index.ts

View workflow job for this annotation

GitHub Actions / test (^20)

This line has a length of 116. Maximum allowed is 100
if (_function) {
jsep.addBinaryOp(operator, precedence_or_fn as number);
binops[operator] = _function;
Expand Down
Loading
Loading