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

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

Closed
orisano opened this issue Jul 10, 2024 · 3 comments · Fixed by #343
Closed

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

orisano opened this issue Jul 10, 2024 · 3 comments · Fixed by #343
Assignees
Labels
bug Indicates a reported issue or malfunction that needs fixing.
Milestone

Comments

@orisano
Copy link

orisano commented Jul 10, 2024

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
Copy link

andwilr commented Aug 13, 2024

I second the great appreciation along with the request!

@orisano
Copy link
Author

orisano commented Aug 13, 2024

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:

import { BaseClient } from '../../clients';

What do you think, @MrRefactoring?

@MrRefactoring MrRefactoring self-assigned this Jan 3, 2025
@MrRefactoring MrRefactoring added this to the v4.0.4 milestone Jan 3, 2025
@MrRefactoring MrRefactoring added the bug Indicates a reported issue or malfunction that needs fixing. label Jan 3, 2025
MrRefactoring added a commit that referenced this issue Jan 3, 2025
- Improved the tree shaking process to ensure unused code is properly eliminated across the entire library.
- Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
MrRefactoring added a commit that referenced this issue Jan 4, 2025
- Improved the tree shaking process to ensure unused code is properly eliminated across the entire library.
- Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
@MrRefactoring
Copy link
Owner

Thank you to everyone who participated in this discussion. Special thanks to Nao Yonashiro (@orisano) for proposing the fix. I plan to include this improvement in version 4.0.4.

MrRefactoring added a commit that referenced this issue Jan 4, 2025
* #327: Package `form-data` replaced to `formdata-node` for add esm support (#341)

* #327: Package `form-data` replaced to `formdata-node` for add esm support

* #327: Add `Buffer` type support using `formdata-node` package

- Implemented `Buffer` to `File` conversion for attachment uploads.
- Added `attachment.mimeType` an optional property.
- Added automatic MIME type detection based on file extensions.

* #327: Fixed the issue with the absence of the `File` class in Node.js v18.x.x by using `File` from `formdata-node`.

- Enhanced documentation with TSDoc and examples for better clarity.

* #320: Fix tree shaking mechanism and remove circular dependencies (#343)

- Improved the tree shaking process to ensure unused code is properly eliminated across the entire library.
- Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a reported issue or malfunction that needs fixing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants