Skip to content

refactor: source the API origin from @canup/contracts (single constant) - #29

Merged
cescox merged 1 commit into
mainfrom
refactor/single-url-constant
Jun 26, 2026
Merged

cescox merged 1 commit into
mainfrom
refactor/single-url-constant

Conversation

@cescox

@cescox cescox commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The default API origin (https://canup.link) was defined in three places under two names — DEFAULT_API_URL in cli/constants.ts, an inline DEFAULT_API_URL in ui/internal/api-client.ts, and DEFAULT_CANUP_URL in @canup/contracts. This collapses them to one definition.

  • Both packages now import { DEFAULT_CANUP_URL } from '@canup/contracts' and use it directly; the CLI also takes API_VERSION from there.
  • cli/constants.ts is deleted (both its exports now live in the contract); the inline ui const is gone.
  • Bumps @canup/contracts to ^0.2.1, the release that adds the constants.

One canonical origin, no drift between client and contract. Net −5 lines.

Verification

test (358 cli + 115 ui), lint, typecheck, build — all green. No DEFAULT_API_URL or hardcoded origin remains in source.

Both packages defined their own DEFAULT_API_URL ('https://canup.link').
Import the canonical DEFAULT_CANUP_URL (and API_VERSION) from
@canup/contracts instead and delete the local copies (cli/constants.ts and
the inline ui const) — one definition, no drift. Bumps the contract
dependency to 0.2.1, which adds the constants.
@github-actions

Copy link
Copy Markdown

Coverage Report for @canup/ui (packages/ui)

Status Category Percentage Covered / Total
🔵 Lines 98.38% (🎯 95%) 183 / 186
🔵 Statements 98.07% (🎯 95%) 204 / 208
🔵 Functions 98.07% (🎯 95%) 51 / 52
🔵 Branches 96.06% (🎯 85%) 122 / 127
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ui/src/internal/api-client.ts 93.33% 100% 100% 91.66% 24
Generated in workflow #41 for commit 9f3e508 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown

Coverage Report for @canup/cli (packages/cli)

Status Category Percentage Covered / Total
🔵 Lines 98.9% (🎯 95%) 1082 / 1094
🔵 Statements 98.68% (🎯 95%) 1125 / 1140
🔵 Functions 98.46% (🎯 95%) 193 / 196
🔵 Branches 92.45% (🎯 85%) 515 / 557
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/cli/src/api-client.ts 98.03% 95.23% 100% 97.87% 195
packages/cli/src/auth/perform-login.ts 100% 83.33% 100% 100%
Generated in workflow #41 for commit 9f3e508 by the Vitest Coverage Report Action

@cescox
cescox merged commit 81796be into main Jun 26, 2026
8 checks passed
@cescox
cescox deleted the refactor/single-url-constant branch June 26, 2026 10:31
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