Skip to content
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
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- run: bun install --frozen-lockfile

- run: bun run lint
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun run lint
202 changes: 127 additions & 75 deletions bun.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
"test": "vitest run",
"test:watch": "vitest",
"build": "bun run esbuild.js",
"lint": "bunx prettier src -c",
"lint:fix": "bunx prettier src -w",
"coverage": "vitest run --coverage",
"lint": "bun run prettier src -c",
"lint:fix": "bun run prettier src -w",
"coverage": "bun run vitest run --coverage",
"vt:generate": "bun run esbuild.js && rtgl vt generate --skip-screenshots",
"serve": "bun run esbuild.js && bunx serve -p 3004 .rettangoli/vt/_site"
"serve": "bun run esbuild.js && bunx serve -p 3004 .rettangoli/vt/_site",
"prepare": "husky"
},
"dependencies": {
"immer": "^10.1.1",
Expand All @@ -29,6 +30,8 @@
"devDependencies": {
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"vitest": "^3.2.4"
"husky": "^9.1.7",
"prettier": "^3.7.4",
"vitest": "^4.0.16"
}
}
18 changes: 9 additions & 9 deletions src/RouteEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,48 @@ export default function createRouteEngine(options) {
const { handlePendingEffects } = options;
const init = ({ initialState }) => {
_systemStore = createSystemStore(initialState);
_systemStore.appendPendingEffect({ name: 'render' });
_systemStore.appendPendingEffect({ name: "render" });
handleLineActions();
handlePendingEffects(_systemStore.selectPendingEffects());
_systemStore.clearPendingEffects();
}
};

const selectPresentationState = () => {
return _systemStore.selectPresentationState();
}
};

const selectRenderState = () => {
return _systemStore.selectRenderState();
}
};

const handleAction = (actionType, payload) => {
if (!_systemStore[actionType]) {
return;
}
_systemStore[actionType](payload);
handlePendingEffects(_systemStore.selectPendingEffects())
handlePendingEffects(_systemStore.selectPendingEffects());
_systemStore.clearPendingEffects();
}
};

const handleActions = (actions) => {
Object.entries(actions).forEach(([actionType, payload]) => {
handleAction(actionType, payload);
});
}
};

const handleLineActions = () => {
const line = _systemStore.selectCurrentLine();
if (line && line.actions) {
handleActions(line.actions);
}
}
};

return {
init,
handleAction,
handleActions,
selectRenderState,
selectPresentationState,
handleLineActions
handleLineActions,
};
}
230 changes: 0 additions & 230 deletions src/createTimer.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import createRouteEngine from "./RouteEngine";
// import {
// constructPresentationState,
// constructRenderState,
// } from "./stores/index.js";

export default createRouteEngine;
// export { constructPresentationState, constructRenderState };
1 change: 0 additions & 1 deletion src/schemas/systemState/effects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,3 @@ oneOf:
default: 0
required: [type, timerId, payload, delay]
additionalProperties: false

6 changes: 3 additions & 3 deletions src/schemas/systemState/systemState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ properties:
properties:
resourceId:
type: string
type: object
bgm:
properties:
resourceId:
Expand All @@ -225,7 +224,7 @@ properties:
properties: {}

configuration:
$ref: './configuration.yaml'
$ref: "./configuration.yaml"

historySequence:
type: array
Expand All @@ -235,5 +234,6 @@ properties:
description: History entry
default: []

required: [variables, currentLanguagePackId, historySequence, currentMode, modes]
required:
[variables, currentLanguagePackId, historySequence, currentMode, modes]
additionalProperties: false
Loading