Giter Site home page Giter Site logo

brouberol / 5esheets Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 7.0 8.95 MB

Visualize and update your D&D 5e character sheets in your browser

License: MIT License

Python 42.12% CSS 5.98% HTML 20.32% JavaScript 2.80% Makefile 1.77% Dockerfile 0.47% Mako 0.11% TypeScript 25.55% Shell 0.31% PEG.js 0.57%
dnd5e ttrpg dungeons-and-dragons

5esheets's Introduction

Screenshot 2023-05-01 at 17 54 02

5esheets's People

Contributors

brouberol avatar dependabot[bot] avatar etnbrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

5esheets's Issues

Run the SQL migrations at application startup

Right now, the alembic.ini file isn't included in the Docker image, and migrations are left as an exercise to the user. We need to include the config file, and make sure the migrations are run fully automatically at startup.

Setup a CSS preprocessor

Whether we use SASS or LESS is left to @etnbrd to decide <3 Once a decision has been made, we should make sure to integrate it in the build step.

Implement client-side authentication

Now that the authentication mechanism is implemented backend-side (see #100), we need to make sure the 5esheet generated API client supports it. Namely, we need to:

  • have the user fill a username/password form
  • send them via a POST request to /api/login/token, which (if the username/password are correct) will return set-cookie headers containing the JWT access token, as well as a CSRF token
  • send the JWT access token any subsequent request cookies, as well as the content of the CSRF cookie in the X-CSRF-TOKEN header

Implement the spellbook part of the character sheet

We need to implement the spell book part of the character sheet, allowing us to list all the spells the character knows, the spells they have prepared for you spell DC, the number of prepared spells per day etc.

Replace caribou by Alembic

Let’s replace Caribou by alembic to enable the automatic generation of migrations as the SQLAlchemy models evolve.

Replace flask by FastAPI

This will allow us to use asynchronous API handlers, in turn allowing us to serve many requests with little horse power.

Render the markdown content of text fields, and allow their edition

The way this worked in the previous, vanilla-JS app, was:

  • each text field that contained markdown was actually invisible, and doubled up by a div containing the rendered markdown content (rendered via https://github.com/markedjs/marked)
  • when the focusin event was triggered, the div was hidden, and the text field was shown
  • after edition, when the focusout event was triggered, the text field was hidden, and the div was shown

The trick was to make the text field part of the overall form, but not the div. This allowed us to evaluate and render mini macros, such as @int_mod on the fly, and not have the rendered value be saved to DB at the next form submit.

Make sure that the JWT comes from the cookies

This will make sure that the token isn't stored in the browser's localStorage and thus be exposed to the outside world. By having the cookie be httponly, we will also restrict the JS code from accessing it.

We could/should replace our semi-custom JWT implementation by https://indominusbyte.github.io/fastapi-jwt-auth/usage/jwt-in-cookies/

This will also make sure that the client can authenticate transparently, as the backend will answer with a set-cookie HTTP Response header.

Replace peewee by SQLAlchemy

We need to replace peewee by SQLAlchemy to support asynchronous queries (and thus asynchronous API request handling) in the future.

Migrate from click to typer

Click comes along with Flask, when typer is provided by Fastapi. We need to convert the flask db populate command from click to typer.

Import all spells to database

The same way we have imported items to database, we should import all the non-spells along with their translations, so that we can easily link the spell book of one character to actual spell references in the database. This should make it easier for players to add spells to their spell book.

Define a model for items/equipment

This model will be used to represent items hold / equipped by a character. New homebrew items could be created, and we'll need to import the SRD 5e items.

Import SRD 5e items to database

As 5e SRD items are now Creative Commons and that the OGL is no longer in jeopardy, we can safely import them to database for further use by the player.

Effect unit tests tests are failing

$ NODE_ENV=prod npm run test                                                                                                                                          12:04:43 PM

> test
> vitest --run


 RUN  v0.32.4 /Users/br/code/5esheets/dnd5esheets/front

 ✓ src/effects/parser/index.test.ts (10)
 ❯ src/effects/index.test.ts (18)
   ❯ apply effect (18)
     ✓ applies a static effect
     ✓ applies a derived effect
     × applies a derived effect which updates from its dependency
     ✓ applies a nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a deeply nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a non-computed nested derived effect
     × applies a non-computed nested derived effect which updates from its dependency
     ✓ applies a non-computed deeply nested derived effect
     × applies a non-computed deeply nested derived effect which updates from its dependency
     ✓ applies an effect containing a function
     ✓ applies a derived effect containing a function
     × applies a derived effect containing a function which updates from its dependency
     × applies a somewhat complex effect which updates from its dependency
     × applies a somewhat complex effect on a nested target which updates from its dependency
     × applies a nested derived effect on a sibling target which updates from its dependency
     ↓ applies a derived effect containing a function which updates from its dependency [skipped]

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 9 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:40:25
     38|       setContext("a", 2);
     39|       expect(context.a).toBe(2);
     40|       expect(context.b).toBe(context.a);
       |                         ^
     41|     }));
     42|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:35:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:55:25
     53|       applyEffect("b := nested.a", context, setContext);
     54|       setContext("nested", "a", 2);
     55|       expect(context.b).toBe(context.nested.a);
       |                         ^
     56|     }));
     57|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:51:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:74:25
     72|       applyEffect("b := deeply.nested.a", context, setContext);
     73|       setContext("deeply", "nested", "a", 2);
     74|       expect(context.b).toBe(context.deeply.nested.a);
       |                         ^
     75|     }));
     76|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:68:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a non-computed nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:89:25
     87|       applyEffect("b := nested[key]", context, setContext);
     88|       setContext("nested", "a", 2);
     89|       expect(context.b).toBe(context.nested.a);
       |                         ^
     90|     }));
     91|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:85:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a non-computed deeply nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:112:25
    110|       applyEffect("b := nested[key_][key__]", context, setContext);
    111|       setContext("nested", "a_", "a__", 2);
    112|       expect(context.b).toBe(context.nested.a_.a__);
       |                         ^
    113|     }));
    114|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:104:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a derived effect containing a function which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:134:25
    132|       applyEffect("b := id(a)", context, setContext);
    133|       setContext("a", 2);
    134|       expect(context.b).toBe(context.a);
       |                         ^
    135|     }));
    136|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:130:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a somewhat complex effect which updates from its dependency
