From c7228d15bb876c238f2af01fc8fbecdc0936405c Mon Sep 17 00:00:00 2001 From: Carlos Henrique Bernardes Date: Tue, 18 Nov 2025 21:36:54 -0300 Subject: [PATCH 01/14] refactor: migrate app to typescript and jest --- .gitignore | 8 + .yarnrc.yml | 1 + README.md | 13 +- README.pt-BR.md | 13 +- jest.config.cjs | 21 + package-lock.json | 2572 --------------------- package.json | 20 +- public/analytics.js | 178 ++ public/assets/logo.svg | 68 + public/assets/qr-code.svg | 94 + public/index.html | 363 +++ scripts/copy-static.mjs | 20 + src/app/textReaderApp.ts | 369 +++ src/core/rate.ts | 21 + src/main.ts | 9 + src/utils/storage.ts | 15 + tests/rate-control.test.js | 176 -- tests/rate-control.test.ts | 204 ++ tsconfig.jest.json | 10 + tsconfig.json | 19 + yarn.lock | 4339 ++++++++++++++++++++++++++++++++++++ 21 files changed, 5776 insertions(+), 2757 deletions(-) create mode 100644 .yarnrc.yml create mode 100644 jest.config.cjs delete mode 100644 package-lock.json create mode 100644 public/analytics.js create mode 100644 public/assets/logo.svg create mode 100644 public/assets/qr-code.svg create mode 100644 public/index.html create mode 100644 scripts/copy-static.mjs create mode 100644 src/app/textReaderApp.ts create mode 100644 src/core/rate.ts create mode 100644 src/main.ts create mode 100644 src/utils/storage.ts delete mode 100644 tests/rate-control.test.js create mode 100644 tests/rate-control.test.ts create mode 100644 tsconfig.jest.json create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index c2658d7..6f5bbbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ node_modules/ +dist/ + +.pnp.* +.yarn/* +!.yarn/releases +!.yarn/plugins +!.yarn/sdks +!.yarn/versions diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/README.md b/README.md index 7ac89fe..f282c3d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A modern and responsive web application that converts text to speech, allowing u ## 🎨 Branding -- The official application logo is available at [`assets/logo.svg`](assets/logo.svg) and is used as the in-app badge and site favicon. +- The official application logo is available at [`public/assets/logo.svg`](public/assets/logo.svg) and is used as the in-app badge and site favicon. ## 🚀 How to Use @@ -37,7 +37,7 @@ A modern and responsive web application that converts text to speech, allowing u - **HTML5**: Semantic structure - **CSS3**: Styles with backdrop-filter and gradient support -- **JavaScript**: Application logic +- **TypeScript (ESM)**: Application logic compiled for modern browsers - **Tailwind CSS**: Utility-first CSS framework - **Inline SVG Icons**: Lucide icons embutidos diretamente no markup (sem dependências externas) - **Web Speech API**: Native browser speech synthesis @@ -48,7 +48,7 @@ A modern and responsive web application that converts text to speech, allowing u ## 📈 Analytics & Privacy -- Google Analytics (GA4) and Google Tag Manager now load from the deferred [`analytics.js`](analytics.js) file instead of inline snippets. +- Google Analytics (GA4) and Google Tag Manager now load from the deferred [`analytics.js`](public/analytics.js) file instead of inline snippets. - The script waits for `requestIdleCallback` or the first user interaction (click, key press, pointer/touch) before injecting GA/GTM assets, freeing the critical rendering path while keeping telemetry intact. - The GTM `