Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve internal usage of environment variables with prepared env #142

Merged
merged 13 commits into from
Nov 17, 2023

Conversation

alan910127
Copy link
Contributor

Closes #141

Summary

  • Created an exported environment variable access object called env
  • Prepare the types and default values on the env object

Copy link

changeset-bot bot commented Nov 17, 2023

⚠️ No Changeset found

Latest commit: d3ad967

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

Copy link

codesandbox-ci bot commented Nov 17, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

src/env.types.ts Outdated Show resolved Hide resolved
src/env.ts Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
src/env.ts Outdated Show resolved Hide resolved
src/env.types.ts Outdated Show resolved Hide resolved
src/env.types.ts Outdated Show resolved Hide resolved
src/env.types.ts Outdated Show resolved Hide resolved
src/env.types.ts Outdated Show resolved Hide resolved
src/env.types.ts Outdated Show resolved Hide resolved
src/env.ts Outdated Show resolved Hide resolved
@JounQin
Copy link
Member

JounQin commented Nov 17, 2023

image

Sorry you'll need to add a moduleNameMapper for jest:

{
  "moduleNameMapper": {
    "^(\\.{1,2}/.*)\\.js$": "$1"
  }
}

src/env.ts Outdated Show resolved Hide resolved
src/env.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
@JounQin
Copy link
Member

JounQin commented Nov 17, 2023

It's really a great PR, thanks @alan910127 !

@JounQin
Copy link
Member

JounQin commented Nov 17, 2023

By the way, the commit subject should be refactor, it doesn't change any runtime behavior.

@alan910127 alan910127 changed the title feat: improve internal usage of environment variables with prepared env refactor: improve internal usage of environment variables with prepared env Nov 17, 2023
src/utils.ts Outdated Show resolved Hide resolved
@JounQin
Copy link
Member

JounQin commented Nov 17, 2023

Thanks again, and sorry for my nitpicking.

@JounQin JounQin merged commit 2c2db37 into un-ts:main Nov 17, 2023
3 checks passed
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.

Clarify internal usage of environment variables with an exported env variable
2 participants