Converted @tryghost/tpl to TypeScript#720
Conversation
This comment was marked as low quality.
This comment was marked as low quality.
a548827 to
6a562dd
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #720 +/- ##
==========================================
- Coverage 98.05% 98.04% -0.01%
==========================================
Files 85 84 -1
Lines 2770 2759 -11
Branches 508 506 -2
==========================================
- Hits 2716 2705 -11
Misses 12 12
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR converts the @tryghost/tpl workspace package from JavaScript to TypeScript and starts publishing generated .d.ts type definitions alongside the compiled JavaScript, while aiming to preserve the existing CommonJS consumption pattern.
Changes:
- Add TypeScript project configuration for
packages/tpl(build + test typecheck). - Replace the implementation entrypoints with TypeScript sources and emit
.js/.d.tsviatsc. - Update package metadata/scripts to build before tests and publish type declarations.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates the lockfile for packages/tpl dev dependency changes (TypeScript + Node types). |
| packages/tpl/vitest.config.ts | Adds per-package Vitest config merged from the repo root configuration. |
| packages/tpl/tsconfig.test.json | Adds a test-specific TS config enabling Node + Vitest global typings. |
| packages/tpl/tsconfig.json | Adds the package TS build configuration extending the shared packages/tsconfig.json. |
| packages/tpl/test/tpl.test.ts | Migrates tests from CommonJS require to ES imports and minor const cleanups. |
| packages/tpl/package.json | Publishes generated .d.ts, adds build/prepare scripts, and adds TS-related dev deps. |
| packages/tpl/lib/tpl.ts | Converts implementation to TypeScript and switches to export = for CJS compatibility. |
| packages/tpl/index.ts | Adds TS entrypoint re-exporting the implementation with export =. |
| packages/tpl/index.js | Removes the committed JS entrypoint (now generated by tsc). |
| packages/tpl/.gitignore | Ignores generated build artifacts (.js, .d.ts, maps) in the package folder. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/tpl/lib/tpl.ts:10
- The exported
tpltype currently restrictsdatavalues tostring, but in-repo callers pass non-string values (e.g. numeric{max}inpackages/validator/lib/validate.js). This makes the new published typings unnecessarily breaking for TypeScript consumers. Widening the value type and explicitly stringifying replacements keeps runtime behavior the same while improving the public typings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I requested a review from Copilot because CodeRabbit didn't work (hit a usage limit). |
no ref This converts `@tryghost/tpl` to TypeScript, and exports type definitions with the package. This should be backwards-compatible.
6a562dd to
d0efb99
Compare
no ref
This converts
@tryghost/tplto TypeScript, and exports type definitions with the package. This should be backwards-compatible.