Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New architecture for libraries 📖 #125

Open
onmax opened this issue Oct 7, 2020 · 5 comments
Open

New architecture for libraries 📖 #125

onmax opened this issue Oct 7, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request libs under consideration Issue under consideration

Comments

@onmax
Copy link
Member

onmax commented Oct 7, 2020

Motivation

From Alastria we want to facilitate the use of the libraries to the partners and for this we have to facilitate both the architecture of the project and offer the possibility to download the library from a package manager such as npm and yarn. This issue aims to suggest a possible solution by creating a new architecture that simplifies the current architecture of the project and that follows the library patterns of npm and yarn.

Objective

The intention is to have a single repository that contains all the libraries. Three libraries will be published (npm / yarn) with the following names:

  • alastria-id-tokens-factory
  • alastria-id-tx-factory
  • alastria-id-tx-signer

Implications

If this change is made, it will have several consequences:

  1. Simplification of the library and therefore, greater maintainability and readability. It will divide the library into three; dividing each library into: types, src and tests.
  2. It will offer the possibility for developers to use ST types and interfaces. This will help in the future if we decide to create a library called '@types/alastria' with the types and interfaces of everything as many of the popular libraries do: '@types/moment' or '@types/angular' as an example. This suggestion, is discarded for the moment, but it would be interesting to study it in the future, once we have the libraries ready.
  3. This change will break everything and we will have to warn the library users if they don't want to update their current implementation. Also, users will not need to git clone to make use of the library and npm install or yarn install will be used. The example repository will also need to be changed.

Architecture

│   ├── tx-signer
│   │   ├── src
│   │   │    │── ....
│   │   │    └──
│   │   ├── test
│   │   │    │── ....
│   │   │    └──
│   │   ├── types
│   │   │    │── ....
│   │   │    └──
│   │   ├── dist
│   │   │    │── ....
│   │   │    └──
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── package-lock.json
│   │   ├── README.md
│   │   └── tsconfig.json
│   ├── tokens-factory
│   │   ├── src
│   │   │    │── ....
│   │   │    └──
│   │   ├── test
│   │   │    │── ....
│   │   │    └──
│   │   ├── types
│   │   │    │── ....
│   │   │    └──
│   │   ├── dist
│   │   │    │── ....
│   │   │    └──
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── package-lock.json
│   │   ├── README.md
│   │   └── tsconfig.json
│   └── tx-factory
│   │   ├── src
│   │   │    │── ....
│   │   │    └──
│   │   ├── test
│   │   │    │── ....
│   │   │    └──
│   │   ├── types
│   │   │    │── ....
│   │   │    └──
│   │   ├── dist
│   │   │    │── ....
│   │   │    └──
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── package-lock.json
│   │   ├── README.md
│   │   └── tsconfig.json
└── README.md

Explanation:

  • .github and .gitignore: It will be a single configuration for the whole project. The /dist folders will not be uploaded to Github.
  • libs: Folder with three subfolders. Each subfolder will be one of the libraries (tokens-factory, tx-factory and id-tx-signer (old UserIdentity)). The content of these folders will be the one that will be published in three different libraries in npm and yarn. They will always have the same files and the same folders in the first level:
    • LICENSE: Library license
    • package.json: Scripts and library information.
    • package-lock.json: Dependencies
    • tsconfig.json: TS Transponder Configuration
    • dist: they will only be in npm and yarn because it is the build that the user will work with. This folder will be automatically created from the configuration in tsconfig.json. This folder will NOT be in GitHub.
    • src: Implementing the Library
    • test
    • types: Types and interfaces

🐱

@onmax onmax added enhancement New feature or request libs labels Oct 7, 2020
@onmax onmax self-assigned this Oct 7, 2020
@msalitu
Copy link

msalitu commented Oct 7, 2020

¡Por mi parte adelante! Excelente trabajo @onmax y @VictorNS69

@DrankoLQ
Copy link
Contributor

DrankoLQ commented Oct 7, 2020

Tiene muy buena pinta chicos, ¡muy buen trabajo! 🙂

@JuanLuisGozaloFdez
Copy link

por mi parte adelante.
Please, remind that...
All the information must be written in English to allow wider disemination of the Alastria Open Source Code repositories.

@DrankoLQ
Copy link
Contributor

DrankoLQ commented Oct 7, 2020

That's right Juan Luis.

By the way, as far as I know, there's no need to create a @types/alastria module to support TypeScript, we just need to add a index.d.ts file in each library to have types

@onmax onmax changed the title Nueva arquitectura para librerías 📖 New architecture for libraries 📖 Oct 8, 2020
@onmax
Copy link
Member Author

onmax commented Oct 8, 2020

Please, remind that...
All the information must be written in English to allow wider disemination of the Alastria Open Source Code repositories.

Done!

@VictorNS69 VictorNS69 pinned this issue Oct 16, 2020
@onmax onmax mentioned this issue Oct 16, 2020
10 tasks
@ghost ghost unpinned this issue May 28, 2021
@VictorNS69 VictorNS69 pinned this issue Oct 29, 2021
@VictorNS69 VictorNS69 added the under consideration Issue under consideration label Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libs under consideration Issue under consideration
Projects
None yet
Development

No branches or pull requests

5 participants