Skip to content

Add boolean type conversion support for environment variables#144

Closed
Copilot wants to merge 8 commits intomainfrom
copilot/fix-87
Closed

Add boolean type conversion support for environment variables#144
Copilot wants to merge 8 commits intomainfrom
copilot/fix-87

Conversation

Copy link
Contributor

Copilot AI commented Sep 11, 2025

  • Add boolean type conversion support for environment variables
  • Added comprehensive boolean parsing with direct boolean validator
  • Added test coverage for boolean conversions
  • Fix workspace dependencies: use numbered versions in examples, move new features to playground
  • Reverted examples to use numbered versions (arkenv@0.6.0, @arkenv/vite-plugin@0.0.9)
  • Removed examples from pnpm-workspace.yaml
  • Moved boolean functionality demo to playground for unpublished features
  • Updated basic example to only use published features
  • Export boolean type directly in scope to enable direct "boolean" schema usage
  • Added tests for direct boolean usage in createEnv and scope
  • Removed string.boolean support per feedback - only direct "boolean" usage is supported
  • Updated playground and tests to use only direct boolean usage

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@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 13, 2025 6:09am

@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2025

⚠️ No Changeset found

Latest commit: 2d8f698

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Copilot AI changed the title [WIP] Feature Request: Support Boolean Type Conversion for ark.env Add boolean type conversion support for environment variables Sep 11, 2025
Copilot AI requested a review from yamcodes September 11, 2025 05:14
@github-actions github-actions bot added arkenv Changes to the `arkenv` npm package. example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) tests This issue or PR is about adding, removing or changing tests labels Sep 11, 2025
},
"dependencies": {
"arkenv": "^0.5.0",
"arkenv": "workspace:*",
Copy link
Owner

Choose a reason for hiding this comment

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

This should be numbered not workspace:*, for workspace dependencies we have a playground folder. @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand the preference for numbered versions in examples, but there's a circular dependency issue: the basic example now demonstrates the new string.boolean functionality I added in this PR, which isn't published yet (still in version 0.6.0).

Should I:

  1. Remove the boolean example from the basic example and use numbered versions
  2. Keep workspace:* for examples that demonstrate new unpublished features
  3. Create separate examples for published vs unpublished features

Which approach would you prefer?

},
"dependencies": {
"arkenv": "^0.5.0",
"arkenv": "workspace:*",
Copy link
Owner

Choose a reason for hiding this comment

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

This should be numbered not workspace:*, for workspace dependencies we have a playground folder. @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8d4df91. Reverted to numbered versions (arkenv@0.6.0) and moved new boolean functionality demo to playground folder.

Comment on lines 11 to 13
"dependencies": {
"@arkenv/vite-plugin": "^0.0.8",
"arkenv": "^0.5.0",
"@arkenv/vite-plugin": "workspace:*",
"arkenv": "workspace:*",
Copy link
Owner

Choose a reason for hiding this comment

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

This should be numbered not workspace:*, for workspace dependencies we have a playground folder. @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8d4df91. Reverted to numbered versions (arkenv@0.6.0, @arkenv/vite-plugin@0.0.9) and moved new boolean functionality demo to playground folder.

packages:
- 'packages/*'
- 'apps/*'
- 'examples/*'
Copy link
Owner

Choose a reason for hiding this comment

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

NO @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8d4df91. Removed examples from pnpm-workspace.yaml as requested.

Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
string: type.module({
...type.keywords.string,
host,
boolean,
Copy link
Owner

Choose a reason for hiding this comment

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

I'd probably just export it in the boolean module, so that we can use:

import arkenv from "arkenv";

const env = arkenv({
	HOST: "string.host",
	PORT: "number.port",
	NODE_ENV: "'development' | 'production' | 'test' = 'development'",
	SOME_FLAG: "boolean",
});

// Automatically validate and parse process.env
// TypeScript knows the ✨exact✨ types!
console.log(env.HOST); // (property) HOST: string
console.log(env.PORT); // (property) PORT: number
console.log(env.NODE_ENV); // (property) NODE_ENV: "development" | "production" | "test"
console.log(env.SOME_FLAG); // (property) SOME_FLAG: boolean

export default env;

And in an options we should be able to turn off this coercion behvaior (morphed by default)

@copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented in 85a643a. The boolean type is now exported directly in the scope, so you can use both:

const env = arkenv({
  SOME_FLAG: "boolean",          // Direct usage
  DEBUG_MODE: "string.boolean",  // Still available
});

Both approaches provide the same boolean coercion functionality (accepting "true", "false", "1", "0", "yes", "no", "on", "off"). Added comprehensive test coverage and updated the playground to demonstrate both usage patterns.

Copy link
Owner

Choose a reason for hiding this comment

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

We don't need "string.boolean" @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed string.boolean support as requested. Now only direct "boolean" usage is available. All tests updated and passing (2d8f698).

…ew features to playground

Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Copilot AI requested a review from yamcodes September 13, 2025 05:42
Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
Co-authored-by: yamcodes <2014360+yamcodes@users.noreply.github.com>
@yamcodes
Copy link
Owner

Closed in favor of #218.

@yamcodes yamcodes closed this Oct 12, 2025
@yamcodes yamcodes deleted the copilot/fix-87 branch November 12, 2025 17:57
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. example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) tests This issue or PR is about adding, removing or changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants