Skip to content

refactor(env): read NODE_ENV through the typed env#58

Merged
TheKAdhikari merged 1 commit into
mainfrom
refactor/env-node-env-typed
Jun 20, 2026
Merged

refactor(env): read NODE_ENV through the typed env#58
TheKAdhikari merged 1 commit into
mainfrom
refactor/env-node-env-typed

Conversation

@TheKAdhikari

Copy link
Copy Markdown
Contributor

Summary

constants.ts and store/index.ts read process.env.NODE_ENV directly while the rest of the app already goes through the validated @teispace/env config. This routes them through env.NODE_ENV (the shared group) so the typed, validated env is the single source of truth for runtime config.

Changes

  • src/lib/config/constants.tsisProduction/isDevelopment/isTest now read env.NODE_ENV.
  • src/store/index.tsdevTools toggle reads env.NODE_ENV.

next.config.ts's process.env.ANALYZE is intentionally left raw — it's a build-time toggle, not part of the app's runtime env contract.

Test plan

  • yarn type-check clean
  • yarn lint clean (no new errors)
  • yarn test — 149 tests pass

constants.ts and store/index.ts read process.env.NODE_ENV directly while the
rest of the app already goes through the validated @teispace/env config. Route
them through env.NODE_ENV (shared group) so the typed, validated env is the
single source of truth for runtime config.
@TheKAdhikari

Copy link
Copy Markdown
Contributor Author

⏸️ Blocked on the env publish age gate (resume ~2026-06-21 14:00 UTC).

This PR's CI was failing because @teispace/env@0.2.2 is ESM-only and Next's next.config.ts loader (which now transitively imports the typed env) couldn't require it (ERR_PACKAGE_PATH_NOT_EXPORTED).

That's fixed in @teispace/env@0.2.3 (dual ESM/CJS), published 2026-06-20 13:48 UTC. Verified: a Next 16 app importing @teispace/env/next builds cleanly against 0.2.3.

To land this PR: bump the dep to ^0.2.3 and regenerate the lockfile, then merge. That's blocked right now by Yarn 4.15's npmMinimalAgeGate (1440 min / 24h), which quarantines 0.2.3 until ~2026-06-21 13:48 UTC. After that window, yarn up @teispace/env will resolve it and CI will pass.

@TheKAdhikari TheKAdhikari merged commit 671c261 into main Jun 20, 2026
1 of 2 checks passed
@TheKAdhikari TheKAdhikari deleted the refactor/env-node-env-typed branch June 20, 2026 15:37
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