Skip to content

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

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

chore: replace react-native-dotenv with transform-inline-environment-variables#7646
Rohit3523 wants to merge 2 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

    • Improved environment-based behavior so end-to-end test notifications and Storybook activation occur only when explicitly enabled with the value true.
    • Updated environment variable handling for more predictable configuration across development and testing.
  • 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 Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9cc0818f-44e9-4b2a-8d7e-b2d814489b6a

📥 Commits

Reviewing files that changed from the base of the PR and between 431f6ea and 0916cad.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • app/containers/InAppNotification/index.tsx
  • app/externalModules.d.ts
  • babel.config.js
  • index.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:

  • index.js
  • app/containers/InAppNotification/index.tsx
  • babel.config.js
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:

  • index.js
  • app/containers/InAppNotification/index.tsx
  • babel.config.js
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 (4)
babel.config.js (1)

6-6: LGTM!

package.json (1)

22-22: LGTM!

Also applies to: 196-196

index.js (1)

9-9: LGTM!

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'.

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

Merge Risk: ⚪ Minimal · up to 20a4b

Environment configuration now uses build-time inlining for the two supported flags, with Storybook activation and E2E notification timing enabled only for the explicit value 'true'. No merge-blocking risk remains.

Suggested labels: type: chore

Suggested reviewers: diegolmello, otaviostasiak

🚥 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

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.

1 participant