MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
365 stars 49 forks source link

Enable Importing Specific Clients Without Pulling in Dependencies for All Clients #320

Open orisano opened 2 months ago

orisano commented 2 months ago

Dear jira.js maintainers,

First of all, thank you for your hard work on this project. I am currently using the jira.js library in my server-side application. There are four types of clients available: AgileClient, Version2Client, Version3Client, and ServiceDeskClient.

However, I would like to import only the specific client I need. For instance, when I try to import the Version3Client using import { Version3Client } from "jira.js/out/version3/client";, it results in dependencies on all clients from "jira.js/out/clients/index.ts". While tree-shaking could resolve this, I am not using a bundler in my simple server-side program.

Could you please provide a way to import only the specific client needed without pulling in dependencies for all clients? Any guidance or suggestions would be greatly appreciated.

Thank you again for your assistance and for maintaining this useful library.

andwilr commented 1 month ago

I second the great appreciation along with the request!

orisano commented 1 month ago

The change itself is simple; you just need to modify import { BaseClient } from '../../clients'; to import { BaseClient } from '../../clients/baseClient';. You can see it here: https://github.com/MrRefactoring/jira.js/blob/0d76aad0ca74b8f135ae1d3306c71a2fcf312613/src/version3/client/version3Client.ts#L1 What do you think, @MrRefactoring?