Skip to content

Commit

Permalink
Update to redwood v8 rc (#51)
Browse files Browse the repository at this point in the history
* update to v8 inc. storybook

* update middleware import

* update module resolution

* resetup ssr

* update prettier tailwind plugin

* lint

* misc type check fixes

* update app.tsx

* update react version

* change react deps
  • Loading branch information
Josh-Walker-GM authored Aug 3, 2024
1 parent cb6349f commit 86686f4
Show file tree
Hide file tree
Showing 29 changed files with 3,981 additions and 4,714 deletions.
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"dependencies": {
"@graphql-yoga/plugin-response-cache": "3.3.0",
"@redwoodjs/api": "8.0.0-canary.529",
"@redwoodjs/api-server": "8.0.0-canary.529",
"@redwoodjs/graphql-server": "8.0.0-canary.529",
"@redwoodjs/api": "8.0.0-rc.1130",
"@redwoodjs/api-server": "8.0.0-rc.1130",
"@redwoodjs/graphql-server": "8.0.0-rc.1130",
"graphql-request": "6.1.0"
}
}
1 change: 1 addition & 0 deletions api/src/services/newsletters/newsletters.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, Newsletter } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.NewsletterCreateArgs>({
Expand Down
4 changes: 2 additions & 2 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"allowJs": true,
"esModuleInterop": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"skipLibCheck": false,
"baseUrl": "./",
"rootDirs": [
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
]
},
"devDependencies": {
"@redwoodjs/cli-data-migrate": "8.0.0-canary.529",
"@redwoodjs/cli-storybook": "8.0.0-canary.529",
"@redwoodjs/core": "8.0.0-canary.529",
"prettier-plugin-tailwindcss": "0.4.1"
"@redwoodjs/cli-data-migrate": "8.0.0-rc.1130",
"@redwoodjs/cli-storybook-vite": "8.0.0-rc.1130",
"@redwoodjs/core": "8.0.0-rc.1130",
"prettier-plugin-tailwindcss": "0.5.12"
},
"eslintConfig": {
"extends": "@redwoodjs/eslint-config",
Expand All @@ -22,7 +22,7 @@
"prisma": {
"seed": "yarn rw exec seed"
},
"packageManager": "yarn@4.1.1",
"packageManager": "yarn@4.3.1",
"dependencies": {
"glob": "^10.3.10",
"node-html-parser": "^6.1.12",
Expand All @@ -32,6 +32,8 @@
"build:icons": "tsx ./scripts/build-icons.mts"
},
"resolutions": {
"@apollo/client-react-streaming/superjson": "^1.12.2"
"@apollo/client-react-streaming/superjson": "^1.12.2",
"react": "19.0.0-beta-04b058868c-20240508",
"react-dom": "19.0.0-beta-04b058868c-20240508"
}
}
6 changes: 2 additions & 4 deletions prettier.config.js → prettier.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// https://prettier.io/docs/en/options.html
/** @type {import('prettier').RequiredOptions} */
module.exports = {
export default {
trailingComma: 'es5',
bracketSpacing: true,
tabWidth: 2,
Expand All @@ -16,5 +14,5 @@ module.exports = {
},
],
tailwindConfig: './web/config/tailwind.config.js',
plugins: [require('prettier-plugin-tailwindcss')],
plugins: ['prettier-plugin-tailwindcss'],
}
19 changes: 19 additions & 0 deletions web/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from 'storybook-framework-redwoodjs-vite'

import { getPaths, importStatementPath } from '@redwoodjs/project-config'

const redwoodProjectPaths = getPaths()

const config: StorybookConfig = {
framework: 'storybook-framework-redwoodjs-vite',

stories: [
`${importStatementPath(
redwoodProjectPaths.web.src
)}/**/*.stories.@(js|jsx|ts|tsx|mdx)`,
],

addons: ['@storybook/addon-essentials'],
}

export default config
1 change: 1 addition & 0 deletions web/.storybook/preview-body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="redwood-app"></div>
12 changes: 6 additions & 6 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"dependencies": {
"@apollo/client-react-streaming": "0.10.0",
"@mdx-js/rollup": "3.0.1",
"@redwoodjs/forms": "8.0.0-canary.529",
"@redwoodjs/router": "8.0.0-canary.529",
"@redwoodjs/vite": "8.0.0-canary.529",
"@redwoodjs/web": "8.0.0-canary.529",
"@redwoodjs/forms": "8.0.0-rc.1130",
"@redwoodjs/router": "8.0.0-rc.1130",
"@redwoodjs/vite": "8.0.0-rc.1130",
"@redwoodjs/web": "8.0.0-rc.1130",
"date-fns": "^3.3.1",
"feed": "4.2.2",
"framer-motion": "^11.0.3",
"prop-types": "15.8.1",
"react": "19.0.0-canary-cb151849e1-20240424",
"react-dom": "19.0.0-canary-cb151849e1-20240424",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-tweet": "3.2.1",
"rehype-external-links": "3.0.0",
"rehype-highlight": "7.0.0",
Expand Down
13 changes: 8 additions & 5 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import type { ReactNode } from 'react'

import { FatalErrorBoundary, RedwoodProvider } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'

import FatalErrorPage from 'src/pages/FatalErrorPage'
import Routes from 'src/Routes'

import './index.css'

const App = () => (
interface AppProps {
children?: ReactNode
}

const App = ({ children }: AppProps) => (
<FatalErrorBoundary page={FatalErrorPage}>
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
<RedwoodApolloProvider>
<Routes />
</RedwoodApolloProvider>
<RedwoodApolloProvider>{children}</RedwoodApolloProvider>
</RedwoodProvider>
</FatalErrorBoundary>
)
Expand Down
4 changes: 2 additions & 2 deletions web/src/Document.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

import { Css, Meta } from '@redwoodjs/web'
import type { TagDescriptor } from '@redwoodjs/web'
import { Css, Meta } from '@redwoodjs/web/htmlTags'
import type { TagDescriptor } from '@redwoodjs/web/htmlTags'

interface DocumentProps {
children: React.ReactNode
Expand Down
6 changes: 5 additions & 1 deletion web/src/components/Accordion/Accordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import Accordion from './Accordion'
describe('Accordion', () => {
it('renders successfully', () => {
expect(() => {
render(<Accordion />)
render(
<Accordion heading="heading" subheading="subheading">
<p>content</p>
</Accordion>
)
}).not.toThrow()
})
})
4 changes: 2 additions & 2 deletions web/src/components/Home/HomeHero/HomeHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const HomeHero = () => {
className="button mb-4 inline-block text-sm md:mb-8 md:text-base"
rel="noreferrer"
>
Walk Through Bighorn's Features
Walk Through Bighorn&apos;s Features
</a>

<p className="text-sm text-white md:text-base">
Expand All @@ -27,7 +27,7 @@ const HomeHero = () => {
href={Constants.DOCS}
className="font-bold underline hover:no-underline"
>
Build on Redwood's Established Base
Build on Redwood&apos;s Established Base
</a>
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/Home/RoadmapSummary/RoadmapSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const RoadmapSummary = () => {
<div className="sticky top-5 pr-5">
<h2 className="section-heading mb-6">Roadmap</h2>
<h3 className="section-subheading">
This is a glimpse into what were working on and what we’ve
planned.
This is a glimpse into what we&apos;re working on and what
we&apos;ve planned.
</h3>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions web/src/components/NavDropdown/NavDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const NavDropdown = () => {
<div>
<strong>Discord</strong>
<p>
Our "watercooler" for relationship building and community help
Our &quot;watercooler&quot; for relationship building and
community help
</p>
</div>
</a>
Expand All @@ -23,8 +24,8 @@ const NavDropdown = () => {
<div>
<strong>Discourse</strong>
<p>
Long-form discussions, show &
tell, and troubleshooting with the Core Team
Long-form discussions, show & tell, and troubleshooting with the
Core Team
</p>
</div>
</a>
Expand All @@ -35,7 +36,8 @@ const NavDropdown = () => {
<div>
<strong>Twitter / X</strong>
<p>
Follow @redwoodjs for updates about releases, initiatives, and events
Follow @redwoodjs for updates about releases, initiatives, and
events
</p>
</div>
</a>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Newsletter/Newsletter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmailField, Form } from '@redwoodjs/forms'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/dist/toast'
import { toast } from '@redwoodjs/web/toast'

const CREATE_NEWSLETTER_MUTATION = gql`
mutation CreateNewsletterMutation($email: String!) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ReactConf/Newsletter/Newsletter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmailField, Form } from '@redwoodjs/forms'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/dist/toast'
import { toast } from '@redwoodjs/web/toast'

const CREATE_NEWSLETTER_MUTATION = gql`
mutation CreateNewsletterMutation($email: String!) {
Expand Down
7 changes: 7 additions & 0 deletions web/src/entry.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import Routes from './Routes'
*/
const redwoodAppElement = document.getElementById('redwood-app')

if (!redwoodAppElement) {
throw new Error(
"Could not find an element with ID 'redwood-app'. Please ensure it " +
"exists in your 'web/src/index.html' file."
)
}

if (redwoodAppElement.children?.length > 0) {
hydrateRoot(
document,
Expand Down
6 changes: 3 additions & 3 deletions web/src/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export const ServerEntry: React.FC<Props> = ({ css, meta }) => {
}

export async function registerMiddleware() {
const { middleware: sitemapMw } = await import('./middleware/sitemap')
const { middleware: rssMw } = await import('./middleware/rss')
const { middleware: redirectMw } = await import('./middleware/redirects')
const { middleware: sitemapMw } = await import('./middleware/sitemap.js')
const { middleware: rssMw } = await import('./middleware/rss.js')
const { middleware: redirectMw } = await import('./middleware/redirects.js')

return [sitemapMw, rssMw, redirectMw]
}
2 changes: 1 addition & 1 deletion web/src/middleware/redirects.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
MiddlewareRequest,
MiddlewareResponse,
} from '@redwoodjs/vite/dist/middleware'
} from '@redwoodjs/web/middleware'

const REDIRECTS = [
{
Expand Down
2 changes: 1 addition & 1 deletion web/src/middleware/rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Feed } from 'feed'
import type {
MiddlewareRequest,
MiddlewareResponse,
} from '@redwoodjs/vite/dist/middleware'
} from '@redwoodjs/web/middleware'

import { getPosts } from 'src/content/posts'

Expand Down
2 changes: 1 addition & 1 deletion web/src/middleware/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SitemapStream, streamToPromise } from 'sitemap'
import type {
MiddlewareRequest,
MiddlewareResponse,
} from '@redwoodjs/vite/dist/middleware'
} from '@redwoodjs/web/middleware'

import { getPosts } from 'src/content/posts'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BlogIndividualPage from './BlogIndividualPage'
describe('BlogIndividualPage', () => {
it('renders successfully', () => {
expect(() => {
render(<BlogIndividualPage />)
render(<BlogIndividualPage slug="slug" />)
}).not.toThrow()
})
})
2 changes: 1 addition & 1 deletion web/src/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useLocation } from '@redwoodjs/router'
import { Metadata } from '@redwoodjs/web'
import { Toaster } from '@redwoodjs/web/dist/toast'
import { Toaster } from '@redwoodjs/web/toast'

import Footer from 'src/components/Footer/Footer'
import EventSummary from 'src/components/Home/EventSummary/EventSummary'
Expand Down
13 changes: 0 additions & 13 deletions web/src/pages/SecurityPage/SecurityPage.stories.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions web/src/pages/SecurityPage/SecurityPage.test.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions web/src/pages/SecurityPage/SecurityPage.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useState } from 'react'
import { Metadata } from '@redwoodjs/web'

import Icon from 'src/components/Icon/Icon'
import Newsletter from 'src/components/Newsletter/Newsletter'
import { Constants } from 'src/helpers/Constants'

const ServerComponentsPage = () => {
Expand Down
Loading

0 comments on commit 86686f4

Please sign in to comment.