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

Separate tracker build + tests w/ Vite, Turborepo, & Playwright [WIP] #132

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

benvinegar
Copy link
Owner

This is a very large change and is currently in WIP

Up until this point, tracker.js has been a static file sitting in the /public Remix directory.

I want to start modifying it, but to make sure I do not cause regressions, I need to introduce browser-level integration tests that assert its current behavior first.

This change does the following:

  • Introduces Turborepo
  • Moves the Remix app into workspaces/server
  • Starts a new Vite project in workspaces/tracker that builds dist/tracker.js
  • Before its own build script, workspaces/server copies this dist/tracker.js into its public directory
  • Adds Playwright to workspaces/tracker, and adds a simple test that runs a web server that serves an HTML document that loads dist/tracker.js and asserts makes a page view is tracked
  • Changes precommit scripts to use turbo lint, turbo typecheck, etc. which invokes the appropriate command on each workspace

Future considerations:

  • It is now possible for tracker.js to be rewritten in TypeScript, since there is a full Vite build.
  • It should be possible to publish the tracker to npm (e.g. under @counterscale/tracker) and be installed that way (though it needs some work to expose a JS API first).

Still left to do:

  • Verify a fresh install works (i.e. for new users)
  • Update docs
  • Write more Playwright tests

@benvinegar benvinegar force-pushed the turborepo branch 2 times, most recently from 51f2840 to 3f3aacb Compare December 20, 2024 04:20
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.76%. Comparing base (9714546) to head (6b961e9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   78.49%   84.76%   +6.26%     
==========================================
  Files          34       33       -1     
  Lines        2488     2304     -184     
  Branches      266      265       -1     
==========================================
  Hits         1953     1953              
+ Misses        526      343     -183     
+ Partials        9        8       -1     

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

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.

1 participant