Skip to content

Commit

Permalink
remove test-react lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwootto committed Oct 24, 2023
1 parent 510a173 commit 6f3fa66
Show file tree
Hide file tree
Showing 24 changed files with 21 additions and 254 deletions.
8 changes: 0 additions & 8 deletions examples/nextjs/app-router/middleware.ts

This file was deleted.

12 changes: 0 additions & 12 deletions lib/test-react/.babelrc

This file was deleted.

18 changes: 0 additions & 18 deletions lib/test-react/.eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions lib/test-react/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions lib/test-react/jest.config.ts

This file was deleted.

3 changes: 0 additions & 3 deletions lib/test-react/package.json

This file was deleted.

50 changes: 0 additions & 50 deletions lib/test-react/project.json

This file was deleted.

1 change: 0 additions & 1 deletion lib/test-react/src/index.ts

This file was deleted.

7 changes: 0 additions & 7 deletions lib/test-react/src/lib/lib-test-react.module.css

This file was deleted.

10 changes: 0 additions & 10 deletions lib/test-react/src/lib/lib-test-react.spec.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions lib/test-react/src/lib/lib-test-react.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions lib/test-react/tsconfig.json

This file was deleted.

23 changes: 0 additions & 23 deletions lib/test-react/tsconfig.lib.json

This file was deleted.

20 changes: 0 additions & 20 deletions lib/test-react/tsconfig.spec.json

This file was deleted.

4 changes: 2 additions & 2 deletions sdk/nextjs/src/client/DevCycleClientProviderClientside.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client'
import type { getDevCycleContext } from '@devcycle/next-sdk/server'
import type { getDevCycleServerData } from '@devcycle/next-sdk/server'
import React, { useEffect, useRef, useState } from 'react'
import { DevCycleClient, initializeDevCycle } from '@devcycle/js-client-sdk'
import { useRouter } from 'next/navigation'
import { updateDVCCookie } from './updateDVCCookie'

type ClientDevCycleContext = Omit<
Awaited<ReturnType<typeof getDevCycleContext>>,
Awaited<ReturnType<typeof getDevCycleServerData>>,
'populatedUser'
>

Expand Down
4 changes: 2 additions & 2 deletions sdk/nextjs/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Use this file to export React server components
export * from './server/identify'
export * from './server/getVariableValue'
export * from './server/context'
export * from './server/devcycleContext'
export * from './server/requestContext'
export * from './server/devcycleServerData'
export * from './server/DevCycleClientProvider'
export * from './server/middleware'
4 changes: 2 additions & 2 deletions sdk/nextjs/src/server/DevCycleClientProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'server-only'
import {
getClient,
getDevCycleContext,
getDevCycleServerData,
identifyInitialUser,
identifyUser,
setClient,
Expand Down Expand Up @@ -35,7 +35,7 @@ export const initialize = async (
await identifyUser(user)
}

const context = await getDevCycleContext()
const context = await getDevCycleServerData()

let client = getClient()
if (!client) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/nextjs/src/server/bucketing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fetchCDNConfig } from './requests'
import { generateBucketedConfig } from '@devcycle/bucketing'
import { getIdentity } from './context'
import { getIdentity } from './requestContext'
import { DVCBucketingUser } from '@devcycle/types'
import { cache } from 'react'
import { DevCycleUser, DVCPopulatedUser } from '@devcycle/js-client-sdk'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getBucketedConfig } from './bucketing'
import { getSDKKey } from './context'
import { getSDKKey } from './requestContext'
import { headers } from 'next/headers'

export const getDevCycleContext = async () => {
export const getDevCycleServerData = async () => {
const { config, user, populatedUser } = await getBucketedConfig()
return {
user,
Expand Down
2 changes: 1 addition & 1 deletion sdk/nextjs/src/server/identify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'server-only'
import { DevCycleUser } from '@devcycle/js-client-sdk'
import { getBucketedConfig } from './bucketing'
import { getClient, getIdentity, setIdentity } from './context'
import { getClient, getIdentity, setIdentity } from './requestContext'
import { getDVCCookie } from './cookie'

/**
Expand Down
23 changes: 0 additions & 23 deletions sdk/nextjs/src/server/middleware.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { cache } from 'react'
import { DevCycleClient, DevCycleUser } from '@devcycle/js-client-sdk'

export const context = <T>(defaultValue: T): [() => T, (v: T) => void] => {
export const requestContext = <T>(
defaultValue: T,
): [() => T, (v: T) => void] => {
const getRef = cache(() => ({ current: defaultValue }))

const getValue = (): T => getRef().current
Expand All @@ -13,15 +15,15 @@ export const context = <T>(defaultValue: T): [() => T, (v: T) => void] => {
return [getValue, setValue]
}

export const [getIdentity, setIdentity] = context<DevCycleUser | undefined>(
undefined,
)
export const [getIdentity, setIdentity] = requestContext<
DevCycleUser | undefined
>(undefined)

export const [getClient, setClient] = context<DevCycleClient | undefined>(
undefined,
)
export const [getClient, setClient] = requestContext<
DevCycleClient | undefined
>(undefined)

const [_getSDKKey, _setSDKKey] = context<string | undefined>(undefined)
const [_getSDKKey, _setSDKKey] = requestContext<string | undefined>(undefined)

export const getSDKKey = () => {
const key = _getSDKKey()
Expand Down
2 changes: 1 addition & 1 deletion sdk/nextjs/src/server/requests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getSDKKey } from './context'
import { getSDKKey } from './requestContext'

const getFetchUrl = () =>
`https://config-cdn.devcycle.com/config/v1/client/${getSDKKey()}.json`
Expand Down
6 changes: 0 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30765,12 +30765,6 @@ __metadata:
languageName: node
linkType: hard

"test-react-ba89f2@workspace:lib/test-react":
version: 0.0.0-use.local
resolution: "test-react-ba89f2@workspace:lib/test-react"
languageName: unknown
linkType: soft

"text-extensions@npm:^1.0.0":
version: 1.9.0
resolution: "text-extensions@npm:1.9.0"
Expand Down

0 comments on commit 6f3fa66

Please sign in to comment.