-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0904d2f
commit d3f0315
Showing
25 changed files
with
3,566 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,52 @@ | ||
# name: Build rules | ||
# on: | ||
# pull_request: | ||
# | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# ref: ${{ github.ref }} | ||
# - name: Set-up bun | ||
# uses: oven-sh/setup-bun@v1 | ||
# with: | ||
# bun-version: latest | ||
# - name: Install dependencies and build | ||
# run: bun i --frozen-lockfile | ||
# - name: Build | ||
# run: bun run build | ||
name: Build rules | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
|
||
- id: install | ||
name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- id: build | ||
name: Compile the rules | ||
run: yarn build | ||
|
||
deploy_gh_page: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
|
||
- id: install | ||
name: Install dependencies | ||
run: yarn install --immutable && yarn install --immutable --cwd doc | ||
|
||
- id: doc:build | ||
name: Build the documentation | ||
run: yarn doc:build | ||
- name: Deploy | ||
uses: crazy-max/ghaction-github-pages@v3 | ||
with: | ||
target_branch: gh-pages | ||
build_dir: doc/build | ||
jekyll: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
node_modules | ||
.yarn | ||
%PACKAGE_NAME%.model.json | ||
model-template.model.json | ||
index.d.ts | ||
index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Router from "@koa/router" | ||
import Koa from "koa" | ||
import Engine from "publicodes" | ||
import { koaMiddleware as publicodesAPI } from "@publicodes/rest-api" | ||
|
||
import rules from "../model-template.model.json" assert { type: "json" } | ||
|
||
const app = new Koa() | ||
const router = new Router() | ||
|
||
// Create middleware with your Engine | ||
const apiRoutes = publicodesAPI(new Engine(rules)) | ||
|
||
// Basic routes usage (/evaluate, /rules, etc.) | ||
router.use(apiRoutes) | ||
|
||
app.use(router.routes()).listen(3000, () => { | ||
console.log("Server started on http://localhost:3000") | ||
}) |
Oops, something went wrong.