oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

Draft: Typescript migration

Open thomasvargiu opened this issue 6 months ago • 1 comments

Work In Progress.

This could be the 0.8 release.

Currently, developing on the oref0 repository is very hard for the open source community.
It's hard to understand what variables contain, and there are a lot of javascript errors (undeclared variables, multiple types for the same variables, etc...).

This is the first draft where I've refactored a lot of lib/ scripts in Typescript. This will allow to have types and interfaces for objects, with the opportunity to document them.

Tests

All tests passes, except for the test-autotune-prep in tests/command-behavior.tests.sh. Honestly I can't understand why there is a check for a null value:

cat stdout_output | jq ".CSFGlucoseData | first" | grep -q null || fail_test "oref0-autotune-prep with carbhistory didn't contain expected CSF Glucose Data"

Changes

Some of changes are:

  • refactor a lot of javascript scripts in typescript [not completed]
  • create types for common interfaces [not completed]
  • remove moment, moment-timezone and lodash from dependencies: smaller bundles for apps like (iAPS). iAPS is 50-75% faster
  • add docker environment (with docker compose): this allows to develop without installing dependencies in your host system
  • add VSCode devcontainer devcontainer setup (see CONTRIBUTING.md): just open the project in VSCode, and you will have your development environment without install dependencies in your system
  • added instructions in CONTRIBUTING.md

Future changes

  • complete typescript migration (and remove any where not completely migrated)
  • refactor splitting functions and add unit tests
  • apply decoding of inputs to sanitize and validate them
  • use domain entities transforming external entries
  • refactor script for performance optimization (there are a lot of loops)
  • create useful and faster scripts for loop apps (currently multiple round-trips are necessary)

If you want to contribute, please add a PR to my repository.

thomasvargiu avatar Aug 08 '24 16:08 thomasvargiu