Skip to content

chore: replace react-native-dotenv with transform-inline-environment-variables - #7646

Open
Rohit3523 wants to merge 4 commits into
developfrom
chore/replace-react-native-dotenv
Open

Rohit3523 wants to merge 4 commits into
developfrom
chore/replace-react-native-dotenv

Conversation

@Rohit3523

@Rohit3523 Rohit3523 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Proposed changes

Replace react-native-dotenv (@env imports) with babel-plugin-transform-inline-environment-variables, inlining RUNNING_E2E_TESTS and USE_STORYBOOK via process.env. This removes a dependency and aligns the last two truthy env checks (index.js, InAppNotification) with the strict === 'true' pattern already used everywhere else. Also adds --reset-cache to e2e:start (matching storybook:start), since env values are inlined at bundle time.

Issue(s)

https://rocketchat.atlassian.net/browse/NATIVE-1497

How to test or reproduce

  • pnpm install then pnpm start: app boots into the normal app (not Storybook).
  • pnpm storybook:start: Storybook loads.
  • pnpm e2e:start: Metro serves E2E mocks (e.g. longer toast / in-app notification durations, exposed password fields).
  • Verified locally: oxfmt --check clean, tsc --noEmit clean, oxlint shows only one pre-existing exhaustive-deps warning in InAppNotification, jest app/containers/InAppNotification passes (4/4).

Screenshots

N/A (no UI changes).

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

pnpm-lock.yaml is marked -diff in .gitattributes, so it shows as binary in the diff. Besides the expected add/remove of the two babel deps, pnpm install also dropped a stale integrity hash on the git-hosted @rocket.chat/sdk tarball resolution — auto-generated noise, no manual edits to the lockfile. No remaining @env / react-native-dotenv references in code (verified with search).

Summary by CodeRabbit

  • Bug Fixes

    • Environment-based behavior is now more predictable: end-to-end test notifications and Storybook activation occur only when explicitly enabled with the value true.
    • Configuration values are handled consistently across development and testing environments.
  • Chores

    • Development startup now resets the React Native cache, helping ensure configuration changes are applied consistently.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 76aff5b6-c941-488f-a729-881942a9d5c8

📥 Commits

Reviewing files that changed from the base of the PR and between ef08c13 and f9c65e5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • app/containers/InAppNotification/index.tsx
  • app/externalModules.d.ts
  • babel.config.js
  • package.json
💤 Files with no reviewable changes (1)
  • app/externalModules.d.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: E2E Shard Preflight
🧰 Additional context used
📓 Path-based instructions (3)
Format JavaScript and TypeScript code with Oxfmt using the repository configuration: tabs, single quotes, 130-character width, no trailing commas, omitted arrow-function parentheses where possible, and same-line brackets.

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • babel.config.js
  • app/containers/InAppNotification/index.tsx
Use descriptive names for functions, variables, and classes that clearly convey their purpose Write comments that explain the 'why' behind code decisions, not the 'what' Keep functions small and focused on a single responsibility Use const...

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • babel.config.js
  • app/containers/InAppNotification/index.tsx
Use TypeScript for type safety; add explicit type annotations to function parameters and return types Prefer interfaces over type aliases for defining object shapes in TypeScript Use enums for sets of related constants rather than magic str...

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • app/containers/InAppNotification/index.tsx
🔇 Additional comments (3)
babel.config.js (1)

9-9: LGTM!

package.json (1)

22-22: LGTM!

Also applies to: 196-196

app/containers/InAppNotification/index.tsx (1)

41-41: LGTM!


Walkthrough

The change replaces dotenv-based environment handling with build-time variable inlining, strict 'true' checks for Storybook and E2E notification behavior, and React Native cache reset support.

Changes

Environment variable handling

Layer / File(s) Summary
Build-time environment configuration
babel.config.js, package.json, app/externalModules.d.ts
Babel now inlines RUNNING_E2E_TESTS and USE_STORYBOOK. The dotenv plugin and @env declarations are removed. The E2E start script resets the React Native cache.
Runtime environment checks
index.js, app/containers/InAppNotification/index.tsx
Storybook registration and the 5000 ms notification duration now require the corresponding environment variable to equal 'true'.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested labels: type: chore

Suggested reviewers: diegolmello

Merge Risk: ⚪ Minimal · up to f9c65

The migration preserves the supported Storybook and E2E workflows and is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: replacing react-native-dotenv with transform-inline-environment-variables.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.77.0.109582

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.77.0.109591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants