Skip to content

Commit

Permalink
init env and add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Aug 28, 2023
1 parent 1da0287 commit 5bee8d2
Show file tree
Hide file tree
Showing 61 changed files with 313 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
3 changes: 2 additions & 1 deletion exercises/06.honeypot/01.problem.basic/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
3 changes: 2 additions & 1 deletion exercises/06.honeypot/01.solution.basic/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
3 changes: 2 additions & 1 deletion exercises/06.honeypot/02.problem.util/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
3 changes: 2 additions & 1 deletion exercises/06.honeypot/02.solution.util/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
2 changes: 1 addition & 1 deletion exercises/06.honeypot/03.problem.provider/README.mdx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Remix Utils
# Honeypot Provider
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Honeypot } from 'remix-utils/honeypot/server'

export const honeypot = new Honeypot({
// 🐨 set this to process.env.TESTING ? undefined : null so it's disabled during tests
// 🐨 set this to process.env.TESTING ? null : undefined so it's disabled during tests
validFromFieldName: null,
})
2 changes: 1 addition & 1 deletion exercises/06.honeypot/03.solution.provider/README.mdx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Remix Utils
# Honeypot Provider
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { type HandleDocumentRequestFunction } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { renderToString } from 'react-dom/server'
import { getEnv } from './utils/env.server.ts'
import { getEnv, init } from './utils/env.server.ts'

init()
global.ENV = getEnv()

type DocRequestArgs = Parameters<HandleDocumentRequestFunction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Honeypot } from 'remix-utils/honeypot/server'

export const honeypot = new Honeypot({
validFromFieldName: process.env.TESTING ? undefined : null,
validFromFieldName: process.env.TESTING ? null : undefined,
})
Loading

0 comments on commit 5bee8d2

Please sign in to comment.