Skip to content

Commit

Permalink
Merge pull request #2844 from cjreimer/cjr-scaffold-log-fix
Browse files Browse the repository at this point in the history
Removed development console.log lines
  • Loading branch information
thedavidprice authored Jun 17, 2021
2 parents 0038ff5 + 5016bd7 commit 9b77f29
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 66 deletions.
2 changes: 0 additions & 2 deletions packages/cli/src/commands/destroy/scaffold/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ const removeLayoutImport = ({ model: name, path: scaffoldPath = '' }) => {
new RegExp(`\\s*${importLayout}`),
''
)
console.log('regex:', new RegExp(`\\s*${importLayout}`))
console.log(newRoutesContent)

writeFile(routesPath, newRoutesContent, { overwriteExisting: true })

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`in javascript (default) mode creates a edit page 1`] = `
"import EditPostCell from 'src/components//Post/EditPostCell'
"import EditPostCell from 'src/components/Post/EditPostCell'
const EditPostPage = ({ id }) => {
return <EditPostCell id={id} />
Expand Down Expand Up @@ -222,7 +222,7 @@ export default PostForm
`;
exports[`in javascript (default) mode creates a index page 1`] = `
"import PostsCell from 'src/components//Post/PostsCell'
"import PostsCell from 'src/components/Post/PostsCell'
const PostsPage = () => {
return <PostsCell />
Expand Down Expand Up @@ -259,13 +259,53 @@ export default PostsLayout
"
`;
exports[`in javascript (default) mode creates a new component 1`] = `undefined`;
exports[`in javascript (default) mode creates a new component 1`] = `
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/Post/PostForm'
const CREATE_POST_MUTATION = gql\`
mutation CreatePostMutation($input: CreatePostInput!) {
createPost(input: $input) {
id
}
}
\`
const NewPost = () => {
const [createPost, { loading, error }] = useMutation(CREATE_POST_MUTATION, {
onCompleted: () => {
toast.success('Post created')
navigate(routes.posts())
},
})
const onSave = (input) => {
createPost({ variables: { input } })
}
return (
<div className=\\"rw-segment\\">
<header className=\\"rw-segment-header\\">
<h2 className=\\"rw-heading rw-heading-secondary\\">New Post</h2>
</header>
<div className=\\"rw-segment-main\\">
<PostForm onSave={onSave} loading={loading} error={error} />
</div>
</div>
)
}
export default NewPost
"
`;
exports[`in javascript (default) mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components//UserProfile/UserProfileForm'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
mutation CreateUserProfileMutation($input: CreateUserProfileInput!) {
Expand Down Expand Up @@ -308,7 +348,7 @@ export default NewUserProfile
`;
exports[`in javascript (default) mode creates a new page 1`] = `
"import NewPost from 'src/components//Post/NewPost'
"import NewPost from 'src/components/Post/NewPost'
const NewPostPage = () => {
return <NewPost />
Expand All @@ -319,7 +359,7 @@ export default NewPostPage
`;
exports[`in javascript (default) mode creates a show cell 1`] = `
"import Post from 'src/components//Post/Post'
"import Post from 'src/components/Post/Post'
export const QUERY = gql\`
query FindPostById($id: Int!) {
Expand Down Expand Up @@ -477,7 +517,7 @@ export default Post
`;
exports[`in javascript (default) mode creates a show page 1`] = `
"import PostCell from 'src/components//Post/PostCell'
"import PostCell from 'src/components/Post/PostCell'
const PostPage = ({ id }) => {
return <PostCell id={id} />
Expand Down Expand Up @@ -812,7 +852,7 @@ exports[`in javascript (default) mode creates an edit component with int foreign
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components//UserProfile/UserProfileForm'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
export const QUERY = gql\`
query FindUserProfileById($id: Int!) {
Expand Down Expand Up @@ -878,7 +918,7 @@ export const Success = ({ userProfile }) => {
exports[`in javascript (default) mode creates an index cell 1`] = `
"import { Link, routes } from '@redwoodjs/router'
import Posts from 'src/components//Post/Posts'
import Posts from 'src/components/Post/Posts'
export const QUERY = gql\`
query POSTS {
Expand Down Expand Up @@ -922,7 +962,7 @@ exports[`in javascript (default) mode creates an index component 1`] = `
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components//Post/PostsCell'
import { QUERY } from 'src/components/Post/PostsCell'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down Expand Up @@ -1048,7 +1088,7 @@ export default PostsList
`;
exports[`in typescript mode creates a edit page 1`] = `
"import EditPostCell from 'src/components//Post/EditPostCell'
"import EditPostCell from 'src/components/Post/EditPostCell'
const EditPostPage = ({ id }) => {
return <EditPostCell id={id} />
Expand Down Expand Up @@ -1269,7 +1309,7 @@ export default PostForm
`;
exports[`in typescript mode creates a index page 1`] = `
"import PostsCell from 'src/components//Post/PostsCell'
"import PostsCell from 'src/components/Post/PostsCell'
const PostsPage = () => {
return <PostsCell />
Expand Down Expand Up @@ -1306,13 +1346,53 @@ export default PostsLayout
"
`;
exports[`in typescript mode creates a new component 1`] = `undefined`;
exports[`in typescript mode creates a new component 1`] = `
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/Post/PostForm'
const CREATE_POST_MUTATION = gql\`
mutation CreatePostMutation($input: CreatePostInput!) {
createPost(input: $input) {
id
}
}
\`
const NewPost = () => {
const [createPost, { loading, error }] = useMutation(CREATE_POST_MUTATION, {
onCompleted: () => {
toast.success('Post created')
navigate(routes.posts())
},
})
const onSave = (input) => {
createPost({ variables: { input } })
}
return (
<div className=\\"rw-segment\\">
<header className=\\"rw-segment-header\\">
<h2 className=\\"rw-heading rw-heading-secondary\\">New Post</h2>
</header>
<div className=\\"rw-segment-main\\">
<PostForm onSave={onSave} loading={loading} error={error} />
</div>
</div>
)
}
export default NewPost
"
`;
exports[`in typescript mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components//UserProfile/UserProfileForm'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
mutation CreateUserProfileMutation($input: CreateUserProfileInput!) {
Expand Down Expand Up @@ -1355,7 +1435,7 @@ export default NewUserProfile
`;
exports[`in typescript mode creates a new page 1`] = `
"import NewPost from 'src/components//Post/NewPost'
"import NewPost from 'src/components/Post/NewPost'
const NewPostPage = () => {
return <NewPost />
Expand All @@ -1366,7 +1446,7 @@ export default NewPostPage
`;
exports[`in typescript mode creates a show cell 1`] = `
"import Post from 'src/components//Post/Post'
"import Post from 'src/components/Post/Post'
export const QUERY = gql\`
query FindPostById($id: Int!) {
Expand Down Expand Up @@ -1524,7 +1604,7 @@ export default Post
`;
exports[`in typescript mode creates a show page 1`] = `
"import PostCell from 'src/components//Post/PostCell'
"import PostCell from 'src/components/Post/PostCell'
const PostPage = ({ id }) => {
return <PostCell id={id} />
Expand Down Expand Up @@ -1857,7 +1937,7 @@ exports[`in typescript mode creates an edit cell 1`] = `
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components//Post/PostForm'
import PostForm from 'src/components/Post/PostForm'
export const QUERY = gql\`
query FindPostById($id: Int!) {
Expand Down Expand Up @@ -1926,7 +2006,7 @@ exports[`in typescript mode creates an edit component with int foreign keys conv
"import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components//UserProfile/UserProfileForm'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
export const QUERY = gql\`
query FindUserProfileById($id: Int!) {
Expand Down Expand Up @@ -1992,7 +2072,7 @@ export const Success = ({ userProfile }) => {
exports[`in typescript mode creates an index cell 1`] = `
"import { Link, routes } from '@redwoodjs/router'
import Posts from 'src/components//Post/Posts'
import Posts from 'src/components/Post/Posts'
export const QUERY = gql\`
query POSTS {
Expand Down Expand Up @@ -2036,7 +2116,7 @@ exports[`in typescript mode creates an index component 1`] = `
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components//Post/PostsCell'
import { QUERY } from 'src/components/Post/PostsCell'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down
Loading

0 comments on commit 9b77f29

Please sign in to comment.