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

WIP: feat: runtime config support for detectBrowserLanguage #2576

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Nov 25, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Primary motivation for adding runtime support is to actually to merge more test files πŸ˜‚. Most if not all code for detectBrowserLanguage is used at runtime, so there is no need to rebuild the project to test each options.

nitrojs/nitro#1831 allows us to override runtime configs objects with environment variables, as this is currently not possible.

This PR changes the @nuxt/test-utils code further, startServer now optionally accepts additional environment variables. And I added helper functions to make setting runtime config variables via environment variables easier.

Using the following in a test

  await setRuntimeConfig({
    public: {
      i18n: {
        detectBrowserLanguage: false
      }
    }
  })

Will be converted into NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE=false and restarts the server with all properties in the passed object.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede marked this pull request as draft November 26, 2023 00:11
@BobbieGoede BobbieGoede changed the title feat: runtime config support for detectBrowserLanguage WIP: feat: runtime config support for detectBrowserLanguage Dec 1, 2023
@BobbieGoede BobbieGoede force-pushed the feature/runtime-config-detect-browser-language-2 branch 5 times, most recently from 4a90c66 to 1c428e4 Compare December 1, 2023 11:24
@BobbieGoede BobbieGoede force-pushed the feature/runtime-config-detect-browser-language-2 branch from 1c428e4 to d689ee0 Compare January 8, 2024 16:49
@BobbieGoede
Copy link
Collaborator Author

Replaced by #2824

@BobbieGoede BobbieGoede closed this Mar 1, 2024
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