Skip to content

Arkenv default export#147

Merged
yamcodes merged 3 commits intomainfrom
arkenv-default-export
Sep 12, 2025
Merged

Arkenv default export#147
yamcodes merged 3 commits intomainfrom
arkenv-default-export

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Sep 11, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a default import alias: import arkenv from "arkenv" for improved IDE autocomplete. Existing named imports (e.g., createEnv) continue to work.
  • Documentation

    • Added usage guidance demonstrating the new default-import pattern.
  • Chores

    • Bumped package version to 0.0.1.

- Changed the default export to a variable `arkenv` for better readability.
- Maintained the export of `createEnv` and `type` for continued access to the API.
- Improved structure of exports to enhance code organization.
- Fixed default export alias in docs
- Added code example for clarity
- Ensured backward compatibility
@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2025

🦋 Changeset detected

Latest commit: 827bd66

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

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

@vercel
Copy link

vercel bot commented Sep 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Sep 11, 2025 8:02pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Walkthrough

The default export of the arkenv module changes to an alias named arkenv, while keeping createEnv as a named export. The index export surface is narrowed to explicit exports. A changeset entry documents the patch. package.json adds a new root-level version field.

Changes

Cohort / File(s) Summary of changes
Release notes / changeset
\.changeset/clever-dryers-drum.md
Adds patch release note describing default export aliasing to arkenv and example usage; notes backward compatibility.
arkenv export surface
packages/arkenv/src/index.ts
Replaces wildcard re-exports with explicit exports; imports createEnv, defines const arkenv = createEnv, sets arkenv as default export; keeps named export createEnv; re-exports type only; retains export type { EnvSchema }.
Metadata
package.json
Adds root-level "version": "0.0.1"; adjusts trailing comma to accommodate new property.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Arkenv default export" is concise and directly reflects the primary change described in the PR (the module's default export is changed to an arkenv alias), and it matches the provided raw_summary and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I nibble on bits where exports roam,
Renaming the default, I tidy our home.
createEnv still hops by my side,
arkenv leads as our default guide.
Version tag tucked—small, neat, bright,
Patch-day carrots, code just right. 🥕

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch arkenv-default-export

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.

❤️ Share

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

@github-actions github-actions bot added docs Improvements or additions to documentation arkenv Changes to the `arkenv` npm package. labels Sep 11, 2025
Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
package.json (1)

38-39: Avoid adding a root-level version in a Changesets monorepo.

Root "version" is unused by Changesets and can cause confusion or unintended bumps. Recommend removing it.

Apply:

-	},
-	"version": "0.0.1"
+	}
.changeset/clever-dryers-drum.md (1)

1-26: Note potential export-surface change or clarify that only an alias changed.

If export * removals narrow the public API, this is breaking and may warrant a minor (per your pre-1.0 policy). Otherwise, explicitly state that no exports (besides the default alias) changed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87225fc and 827bd66.

📒 Files selected for processing (3)
  • .changeset/clever-dryers-drum.md (1 hunks)
  • package.json (1 hunks)
  • packages/arkenv/src/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use built-in validators (host, port, url, email, etc.) when available in environment schemas
Provide default values for optional environment variables in schemas

Files:

  • packages/arkenv/src/index.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: yamcodes
PR: yamcodes/arkenv#136
File: .changeset/vast-bananas-win.md:2-3
Timestamp: 2025-09-10T19:35:18.144Z
Learning: The arkenv package is currently in v0.x.x (pre-1.0) development phase, where breaking changes are acceptable in minor version bumps according to semantic versioning conventions.
🧬 Code graph analysis (2)
.changeset/clever-dryers-drum.md (2)
packages/arkenv/src/index.test.ts (6)
  • arkenv (66-69)
  • process (41-51)
  • expect (27-30)
  • beforeEach (15-98)
  • process (81-97)
  • process (53-63)
packages/arkenv/src/create-env.ts (1)
  • createEnv (24-34)
packages/arkenv/src/index.ts (3)
packages/arkenv/src/create-env.ts (1)
  • createEnv (24-34)
packages/arkenv/src/index.test.ts (8)
  • beforeEach (15-98)
  • process (41-51)
  • process (81-97)
  • process (53-63)
  • expect (27-30)
  • expectTypeOf (32-39)
  • arkenv (66-69)
  • createEnv (74-77)
packages/vite-plugin/src/index.test.ts (1)
  • __esModule (8-12)
🔇 Additional comments (3)
package.json (1)

1-40: Verify root version & release pipeline.

  • Root package.json has "version": "0.0.1" (package.json:39) and a "release" script: "pnpm run build:packages && changeset publish".
  • Workspace packages are independently versioned (packages/arkenv@0.6.0, packages/vite-plugin@0.0.9).
  • Confirm Changesets config and CI publish only workspace packages and do not rely on the root version; if the root version is accidental, remove or set to a neutral placeholder.
