Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions __fixtures__/test-project/api/src/services/users/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { QueryResolvers, UserRelationResolvers } from 'types/graphql'

import { db } from 'src/lib/db'

export {}

export const user: QueryResolvers['user'] = ({ id }) => {
return db.user.findUnique({
where: { id },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import type {
FindBlogPostQuery,
FindBlogPostQueryVariables,
} from 'types/graphql'

import type {
CellSuccessProps,
CellFailureProps,
TypedDocumentNode,
} from '@cedarjs/web'

import BlogPost from 'src/components/BlogPost'

export const QUERY: TypedDocumentNode<
FindBlogPostQuery,
FindBlogPostQueryVariables
> = gql`
export const QUERY = gql`
query FindBlogPostQuery($id: Int!) {
blogPost: post(id: $id) {
id
Expand All @@ -33,14 +19,10 @@ export const Loading = () => <div>Loading...</div>

export const Empty = () => <div>Empty</div>

export const Failure = ({
error,
}: CellFailureProps<FindBlogPostQueryVariables>) => (
export const Failure = ({ error }) => (
<div style={{ color: 'red' }}>Error: {error?.message}</div>
)

export const Success = ({
blogPost,
}: CellSuccessProps<FindBlogPostQuery, FindBlogPostQueryVariables>) => (
<BlogPost blogPost={blogPost} />
)
export const Success = ({ blogPost }) => {
return <BlogPost blogPost={blogPost} />
}
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
import type { BlogPostsQuery, BlogPostsQueryVariables } from 'types/graphql'

import type {
CellSuccessProps,
CellFailureProps,
TypedDocumentNode,
} from '@cedarjs/web'

import BlogPost from 'src/components/BlogPost'

export const QUERY: TypedDocumentNode<BlogPostsQuery, BlogPostsQueryVariables> =
gql`
query BlogPostsQuery {
blogPosts: posts {
id
title
body
author {
email
fullName
}
createdAt
export const QUERY = gql`
query BlogPostsQuery {
blogPosts: posts {
id
title
body
author {
email
fullName
}
createdAt
}
`
}
`

export const Loading = () => <div>Loading...</div>

export const Empty = () => <div>Empty</div>

export const Failure = ({
error,
}: CellFailureProps<BlogPostsQueryVariables>) => (
export const Failure = ({ error }) => (
<div style={{ color: 'red' }}>Error: {error?.message}</div>
)

export const Success = ({
blogPosts,
}: CellSuccessProps<BlogPostsQuery, BlogPostsQueryVariables>) => (
<div className="divide-grey-700 divide-y">
{blogPosts.map((post) => (
<BlogPost key={post.id} blogPost={post} />
))}
</div>
)
export const Success = ({ blogPosts }) => {
return (
<div className="divide-grey-700 divide-y">
{blogPosts.map((post) => (
<BlogPost key={post.id} blogPost={post} />
))}
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// import { Link, routes } from '@cedarjs/router'

const AboutPage = () => {
return (
<p className="font-light">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import { Link, routes } from '@cedarjs/router'
import { Metadata } from '@cedarjs/web'

import BlogPostCell from 'src/components/BlogPostCell'

type BlogPostPageProps = {
id: number
}

import BlogPostCell from 'src/components/BlogPostCell'

const BlogPostPage = ({ id }: BlogPostPageProps) => {
return (
<>
Expand Down
2 changes: 2 additions & 0 deletions __fixtures__/test-project/web/src/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// import { Link, routes } from '@cedarjs/router'

import BlogPostsCell from 'src/components/BlogPostsCell'

const HomePage = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { Link, routes } from '@cedarjs/router'
import { Metadata } from '@cedarjs/web'

import { useAuth } from 'src/auth'
// import { Link, routes } from '@cedarjs/router'

const ProfilePage = () => {
const { currentUser, isAuthenticated, hasRole, loading } = useAuth()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import WaterfallBlogPostCell from 'src/components/WaterfallBlogPostCell'
// import { Link, routes } from '@cedarjs/router'

type WaterfallPageProps = {
id: number
}

import WaterfallBlogPostCell from 'src/components/WaterfallBlogPostCell'

const WaterfallPage = ({ id }: WaterfallPageProps) => (
<WaterfallBlogPostCell id={id} />
)
Expand Down
8 changes: 8 additions & 0 deletions tasks/test-project/base-tasks.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ function getPagesTasks() {
{
title: 'Creating home page',
task: async () => {
const now = new Date()
await createPage('home /')
const middle = new Date()

await applyCodemod(
'homePage.js',
fullPath('web/src/pages/HomePage/HomePage'),
)
const after = new Date()

console.log(`home page took ${middle.getTime() - now.getTime()}ms`)
console.log(
`home page codemod took ${after.getTime() - middle.getTime()}ms`,
)
Comment on lines +32 to +45
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover debug timing logs

These console.log timing statements appear to be debug instrumentation left over from profiling (the PR description says "After: TBD", suggesting the author was still measuring). They will pollute CI/test output on every run. The measurements should either be removed or moved to a structured logging/profiling facility if they are genuinely needed.

Suggested change
const now = new Date()
await createPage('home /')
const middle = new Date()
await applyCodemod(
'homePage.js',
fullPath('web/src/pages/HomePage/HomePage'),
)
const after = new Date()
console.log(`home page took ${middle.getTime() - now.getTime()}ms`)
console.log(
`home page codemod took ${after.getTime() - middle.getTime()}ms`,
)
await createPage('home /')
await applyCodemod(
'homePage.js',
fullPath('web/src/pages/HomePage/HomePage'),
)

},
},
{
Expand Down
Loading
Loading