Skip to content

(v1) Internal code sharing strategy#1162

Open
yamcodes wants to merge 4 commits into
v1from
736-internal-code-sharing-strategy
Open

(v1) Internal code sharing strategy#1162
yamcodes wants to merge 4 commits into
v1from
736-internal-code-sharing-strategy

Conversation

@yamcodes

@yamcodes yamcodes commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Fixes #736

This PR consolidates the internal packages @repo/scope and @repo/types into the unified arkenv/internal subpath export. This addresses the version skew risks with ArkType scopes in monorepos while maintaining zero user configuration and strict bundle size constraints.

@yamcodes yamcodes added enhancement New feature or improvement infra Infrastructure related issue or pull request arkenv Changes to the `arkenv` npm package. rfc A proposal open for discussion, inviting feedback before writing code. May or may not land as-is labels Jun 5, 2026
@yamcodes yamcodes linked an issue Jun 5, 2026 that may be closed by this pull request
@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0f9f9bb

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

This PR includes changesets to release 4 packages
Name Type
arkenv Patch
@arkenv/vite-plugin Patch
@arkenv/bun-plugin Patch
@arkenv/nextjs 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

@github-actions github-actions Bot added docs Adds or changes documentation, or acts as documentation in and of itself @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv www Improvements or additions to arkenv.js.org tests This issue or PR is about adding, removing or changing tests @arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv labels Jun 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1162

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1162

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@1162

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1162

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1162

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1162

commit: 0f9f9bb

@arkenv-bot

arkenv-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Package Size Limit Diff Status
@arkenv/bun-plugin 2.4 kB 2.44 kB 0.0%
arkenv 1.73 kB 1.95 kB 0.0%
arkenv/standard 1.01 kB 1.07 kB 0.0%
arkenv/core 441 B 500 B 0.0%
arkenv/internal 154 B 1000 B -
@arkenv/nextjs 1003 B 2.93 kB 0.0%
@arkenv/nextjs/shared 1022 B 1.46 kB 0.0%
@arkenv/nextjs/server 1.06 kB 1.95 kB 0.0%
@arkenv/nextjs/client 1.05 kB 1.95 kB 0.0%
@arkenv/nextjs/config 2.42 kB 2.93 kB 0.0%
@arkenv/vite-plugin 1.91 kB 2.93 kB 0.0%

All size limits passed!

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Two rough edges worth noting — otherwise clean consolidation.

Reviewed changes — consolidates @repo/scope and @repo/types into a new arkenv/internal subpath export, eliminating version-skew risks for ArkType scopes in monorepos.

  • Move scope and types into packages/arkenv/src/internal/ — source files from packages/internal/scope/ and packages/internal/types/ are relocated into the core package's source tree, preserving all tests and type definitions.
  • Add ./internal export to core package — new barrel entry (src/internal.ts) and exports field in package.json expose shared internals via arkenv/internal, with splitting: true in tsdown to deduplicate shared chunks.
  • Update all import paths across plugins@repo/scope and @repo/types imports in arkenv, @arkenv/vite-plugin, @arkenv/bun-plugin, and @arkenv/nextjs are replaced with relative or arkenv/internal imports.
  • Delete the standalone internal workspace packagespackages/internal/scope/ and packages/internal/types/ config files removed; packages/internal/* dropped from pnpm-workspace.yaml.
  • Add ADR 0006 — documents the single-core-with-internal-exports strategy and the wrapper plugin architecture decision.

ℹ️ docs/CONTEXT.md package names don't match current package.json names

The diff renames the core package from arkenv to @arkenv/core and the CLI from @arkenv/cli to arkenv in docs/CONTEXT.md, but neither package.json has been renamed yet. The ADR says "soon to be @arkenv/core" — implying these are aspirational edits. In the meantime, agents and contributors reading CONTEXT.md will see package names that don't exist.

Technical details
# CONTEXT.md package name skew

## Affected sites
- `docs/CONTEXT.md:86` — core package listed as `@arkenv/core` (actual name: `arkenv`)
- `docs/CONTEXT.md:88` — CLI listed as `arkenv` (actual name: `@arkenv/cli`)
- `docs/CONTEXT.md:97` — heading says `@arkenv/core` (actual name: `arkenv`)
- `docs/adr/0006-internal-code-sharing-strategy.md:11` — says "soon to be `@arkenv/core`"

## Required outcome
- Either update CONTEXT.md names to match the current `package.json` names, or defer the CONTEXT.md edit to the actual rename PR.

## Suggested approach
The simplest fix: revert the CONTEXT.md changes in this PR and include them with the package rename PR that makes the names canonical.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • packages/arkenv/src/arktype/README.md:11 (RIGHT) — file not in PR diff

Pullfrog  | Fix it ➔View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@yamcodes

yamcodes commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

this should probably be in v1

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ One minor note — the merge from dev introduces an ADR numbering collision.

Reviewed changes — merged dev into the feature branch (commit 898ae4a), bringing in 38 files including CI workflow updates, new skills, documentation changes, and a dist.test.ts for the core package.

  • Merge dev — routine sync pulling in CI workflows, skills (excalidraw, rename-skill), scripts, and docs
  • Added dist.test.ts — new test verifying built outputs of arkenv, arkenv/standard, and arkenv/core
  • Added docs/adr/0006-branching-and-release-flow.md — new ADR on branching and release strategy from dev

ℹ️ ADR 0006 numbering collision with the merge

The merge from dev introduces docs/adr/0006-branching-and-release-flow.md, but this PR already adds docs/adr/0006-internal-code-sharing-strategy.md. Both files are numbered 0006.

Technical details
# ADR 0006 numbering collision

## Affected sites
- `docs/adr/0006-internal-code-sharing-strategy.md` — added by this PR
- `docs/adr/0006-branching-and-release-flow.md` — introduced by the merge from `dev`

## Required outcome
- One of the two ADRs must be renumbered to a unique sequence number (e.g. `0007`).

## Open questions for the human
- Which ADR should keep `0006`? The PR's internal-code-sharing-strategy ADR was authored first in this branch, but numbering order is typically chronological by merge. If the branching-and-release-flow ADR landed on `dev` first, it should keep `0006` and the PR's ADR should renumber to `0007`.

Pullfrog  | Fix it ➔View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@arkenv-bot

arkenv-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment Jun 5 2026, 10:43 PM (Asia/Almaty)

@yamcodes yamcodes changed the base branch from dev to v1 June 5, 2026 15:57
@yamcodes yamcodes changed the title feat: internal code sharing strategy (v1) Internal code sharing strategy Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv arkenv Changes to the `arkenv` npm package. docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement infra Infrastructure related issue or pull request rfc A proposal open for discussion, inviting feedback before writing code. May or may not land as-is tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal code sharing strategy

1 participant