typesense-js
typesense-js copied to clipboard
build: transfer to esbuild for building pipeline
Enhance Typesense JS Library for Improved Usability and Maintainability
What is this?
This pull request introduces several improvements to the Typesense JS library's build system:
- Optimizing the library bundle size by leveraging
esbuildand more specificallytsup. - Improving the library's package structure and exports to provide a more intuitive and user-friendly API.
- Updating the documentation and examples to better guide developers in using the library.
These changes aim to make the Typesense JS library more accessible, efficient, and easier to integrate into web applications.
Changes
Added Features:
-
New
tsupconfiguration intsup.config.ts:- Implemented a
tsupconfiguration to build the library in a more efficient and optimized manner. - The configuration includes support for modern browser targets, minification, and separate module and CommonJS builds.
- This change should result in a smaller bundle size and improved performance for users of the library.
- Implemented a
Code Changes:
-
In
package.json:- Updated the
main,module, andexportsfields to reflect the new build targets and file names. - Added new development dependencies, including
tsup,browserslist-to-esbuild, andesbuild-plugins-node-modules-polyfill, to enable the improved build process. - Updated the primary
buildscript to usetsup. - Add a
preparescript to build before installing new dependencies and publishing to an npm registry.
- Updated the
-
In
src/Typesense/Configuration.ts:- Refactored the
Configurationclass to use theloglevellibrary directly, rather than importing the entire module.
- Refactored the
-
Removing build artifacts:
- Removed build artifacts from source control, as they are built upon push to upstream / build time before publishing to an npm registry.
Documentation Updates:
-
In
README.md:- Updated the installation and usage instructions to reflect the new build target and file names.