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 esbuild, tsc and eslint instead of tsdx #134

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

lenkan
Copy link
Collaborator

@lenkan lenkan commented Nov 11, 2023

Resolves #130

This PR removes tsdx in favor of using tsc, eslint, jest directly.

Bundling

tsdx used rollup for bundling. I opted for esbuild which is a more modern bundler and is used by aws-cdk and probably some other big stable projects. Ideally, I would like to avoid bundling altogether and just use tsc to transpile the typescript sources to runnable javascript. However, the dynamic import of blake3 in the ready function caused some issues with this. We can revisit at a later time to simplify this.

npm workspaces

Using npm workspaces to simplify dependency management of the examples/ directory. Read more here https://docs.npmjs.com/cli/v10/using-npm/workspaces. Essentially, now you only need to do npm install in the root directory to get all the dependencies needed to run the scripts and frontend app.

Note that when you install the project from github (.e.g., npm install WebOfTrust/signify-ts#development) you still only get the root dependencies, so no unnecessary dependencies will be installed.

Remove text-encoding package

This repository has been archived since 2018: https://github.com/inexorabletash/text-encoding and caused issues when bundling because of the way the package was imported. This package should not be needed though. The TextEncoder API is supported by all modern browsers and node.js. See: https://caniuse.com/textencoder.

Restructured package export files

Previously, rollup did some magic to bundle all named exports into a default export. This is not supported by most other bundlers as far as I am aware. So I did it manually by gathering all named exports to export.ts, then re-exporting in index.ts while also grouping them as the default export. This ensures no existing code will break. However, we should revisit this as well and reconsider what is exported from the library.

Linting

I added the "recommended" .eslintrc config and just lowered all reported errors to "warning" for now. We should create an issue to resolve the errors. I just did not want this PR to blow up.

Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (370d7b8) 80.97% compared to head (4de1c27) 80.98%.

Files Patch % Lines
src/ready.ts 28.57% 5 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development     #134      +/-   ##
===============================================
+ Coverage        80.97%   80.98%   +0.01%     
===============================================
  Files               42       46       +4     
  Lines             4178     4181       +3     
  Branches          1028     1028              
===============================================
+ Hits              3383     3386       +3     
  Misses             763      763              
  Partials            32       32              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kentbull
Copy link
Contributor

Nice work. I wanted to upgrade to the latest TextEncoder as well. Glad to see this moving forward.

@rodolfomiranda rodolfomiranda merged commit 8b9622a into WebOfTrust:development Nov 16, 2023
4 checks passed
@lenkan lenkan deleted the tsc-2 branch December 4, 2023 09:52
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.

Consider moving away from tsdx
3 participants