Fix npm entrypoints for @fedify/astro#701
Fix npm entrypoints for @fedify/astro#701dahlia wants to merge 6 commits intofedify-dev:2.1-maintenancefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Restore the published npm entrypoint contract for @fedify/astro by making tsdown emit dist/*.js and dist/*.d.ts files that match the package metadata again. Add a self-reference regression test that exercises the public API through ESM import and CommonJS require so the packaged entrypoints are validated the way consumers load them. Update CHANGES.md with the packaging fix details. Fixes fedify-dev#699 Assisted-by: Codex:gpt-5.4
There was a problem hiding this comment.
Code Review
This pull request restores the npm entrypoint contract for @fedify/astro by configuring tsdown to emit appropriate file extensions and adding a pretest build step. It also introduces a comprehensive test suite for ESM and CJS compatibility and corrects a typo in the commit skill documentation. Feedback focuses on maintaining strict TypeScript typing in tests by avoiding the use of as never for mocking, as it bypasses the repository's type-safety standards.
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Fixes broken npm entrypoints for @fedify/astro by aligning emitted build artifacts with the paths declared in packages/astro/package.json, and adds coverage to prevent regressions.
Changes:
- Configure
tsdownto emit ESM outputs asdist/*.js+dist/*.d.ts(and CJS as*.cjs+*.d.cts) to match published package metadata. - Add a regression test that self-imports
@fedify/astrovia both ESMimport()and CommonJSrequire()and exercises the public API. - Ensure tests build the package first by adding a
pretestbuild step.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/astro/tsdown.config.ts | Forces output extensions to match package.json module/types/exports entrypoints. |
| packages/astro/src/package.test.ts | Adds runtime regression coverage for ESM import + CJS require self-resolution. |
| packages/astro/package.json | Adds pretest to guarantee dist/ exists before running Node tests. |
| CHANGES.md | Documents the entrypoint contract fix and links the issue/PR. |
| .agents/skills/commit/SKILL.md | Fixes trailer name to Assisted-by in commit skill documentation. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replace the test's `as never` shortcuts with explicit mock helper functions and concrete `FederationFetchOptions` / `APIContext` annotations. This keeps the self-import regression test readable while preserving plain `deno test` in *packages/astro/* and the existing Node packaging checks.
|
@codex review |
|
/gemini review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Code Review
This pull request restores the npm entrypoint contract for the @fedify/astro package by ensuring the build process generates the correct file extensions for both ESM and CommonJS formats. Key changes include updating the tsdown configuration to emit .js/.d.ts for ESM and .cjs/.d.cts for CJS, adding a pretest build requirement, and implementing a new test suite to verify self-referencing imports. The PR also corrects a typo in the AI assistant trailer documentation. I have no feedback to provide.
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Make the mock federation fetch methods await their callback results so the test continues to return Promise<Response> while satisfying Deno's require-await lint rule. Assisted-by: Codex:gpt-5.4
Extend the Astro package regression test to assert that the JavaScript and declaration entrypoints declared in package.json exist on disk. This keeps the test aligned with the original packaging regression so missing type outputs are caught before publication.
|
@codex review |
|
/gemini review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Code Review
This pull request restores the npm entrypoint contract for the @fedify/astro package by ensuring the build process correctly emits .js, .cjs, .d.ts, and .d.cts files. It updates the tsdown configuration to handle these extensions explicitly and adds a new test suite to verify that both ESM and CJS entrypoints function correctly. Additionally, it fixes a typo in the commit skill documentation and adds a pretest script to the package. Feedback was provided regarding the new test file, specifically that the targets array construction could lead to false positive results if certain package.json fields are missing.
Make the Astro package test assert each package.json entrypoint explicitly instead of relying on a cast to string[]. This prevents missing metadata fields from slipping through as false positives while keeping the regression coverage focused on the published package contract.
|
@codex review |
|
/gemini review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Code Review
This pull request restores the npm entrypoint contract for @fedify/astro by configuring tsdown to emit explicit .js/.cjs and .d.ts/.d.cts extensions and adding a pretest build step. A new test suite verifies that both ESM and CJS imports work correctly and that all exported files exist. Additionally, a typo was corrected in the commit skill documentation. Review feedback identified several instances in the changelog where file paths used underscores for italics instead of the asterisks required by the repository's style guide.
Fixes #699
The published
@fedify/astropackage metadata pointed to dist/mod.js and dist/mod.d.ts, but the build was emitting dist/mod.mjs and dist/mod.d.mts. That left packages/astro/package.json advertising npm entrypoints that did not exist in the published package, which could break resolution in Node and Vite consumers.This change restores the expected npm entrypoint contract by updating packages/astro/tsdown.config.ts so the ESM build emits .js and .d.ts outputs again. That brings the generated files back in line with the paths declared in packages/astro/package.json.
It also adds a regression test in packages/astro/src/package.test.ts that self-imports
@fedify/astroand exercises the public API through both ESM import and CommonJS require. The CommonJS path is skipped under Deno so plaindeno testin packages/astro/ still works without extra permissions.CHANGES.md has also been updated.
Tests run:
deno testin packages/astro/pnpm --filter @fedify/astro test