@openhealth/oht-custom-parser-lib
v0.2.69
Published
Shared nodejs lib with with reusable functions
Downloads
2,436
Keywords
Readme
oht-custom-parser-lib
oht-custom-parser-lib is a shared library designed for use across multiple Node.js cloud functions. It contains common MongoDB connectors and data utilities that can be reused to avoid code duplication and ensure consistency.
Table of Contents
Installation
To install oht-custom-parser-lib, you can add it as a dependency in your project using npm:
npm install oht-custom-parser-libOr, if you want to install a specific version:
npm install oht-custom-parser-lib@<version>Usage
After installing, you can import and use the library in your cloud functions:
const { connectToMongoDB } = require('oht-custom-parser-lib');Development
Patch Versions
When making changes to the oht-custom-parser-lib, you need to update the version number before publishing. Follow these steps:
Update the version number: Use npm's version command to bump the version:
- Patch for bug fixes:
npm version patch - Minor for new features:
npm version minor - Major for breaking changes:
npm version major
This command will automatically update the version in the
package.jsonand create a git tag.- Patch for bug fixes:
Commit Changes: Ensure your changes and the version bump are committed to the repository.
Publish to npm Registry
After updating the version, you can publish the library to the npm registry:
Login to npm (if you haven't already):
npm loginPublish the package:
npm publishIf this is a private package, use:
npm publish --access restrictedVerify the publish: You can check the package on npmjs.com to verify that the new version is available.
Using the Library in Cloud Functions
To use oht-custom-parser-lib in your cloud functions:
Install the Library: Add
oht-custom-parser-libas a dependency in the cloud function'spackage.json:{ "dependencies": { "oht-custom-parser-lib": "^1.0.0" } }Replace
^1.0.0with the appropriate version as needed.Install Dependencies: Run
npm installto install the library along with other dependencies.Deploy Your Function: Deploy your cloud function as usual, ensuring that the updated dependencies are included.