packages/arkenv/src/index.ts (2)

3-8: LGTM on default export alias; keeps named export for BC.

The aliasing pattern is clear and DX-friendly, while preserving createEnv as a named export.


1-9: Narrowed re-exports are safe for this repo — no internal consumers found.
Scanned packages/arkenv/src/index.ts and the repository for imports/uses of 'arkenv'; no code references symbols other than createEnv, type, or EnvSchema, and package.json exports point to ./dist/*.

@yamcodes yamcodes merged commit 2ec4daa into main Sep 12, 2025
8 checks passed
@yamcodes yamcodes deleted the arkenv-default-export branch September 12, 2025 06:22
@github-actions github-actions bot mentioned this pull request Sep 12, 2025
yamcodes pushed a commit that referenced this pull request Sep 12, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## arkenv@0.7.0

### Minor Changes

- #### `EnvSchema` type now always uses ArkEnv scope
_[`#149`](#149)
[`02698db`](02698db)
[@yamcodes](https://github.com/yamcodes)_

The `EnvSchema` type has been simplified and fixed to include the ArkEnv
scope.

    Before:

        export type EnvSchema<def, $ = {}> = type.validate<def, $>;

    After:

export type EnvSchema<def> = type.validate<def, (typeof $)["t"]>; //
(Whereas $ is the ArkEnv scope)

    BREAKING CHANGE:

We no longer allow specifying a custom scope in the `EnvSchema` type.

- #### `createEnv` signature simplified
_[`#149`](#149)
[`02698db`](02698db)
[@yamcodes](https://github.com/yamcodes)_

    The `createEnv` function now has a simpler signature:

- No longer uses multiple overloads. Return type now always uses the
ArkEnv scope

    BREAKING CHANGE:

You can no longer rely on `EnvSchema` to type `createEnv` with a custom
scope. Only the ArkEnv scope is supported.

### Patch Changes

- #### Fix default export autocomplete for better developer experience
_[`#147`](#147)
[`2ec4daa`](2ec4daa)
[@yamcodes](https://github.com/yamcodes)_

The default export now properly aliases as `arkenv` instead of
`createEnv`, providing better autocomplete when importing.

For example, in VS Code (and other IDEs that support autocomplete), when
writing the following code:

    ```ts
    // top of file

    const env = arke;
    ```

    Your IDE will now show completion for `arkenv`, resulting in:

    ```ts
    // top of file
    import arkenv from "arkenv";

    const env = arkenv();
    ```

This change maintains full backward compatibility - all existing imports
continue to work unchanged (like `import { createEnv } from "arkenv";`).

- #### Replace Chalk dependency with Node.js built-in `util.styleText`
_[`e6eca4f`](e6eca4f)
[@yamcodes](https://github.com/yamcodes)_

Remove the external `chalk` dependency and replace it with Node.js
built-in `util.styleText`, available [from Node.js
v20.12.0](https://nodejs.org/api/util.html#utilstyletextformat-text-options).
This makes ArkEnv zero-dependency.

## @arkenv/vite-plugin@0.0.10

### Patch Changes

- #### Fix types _[`#149`](#149)
[`02698db`](02698db)
[@yamcodes](https://github.com/yamcodes)_

Fix types in the vite plugin to correctly include all ArkType keywords
as well as custom ArkEnv keywords like `string.host` and `number.port`.

- #### Fix default export autocomplete for better developer experience
_[`#149`](#149)
[`02698db`](02698db)
[@yamcodes](https://github.com/yamcodes)_

The default export now properly aliases as `arkenv` instead of being
anonymous, providing better autocomplete when importing.

For example, in VS Code (and other IDEs that support autocomplete), when
writing the following code:

    ```ts
    import { defineConfig } from "vite";

    // https://vite.dev/config/
    export default defineConfig({
      plugins: [
        arke, // Your cursor is here
      ],
    });
    ```

    Your IDE will now show completion for `arkenv`, resulting in:

    ```ts
    import arkenv from "@arkenv/vite-plugin";
    import { defineConfig } from "vite";

    // https://vite.dev/config/
    export default defineConfig({
      plugins: [
        arkenv(), // Your cursor is here
      ],
    });
    ```

This change maintains full backward compatibility - all existing imports
continue to work unchanged.

<details><summary>Updated 1 dependency</summary>

<small>


[`2ec4daa`](2ec4daa)
[`02698db`](02698db)
[`02698db`](02698db)
[`e6eca4f`](e6eca4f)

</small>

-   `arkenv@0.7.0`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This was referenced Sep 12, 2025
@yamcodes yamcodes mentioned this pull request Jan 1, 2026
@yamcodes yamcodes added this to the v1 milestone Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant