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

Use vite for bundling #214

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
Open

Use vite for bundling #214

wants to merge 15 commits into from

Conversation

Egge21M
Copy link
Collaborator

@Egge21M Egge21M commented Nov 27, 2024

Description

This PR adds vite for bundling and transpiling this library. Vite has become an industry standard, using rollup and esbuild under the hood. tsc is still kept, but only used for type checking and declarations. It also adds a standalone build that is made availabel through jsdelivr.

The PR also changes the build targets to ES2020 (from lowest ES5) and changes some of the export structure. While technically a breaking change, this should not affect downstream, as exports / imports are usually handled by the package manager / bundler.

Changes

  • Added vite and config
  • Changed build commands to use vite
  • Removed es5 target
  • Added standalone build

PR Tasks

  • Open PR
  • run npm run test --> no failing unit tests
  • run npm run format

@Egge21M Egge21M changed the base branch from main to vitest November 27, 2024 11:36
@Egge21M Egge21M changed the title Use vite for bundling [WIP] Use vite for bundling Nov 27, 2024
@Egge21M Egge21M changed the title [WIP] Use vite for bundling Use vite for bundling Dec 20, 2024
@Egge21M Egge21M changed the base branch from vitest to development December 20, 2024 09:02
@Egge21M Egge21M marked this pull request as ready for review December 20, 2024 09:02
@gudnuf
Copy link
Collaborator

gudnuf commented Dec 29, 2024

have you looked at vite library mode. Its probably overkill, but would allow us to create a demo wallet alongside the lib
/src would be the cashu-ts library
/demo would be a demo wallet that imports directly from /src

@Egge21M
Copy link
Collaborator Author

Egge21M commented Dec 30, 2024

have you looked at vite library mode. Its probably overkill, but would allow us to create a demo wallet alongside the lib /src would be the cashu-ts library /demo would be a demo wallet that imports directly from /src

Yes, good idea. This PR actually introduces library mode. I think all the is required to make a dev env work, would be to add a index.html file and reference the lib's index file in there.

Building a simple wallet interface or at least some buttons to test the public API against a local test mint is a good idea IMHO. I also do not think its overkill. It also allows implementers to use their browser as a sort of scratch pad for testing without having to write a test file.

However I think this should be introduced in a separate PR. Where you able to include this PRs output in your projects without any bundling issues @gudnuf ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants