0.0.31 • Published 2 years ago

vkg-dice v0.0.31

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Dice

An experimental mix of Dependency Injection and Cerealization (DICE).

Class annotations:

  • @singleton: declares class as singleton, ensuring exactly one instance (if multiple containers exist, they will not share singleton instances)
  • @dice: declares class as non-singleton.

Field injection annotations:

  • @contains: declares the field with a "has-a" relationship, meaning the field will be automatically instantiated (therefore only works for @dice typed fields) when the parent object is instantiated
  • @provides: similar to @contains, but also makes the field accessible to child dices via @requires
  • @requires: declares the field as an external dependency, which will be auto-injected

Serialization can be done by using the Serializer class (get it via @requires or container.resolve(Serializer)):

  • Fields marked as @persistent() will be serialized
  • Fields marked by @contains and @provides will be recursively serialized
  • Fields marked by @required are not serialized, but will be automatically injected upon deserialization
  • Unmarked fields will be ignored
  • Upon serialization, the snapshot() method will be called, if defined. The return value will then be serialized. This gives you the chance to create a custom serialization logic in case the above features are not enough

Development notes

Deployment

run the following:

npm install
npm run build
npm publish

Development

Commands to know:

npm run watch
npm run coverage

Sonar Setup

  • Install SonarLint extension in VS Code
  • Download SonarQube Docker image and run it locally
  • Go to localhost:9000, login as admin/admin, create project named "TDS Engine" and create a token
  • Put the following in your global VS Code settings (not in project settings!):

      "sonarlint.connectedMode.connections.sonarqube": [
        {
          "serverUrl": "http://localhost:9000",
          "token": "XXXXX"
        }
      ],
  • To analyze the project, run (put your password if you changed it):

    sonar-scanner.bat -D"sonar.projectKey=TDS-Engine" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=admin" -D"sonar.password=admin"`

Karma test

npx karma start

0.0.30

2 years ago

0.0.31

2 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

2 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago