Skip to content

Commit

Permalink
feat: switch Next SDK to use server and client SDKs (#851)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Norris <jonathan@taplytics.com>
  • Loading branch information
ajwootto and jonathannorris authored May 16, 2024
1 parent 476e69e commit 5493c8b
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 284 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/nx-affected-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
shell: bash
run: yarn affected:e2e
env:
NEXT_PUBLIC_E2E_NEXTJS_KEY: ${{ secrets.NEXT_PUBLIC_E2E_NEXTJS_KEY }}
E2E_NEXTJS_SERVER_KEY: ${{ secrets.E2E_NEXTJS_SERVER_KEY }}
NEXT_PUBLIC_E2E_NEXTJS_CLIENT_KEY: ${{ secrets.NEXT_PUBLIC_E2E_NEXTJS_CLIENT_KEY }}
DVC_E2E_SERVER_SDK_KEY: ${{ secrets.DVC_E2E_SERVER_SDK_KEY }}
- name: Upload Playwright Report
if: always()
Expand Down
11 changes: 6 additions & 5 deletions e2e/nextjs/app-router/app/app/normal/devcycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ export const {
getClientContext,
getAllVariables,
getAllFeatures,
} = setupDevCycle(
process.env.NEXT_PUBLIC_E2E_NEXTJS_KEY ?? '',
async () => {
} = setupDevCycle({
clientSDKKey: process.env.NEXT_PUBLIC_E2E_NEXTJS_CLIENT_KEY ?? '',
serverSDKKey: process.env.E2E_NEXTJS_SERVER_KEY ?? '',
userGetter: async () => {
const reqHeaders = headers()
return {
user_id: '123',
Expand All @@ -17,5 +18,5 @@ export const {
},
}
},
{ enableStreaming: false },
)
options: { enableStreaming: false },
})
11 changes: 6 additions & 5 deletions e2e/nextjs/app-router/app/app/obfuscated/devcycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ export const {
getClientContext,
getAllVariables,
getAllFeatures,
} = setupDevCycle(
process.env.NEXT_PUBLIC_E2E_NEXTJS_KEY ?? '',
async () => {
} = setupDevCycle({
clientSDKKey: process.env.NEXT_PUBLIC_E2E_NEXTJS_CLIENT_KEY ?? '',
serverSDKKey: process.env.E2E_NEXTJS_SERVER_KEY ?? '',
userGetter: async () => {
const reqHeaders = headers()
return {
user_id: '123',
Expand All @@ -17,5 +18,5 @@ export const {
},
}
},
{ enableStreaming: false, enableObfuscation: true },
)
options: { enableStreaming: false, enableObfuscation: true },
})
11 changes: 6 additions & 5 deletions e2e/nextjs/app-router/app/app/streaming/devcycle.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { setupDevCycle } from '@devcycle/nextjs-sdk/server'
const { getVariableValue, getClientContext, getAllVariables, getAllFeatures } =
setupDevCycle(
process.env.NEXT_PUBLIC_E2E_NEXTJS_KEY ?? '',
async () => {
setupDevCycle({
clientSDKKey: process.env.NEXT_PUBLIC_E2E_NEXTJS_CLIENT_KEY ?? '',
serverSDKKey: process.env.E2E_NEXTJS_SERVER_KEY ?? '',
userGetter: async () => {
await new Promise((resolve) => setTimeout(resolve, 2000))
return {
user_id: '123',
}
},
{ enableStreaming: true },
)
options: { enableStreaming: true },
})

export { getVariableValue, getClientContext, getAllVariables, getAllFeatures }
Loading

0 comments on commit 5493c8b

Please sign in to comment.