Skip to content

refactor(repo): inline tsdown per-package, lift integration tests to root, consolidate test utils#76

Merged
zrosenbauer merged 3 commits intomainfrom
refactor/repo-tsdown-per-package-and-integration-tests
Mar 17, 2026
Merged

refactor(repo): inline tsdown per-package, lift integration tests to root, consolidate test utils#76
zrosenbauer merged 3 commits intomainfrom
refactor/repo-tsdown-per-package-and-integration-tests

Conversation

@zrosenbauer
Copy link
Member

Summary

  • Remove shared tsdown.base.mjs — inline clean/dts/fixedExtension/outDir options directly into each package's tsdown.config.ts
  • Fix packages/cli bin fielddist/index.mjsdist/index.js (fixedExtension: false + "type":"module" outputs .js, not .mjs)
  • Add tests/exports.test.ts — parameterized it.each test that validates every exports condition and bin entry in each package.json resolves to an actual file on disk after build; prevents export/build drift in future releases
  • Add turbo.json test:exports task with dependsOn: ["^build"] so exports are only checked after all packages are built
  • Lift all integration tests from packages/core/test/integration/tests/integration/ (9 files); move mock-oauth-server helper to tests/helpers/
  • Add tests/helpers/core-utils.ts re-exporting from @kidd-cli/core/test public API
  • Add tests/tsconfig.json with paths: { "@/*": ["../packages/core/src/*"] } for IDE type support; reference from root tsconfig.json
  • Add vitest.exports.config.ts (root) with @ alias → packages/core/src so @/ imports in integration tests resolve correctly
  • Narrow packages/core vitest include to src/**/*.test.ts only (integration tests are now at root)
  • Consolidate setArgv + runTestCli into packages/core/src/test/cli.ts and export from the public @kidd-cli/core/test entry; both core-utils.ts files now just re-export from that single source with no duplication

Test plan

  • pnpm check passes (typecheck + lint + format)
  • pnpm test passes for all packages
  • pnpm test:exports passes after pnpm build

zrosenbauer and others added 2 commits March 17, 2026 18:45
…sts to root

- Remove shared tsdown.base.mjs; inline clean/dts/fixedExtension/outDir into
  each package's tsdown.config.ts directly
- Fix packages/cli bin field: dist/index.mjs → dist/index.js (fixedExtension:
  false + "type":"module" outputs .js, not .mjs)
- Add tests/exports.test.ts with parameterized it.each checks that every
  exports condition and bin entry in each package.json resolves to an actual
  file on disk after build — prevents export/build drift
- Add vitest.exports.config.ts (root) with @ alias → packages/core/src for
  integration tests that use @/ imports
- Add turbo.json test:exports task with dependsOn: ["^build"]
- Add root package.json test:exports script
- Move all integration tests from packages/core/test/integration/ to tests/integration/
- Move mock-oauth-server helper from packages/core/test/helpers/ to tests/helpers/
- Add tests/helpers/core-utils.ts re-exporting from @kidd-cli/core/test public API
- Add tests/tsconfig.json with paths for @/* alias; reference it from root tsconfig.json
- Remove packages/core/test/integration/ and packages/core/test/helpers/ directories
- Narrow packages/core vitest.config.ts include to src/**/*.test.ts only

Co-Authored-By: Claude <noreply@anthropic.com>
…ic test API

Move setArgv and runTestCli from the local test/core-utils.ts shim into
packages/core/src/test/cli.ts and export them from the public @kidd-cli/core/test
entry point. Both test/core-utils.ts (internal) and tests/helpers/core-utils.ts
(root) now simply re-export from the same canonical source with no duplication.

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

🦋 Changeset detected

Latest commit: 3d48d12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@kidd-cli/cli Patch
@kidd-cli/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This PR refactors build configuration and test infrastructure across the monorepo. It removes the shared baseOptions export from tsdown.base.mjs and inlines the configuration directly in each package's tsdown.config.ts. CLI test helpers (setArgv, runTestCli) are relocated from packages/core/test/core-utils.ts to packages/core/src/test/cli.ts with re-exports via packages/core/src/test/index.ts. Test file imports are updated to reference new paths. A new test suite in tests/exports.test.ts validates that exports and bin entries reference existing files. The CLI entry point in packages/cli/package.json changes from .mjs to .js. TypeScript project references are extended to include tests, and new test:exports npm script and turbo task are added with a corresponding vitest.exports.config.ts configuration file.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #4 — Modifies turbo.json task configuration; overlaps with the introduction of the test:exports task in this PR.
  • PR #72 — Modifies shared tsdown configuration and multiple tsdown.config.ts files; directly inverse relationship as this PR removes the shared baseOptions and inlines configurations.
  • PR #69 — Reorganizes core test helper exposure and relocation; directly overlaps with the moving of test utilities from packages/core/test/core-utils.ts to packages/core/src/test/cli.ts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR title references upgrades but the changeset is exclusively a structural refactor (tsdown inlining, test reorganization, consolidation). No dependency version changes are present in the provided summary. The linked issue #39 requires dependency upgrades (tsdown 0.21.0-beta.2→0.21.1, @clack/prompts 1.0.1→1.1.0, etc.). Verify these changes are included in package.json updates or commit them separately.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the three main changes: inlining tsdown configs per-package, lifting integration tests to root, and consolidating test utilities.
Description check ✅ Passed The description comprehensively details the refactoring changes, file movements, and configuration updates across the monorepo with clear sections and test plan.
Out of Scope Changes check ✅ Passed All changes align with stated objectives: tsdown refactoring, test reorganization, vitest config additions, and test utility consolidation. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/repo-tsdown-per-package-and-integration-tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.

OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/test/cli.ts`:
- Around line 3-16: Add JSDoc blocks to the two exported functions: for
setArgv(document that it accepts a rest parameter args: readonly string[] and
returns void) and for runTestCli(document that it accepts options: CliOptions
and returns Promise<void>); place `@param` tags naming the parameter and its
type/description and an `@returns` tag describing the return type (void or
Promise<void>) so the exported functions setArgv and runTestCli meet the
guideline requiring `@param` and `@returns` annotations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 43560a49-c43d-4b8d-a72b-45fd6968b529

📥 Commits

Reviewing files that changed from the base of the PR and between fd0e2d3 and fc39f0e.

📒 Files selected for processing (28)
  • package.json
  • packages/bundler/tsdown.config.ts
  • packages/cli/package.json
  • packages/cli/tsdown.config.ts
  • packages/config/tsdown.config.ts
  • packages/core/src/test/cli.ts
  • packages/core/src/test/index.ts
  • packages/core/test/core-utils.ts
  • packages/core/tsdown.config.ts
  • packages/core/vitest.config.ts
  • packages/utils/tsdown.config.ts
  • tests/exports.test.ts
  • tests/helpers/core-utils.ts
  • tests/helpers/mock-oauth-server.ts
  • tests/integration/advanced-deploy.test.ts
  • tests/integration/advanced-status.test.ts
  • tests/integration/auth-device-code.test.ts
  • tests/integration/auth-http-chain.test.ts
  • tests/integration/auth-oauth-pkce.test.ts
  • tests/integration/simple-greet.test.ts
  • tests/integration/simple-init.test.ts
  • tests/integration/simple-list.test.ts
  • tests/integration/typed-middleware.test.ts
  • tests/tsconfig.json
  • tsconfig.json
  • tsdown.base.mjs
  • turbo.json
  • vitest.exports.config.ts
💤 Files with no reviewable changes (1)
  • tsdown.base.mjs

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