-
Notifications
You must be signed in to change notification settings - Fork 451
feat(astro,nuxt,react-router,tanstack-react-start): Env-var to suppress dev keys warning #8402
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f7e9f93
feat(astro,nuxt,react-router,tanstack-react-start,shared): Add env-va…
jacekradko e92b2e0
fix: preserve dev keys warning env precedence
jacekradko aa44f47
Merge branch 'main' into jacek/suppress-dev-keys-warning-env-vars
jacekradko 29c7a2b
Merge branch 'main' into jacek/suppress-dev-keys-warning-env-vars
jacekradko 34e4626
test(integration): remove flaky M2M dynamic-scope test
jacekradko bf3cfc4
Revert "test(integration): remove flaky M2M dynamic-scope test"
jacekradko 5990d02
Merge branch 'main' into jacek/suppress-dev-keys-warning-env-vars
jacekradko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| '@clerk/astro': minor | ||
| '@clerk/nuxt': minor | ||
| '@clerk/react-router': minor | ||
| '@clerk/tanstack-react-start': minor | ||
| '@clerk/shared': patch | ||
| --- | ||
|
|
||
| Add an env-var shortcut for `unsafe_disableDevelopmentModeConsoleWarning` across the Astro, Nuxt, React Router, and TanStack Start integrations so the development-keys console warning can be suppressed without threading the option through `<ClerkProvider>` manually: | ||
|
|
||
| - Astro: `PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING` | ||
| - Nuxt: `NUXT_PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING` | ||
| - React Router: `VITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING` (or `CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING`) | ||
| - TanStack Start: `VITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING` (or `CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING`) | ||
|
|
||
| The Next.js equivalent (`NEXT_PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING`) already existed; the JSDoc on `unsafe_disableDevelopmentModeConsoleWarning` now lists every framework's env-var shortcut and clarifies that suppressing the warning at source also keeps it from being mirrored to the dev-server terminal (e.g. Next.js with `experimental.browserDebugInfoInTerminal`). |
19 changes: 19 additions & 0 deletions
19
packages/astro/src/internal/__tests__/merge-env-vars-with-params.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { afterEach, describe, expect, it, vi } from 'vitest'; | ||
|
|
||
| import { mergeEnvVarsWithParams } from '../merge-env-vars-with-params'; | ||
|
|
||
| describe('mergeEnvVarsWithParams', () => { | ||
| afterEach(() => { | ||
| vi.unstubAllEnvs(); | ||
| }); | ||
|
|
||
| it('preserves an explicit unsafe_disableDevelopmentModeConsoleWarning false when env is true', () => { | ||
| vi.stubEnv('PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING', 'true'); | ||
|
|
||
| const result = mergeEnvVarsWithParams({ | ||
| unsafe_disableDevelopmentModeConsoleWarning: false, | ||
| }); | ||
|
|
||
| expect(result.unsafe_disableDevelopmentModeConsoleWarning).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ges/tanstack-react-start/src/__tests__/unsafeDisableDevelopmentModeConsoleWarning.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { RequestState } from '@clerk/backend/internal'; | ||
| import { afterEach, describe, expect, it, vi } from 'vitest'; | ||
|
|
||
| import { mergeWithPublicEnvs, pickFromClerkInitState } from '../client/utils'; | ||
| import { getResponseClerkState } from '../server/utils'; | ||
|
|
||
| const createRequestState = (): RequestState => | ||
| ({ | ||
| domain: undefined, | ||
| isSatellite: false, | ||
| publishableKey: 'pk_test_xxx', | ||
| proxyUrl: undefined, | ||
| signInUrl: undefined, | ||
| signUpUrl: undefined, | ||
| toAuth: () => ({}), | ||
| }) as RequestState; | ||
|
|
||
| describe('unsafe_disableDevelopmentModeConsoleWarning', () => { | ||
| afterEach(() => { | ||
| vi.unstubAllEnvs(); | ||
| }); | ||
|
|
||
| it('preserves an explicit false from the initial state when public env is true', () => { | ||
| vi.stubEnv('VITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING', 'true'); | ||
|
|
||
| const result = mergeWithPublicEnvs({ | ||
| unsafe_disableDevelopmentModeConsoleWarning: false, | ||
| }); | ||
|
|
||
| expect(result.unsafe_disableDevelopmentModeConsoleWarning).toBe(false); | ||
| }); | ||
|
|
||
| it('hydrates the unprefixed env value from server state', () => { | ||
| vi.stubEnv('CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING', 'true'); | ||
|
|
||
| const clerkInitialState = getResponseClerkState(createRequestState()); | ||
| const pickedState = pickFromClerkInitState(clerkInitialState.__internal_clerk_state); | ||
| const result = mergeWithPublicEnvs(pickedState); | ||
|
|
||
| expect(result.unsafe_disableDevelopmentModeConsoleWarning).toBe(true); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.