1.0.7 • Published 5 months ago

dev-utils-library v1.0.7

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

Developer utilities Library

A wide range of utilities and components for developers to use in their projects.

Components

  • Modal

Requirements

Install the following:

  • node >=v17.0.0
  • npm

How to build the library?

Separately

    npm run build   

All together

 npm run build

This builds the components in the "dist" directory.

Code quality

Eslint with the "AirBnB" rules are used for the code.

Testing

Jest is used to test the code. Tests are parallelized by running them in a max of 5 processes to maximize performance.

To run unit tests : npm test

To run specific files: npm test modal

To update snapshots, run: $ npm run test:updateSnapshots

To debug test in a browser, run: npm run test:debug. This will run Jest in a node process. To debug in chrome, open chrome inspector (url : chrome://inspect/#devices). click on "Open Dedicated DevTools for Node". Chorme's DevTools will be displayed.

Use the library as a dependency in any other project

To install this library as a dependency in any other project we need to add it to the package.json directly from github:

"dev-utils-library": "git+https://github.com/SergiioHuertas/devutils.git"
OR
"dev-utils-library": "git+ssh://git@github.com:SergiioHuertas/devutils.git",

npm i

Make jest recognize the library in the project that uses it

For jest to be able to recognize the imports of this library it needs some config in jest.config.js:

moduleNameMapper: {
    '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
    "dev-utils-library/modal": "<rootDir>/node_modules/dev-utils-library/modal/dist/Modal.js",
  },

If you want to avoid having to map every module of the library in this file you can create another file with the mapping of all the modules and use it there.