@enable-tech/enable-shared-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

enable-shared-types

This package represents the single source of truth of the Types being used in the codebase (front-end and back-end) of enable.tech, It is an organization-scoped package. So, all the development teams belonging to it can participate to enhance it.

Installation

npm i @enable-tech/enable-shared-types

Usage

Right now the package contains the types of front-end apps (5 apps) exported as { CallCenterApp, CentralizedApp, EnableApp, OperationsManagementApp, PublicPagesApp } in "src/index.ts" so if we are working in the centralized app we are going to import CentralizedApp ony from it & access all the exported modules from it { FormModules, ApiModules } in "src/Types/CentralizedApp/index.ts"

Check the screenshot to see an example of how to use it

enable_package

as you can see if you don't remember what is being exported in the CentralizedApp you can easily see what it included by dot notation & the autocomplete for TypeScript will result in 2 results so you can choose which one to use & proceed with destructing what you want to use from it In this example, I logged 2 values of the enum one of them is correct & the other is not just for testing

You can the code snippet directly if you want:

import { CentralizedApp } from '@enable-tech/enable-shared-types';

const {
  FormModules: { Mode },
} = CentralizedApp;

console.log('Mode Enum', Mode.Add); // Correct Enum value

After a new version of the package is published you need to update it through the following command

npm update @enable-tech/enable-shared-types

Contributing

All the development team can contribute you would need to do the following steps

  1. Clone the repo

    git clone https://github.com/EButler-QA/enable-shared-types.git
  2. Install the dependencies

    npm install
  3. If there is a new project we want to add the types of it, it shall be added to This directory 'src/Types' example: All the types of the centralized app (front-end app) are added to this directory 'src/Types/CentralizedApp' and all I want to export from it are included at 'src/Types/CentralizedApp/index.ts' Don't forget to export your new module at this file 'src/index.ts' as it represents the index to the package

    Note: The back-end team & front-end teams are free to propose another architecture for exporting the modules if needed feel free to suggest any new ideas to enhance the package

  4. After adding the new updates to the package you can use the scripts in the package.json file to make sure that everything is working fine before publishing

    • Run the following command to build the project

      npm run prepare
    • Run the following command to make sure that there are no ESlint across the project (If there are any new errors fix them before publishing)

      npm run prepublish

      Note:

      • The rules of ESlint are provided in this file '.eslintrc.cjs' so if you want to add any extra config feel free to do so
      • In the '.eslintrc.cjs' file The following rule
        rules: {
         '@typescript-eslint/no-explicit-any': ['off'],
         },
        is only added because there are explicit 'any' for some of the types that supposed to be typed by the schema of DTOs so once the back-end adds them we are going to remove this rule & follow strict types without 'any'
    • Run the following command to format all files using Prettier & add them to be committed

      npm run version
  5. Provide a new version

    npm version <update_type>

    The version of the package mainly would be represented as major.minor.patch so replace <update_type> with the equivalent example updating the patch would be

    npm version patch
  6. Finally, Publish it 🥳

    npm publish

Author

Mayar Elabbasy

Package Sidebar

Install

npm i @enable-tech/enable-shared-types

Weekly Downloads

4

Version

1.0.7

License

ISC

Unpacked Size

133 kB

Total Files

252

Last publish

Collaborators

  • mayar.elabbasy
  • el-hawary
  • tenx-ebutler