AssertionError: expected 3 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 3

 ❯ src/effects/index.test.ts:150:25
    148|       );
    149|       setContext("nested", "a", 2);
    150|       expect(context.d).toBe(4);
       |                         ^
    151|     }));
    152|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:138:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[7/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a somewhat complex effect on a nested target which updates from its dependency
AssertionError: expected 3 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 3

 ❯ src/effects/index.test.ts:167:32
    165|       );
    166|       setContext("nested", "a", 2);
    167|       expect(context.effect.d).toBe(4);
       |                                ^
    168|     }));
    169|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:154:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[8/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect on a sibling target which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:179:32
    177|       applyEffect("nested.d := nested.a", context, setContext);
    178|       setContext("nested", "a", 2);
    179|       expect(context.nested.d).toBe(context.nested.a);
       |                                ^
    180|     }));
    181|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:171:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[9/9]⎯

 Test Files  1 failed | 1 passed (2)
      Tests  9 failed | 18 passed | 1 skipped (28)
   Start at  12:06:33
   Duration  506ms (transform 91ms, setup 0ms, collect 193ms, tests 20ms, environment 414ms, prepare 111ms)

`npm run test` fails to run `src/effects/index.test.ts`

Running npm run test fails to run the tests defined in src/effects/index.test.ts:

$ npm run test
> test
> vitest --run


 RUN  v0.32.4 /Users/br/code/5esheets/dnd5esheets/front

 ✓ src/effects/parser/index.test.ts (10)
 ❯ src/effects/index.test.ts (18)
   ❯ apply effect (18)
     × applies a static effect
     × applies a derived effect
     × applies a derived effect which updates from its dependency
     × applies a nested derived effect
     × applies a nested derived effect which updates from its dependency
     × applies a deeply nested derived effect
     × applies a nested derived effect which updates from its dependency
     × applies a non-computed nested derived effect
     × applies a non-computed nested derived effect which updates from its dependency
     × applies a non-computed deeply nested derived effect
     × applies a non-computed deeply nested derived effect which updates from its dependency
     × applies an effect containing a function
     × applies a derived effect containing a function
     × applies a derived effect containing a function which updates from its dependency
     × applies a somewhat complex effect which updates from its dependency
     × applies a somewhat complex effect on a nested target which updates from its dependency
     × applies a nested derived effect on a sibling target which updates from its dependency
     ↓ applies a derived effect containing a function which updates from its dependency [skipped]

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a static effect
TypeError: Cannot read properties of undefined (reading 'registerGraph')
 ❯ Module.createStore node_modules/solid-js/store/dist/dev.js:213:9

 ❯ src/effects/index.test.ts:21:37
 ❯ src/effects/index.test.ts:11:7
 ❯ updateFn node_modules/solid-js/dist/dev.js:180:17
 ❯ runUpdates node_modules/solid-js/dist/dev.js:800:17
 ❯ Module.createRoot node_modules/solid-js/dist/dev.js:185:12
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:20:5
...

However the tests are run when defining NODE_ENV=prod.

Spec out an effect system

The goal here is to come up with a proof of concept or a spec of a system that would allow users to define effects, whether they would apply on items, spells equipment or something else, and have that effect be evaluated at runtime.

For example, we could define an armour with an effect of add +3 to your AC, and how the AC is calculated, its score, etc, will all be dynamically evaluated.

Let's figure out the syntax of that system, and its limits

Clean up CSS

The CSS I started with was a compiled version of a SASS codebase. I could remove a lot of useless style by adding some components (score block, rounded box, etc).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.