diff --git a/packages/cli/src/commands/destroy/scaffold/scaffold.js b/packages/cli/src/commands/destroy/scaffold/scaffold.js index 67ce7f9a374f..cf3d8c79eea6 100644 --- a/packages/cli/src/commands/destroy/scaffold/scaffold.js +++ b/packages/cli/src/commands/destroy/scaffold/scaffold.js @@ -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 }) diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap index 5d0cd79370ab..0620f740ebb6 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap +++ b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffold.test.js.snap @@ -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 @@ -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 @@ -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 ( +
+
+

New Post

+
+
+ +
+
+ ) +} + +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!) { @@ -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 @@ -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!) { @@ -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 @@ -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!) { @@ -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 { @@ -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!) { @@ -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 @@ -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 @@ -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 ( +
+
+

New Post

+
+
+ +
+
+ ) +} + +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!) { @@ -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 @@ -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!) { @@ -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 @@ -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!) { @@ -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!) { @@ -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 { @@ -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!) { diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap index 5e1042c0700c..2b6e24b4d561 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap +++ b/packages/cli/src/commands/generate/scaffold/__tests__/__snapshots__/scaffoldNoNest.test.js.snap @@ -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//EditPostCell' +"import EditPostCell from 'src/components/EditPostCell' const EditPostPage = ({ id }) => { return @@ -222,7 +222,7 @@ export default PostForm `; exports[`in javascript (default) mode creates a index page 1`] = ` -"import PostsCell from 'src/components//PostsCell' +"import PostsCell from 'src/components/PostsCell' const PostsPage = () => { return @@ -265,7 +265,7 @@ exports[`in javascript (default) mode creates a new component with int foreign k "import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { navigate, routes } from '@redwoodjs/router' -import UserProfileForm from 'src/components//UserProfileForm' +import UserProfileForm from 'src/components/UserProfileForm' const CREATE_USER_PROFILE_MUTATION = gql\` mutation CreateUserProfileMutation($input: CreateUserProfileInput!) { @@ -308,7 +308,7 @@ export default NewUserProfile `; exports[`in javascript (default) mode creates a new page 1`] = ` -"import NewPost from 'src/components//NewPost' +"import NewPost from 'src/components/NewPost' const NewPostPage = () => { return @@ -319,7 +319,7 @@ export default NewPostPage `; exports[`in javascript (default) mode creates a show cell 1`] = ` -"import Post from 'src/components//Post' +"import Post from 'src/components/Post' export const QUERY = gql\` query FindPostById($id: Int!) { @@ -477,7 +477,7 @@ export default Post `; exports[`in javascript (default) mode creates a show page 1`] = ` -"import PostCell from 'src/components//PostCell' +"import PostCell from 'src/components/PostCell' const PostPage = ({ id }) => { return @@ -812,7 +812,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//UserProfileForm' +import UserProfileForm from 'src/components/UserProfileForm' export const QUERY = gql\` query FindUserProfileById($id: Int!) { @@ -878,7 +878,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//Posts' +import Posts from 'src/components/Posts' export const QUERY = gql\` query POSTS { @@ -922,7 +922,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//PostsCell' +import { QUERY } from 'src/components/PostsCell' const DELETE_POST_MUTATION = gql\` mutation DeletePostMutation($id: Int!) { @@ -1048,7 +1048,7 @@ export default PostsList `; exports[`in typescript mode creates a edit page 1`] = ` -"import EditPostCell from 'src/components//EditPostCell' +"import EditPostCell from 'src/components/EditPostCell' const EditPostPage = ({ id }) => { return @@ -1269,7 +1269,7 @@ export default PostForm `; exports[`in typescript mode creates a index page 1`] = ` -"import PostsCell from 'src/components//PostsCell' +"import PostsCell from 'src/components/PostsCell' const PostsPage = () => { return @@ -1312,7 +1312,7 @@ exports[`in typescript mode creates a new component with int foreign keys conver "import { useMutation } from '@redwoodjs/web' import { toast } from '@redwoodjs/web/toast' import { navigate, routes } from '@redwoodjs/router' -import UserProfileForm from 'src/components//UserProfileForm' +import UserProfileForm from 'src/components/UserProfileForm' const CREATE_USER_PROFILE_MUTATION = gql\` mutation CreateUserProfileMutation($input: CreateUserProfileInput!) { @@ -1355,7 +1355,7 @@ export default NewUserProfile `; exports[`in typescript mode creates a new page 1`] = ` -"import NewPost from 'src/components//NewPost' +"import NewPost from 'src/components/NewPost' const NewPostPage = () => { return @@ -1366,7 +1366,7 @@ export default NewPostPage `; exports[`in typescript mode creates a show cell 1`] = ` -"import Post from 'src/components//Post' +"import Post from 'src/components/Post' export const QUERY = gql\` query FindPostById($id: Int!) { @@ -1524,7 +1524,7 @@ export default Post `; exports[`in typescript mode creates a show page 1`] = ` -"import PostCell from 'src/components//PostCell' +"import PostCell from 'src/components/PostCell' const PostPage = ({ id }) => { return @@ -1857,7 +1857,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//PostForm' +import PostForm from 'src/components/PostForm' export const QUERY = gql\` query FindPostById($id: Int!) { @@ -1926,7 +1926,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//UserProfileForm' +import UserProfileForm from 'src/components/UserProfileForm' export const QUERY = gql\` query FindUserProfileById($id: Int!) { @@ -1992,7 +1992,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//Posts' +import Posts from 'src/components/Posts' export const QUERY = gql\` query POSTS { @@ -2036,7 +2036,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//PostsCell' +import { QUERY } from 'src/components/PostsCell' const DELETE_POST_MUTATION = gql\` mutation DeletePostMutation($id: Int!) { diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js index 9042e9d245e1..9653d051b251 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js @@ -78,6 +78,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the edit page correctly imports the edit cell', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/pages/Post/EditPostPage/EditPostPage.js' + ) + ] + ).toMatch(`import EditPostCell from 'src/components/Post/EditPostCell'`) + }) + test('creates a index page', async () => { expect( files[ @@ -88,6 +98,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the index page correctly imports the index cell', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/pages/Post/PostsPage/PostsPage.js' + ) + ] + ).toMatch(`import PostsCell from 'src/components/Post/PostsCell'`) + }) + test('creates a new page', async () => { expect( files[ @@ -98,6 +118,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the new page correctly imports the new component', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/pages/Post/NewPostPage/NewPostPage.js' + ) + ] + ).toMatch(`import NewPost from 'src/components/Post/NewPost'`) + }) + test('creates a show page', async () => { expect( files[ @@ -108,6 +138,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the show page correctly imports the show cell', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/pages/Post/PostPage/PostPage.js' + ) + ] + ).toMatch(`import PostCell from 'src/components/Post/PostCell'`) + }) + // Cells test('creates an edit cell', async () => { @@ -120,6 +160,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the edit cell correctly imports the form', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/components/Post/EditPostCell/EditPostCell.js' + ) + ] + ).toMatch(`import PostForm from 'src/components/Post/PostForm'`) + }) + test('creates an index cell', async () => { expect( files[ @@ -130,6 +180,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the index cell correctly imports the index component', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/components/Post/PostsCell/PostsCell.js' + ) + ] + ).toMatch(`import Posts from 'src/components/Post/Posts'`) + }) + test('creates a show cell', async () => { expect( files[ @@ -140,6 +200,16 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the show cell correctly imports the show component', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/components/Post/PostCell/PostCell.js' + ) + ] + ).toMatch(`import Post from 'src/components/Post/Post'`) + }) + // Components test('creates a form component', async () => { @@ -162,16 +232,36 @@ describe('in javascript (default) mode', () => { ).toMatchSnapshot() }) + test('the index component correctly imports the QUERY', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/components/Post/Posts/Posts.js' + ) + ] + ).toMatch(`import { QUERY } from 'src/components/Post/PostsCell'`) + }) + test('creates a new component', async () => { expect( files[ path.normalize( - '/path/to/project/web/src/components/Post/PostNew/PostNew.js' + '/path/to/project/web/src/components/Post/NewPost/NewPost.js' ) ] ).toMatchSnapshot() }) + test('the new component correctly imports the form', async () => { + expect( + files[ + path.normalize( + '/path/to/project/web/src/components/Post/NewPost/NewPost.js' + ) + ] + ).toMatch(`import PostForm from 'src/components/Post/PostForm'`) + }) + test('creates a show component', async () => { expect( files[ @@ -451,7 +541,7 @@ describe('in typescript mode', () => { expect( tsFiles[ path.normalize( - '/path/to/project/web/src/components/Post/PostNew/PostNew.tsx' + '/path/to/project/web/src/components/Post/NewPost/NewPost.tsx' ) ] ).toMatchSnapshot() diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js index 7fb4483109f2..121c1c40c440 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js @@ -508,6 +508,26 @@ describe('Admin/Post', () => { ]) }) + test('the index component correctly imports the QUERY', async () => { + expect( + filesUpper[ + path.normalize( + '/path/to/project/web/src/components/Admin/Post/Posts/Posts.js' + ) + ] + ).toMatch(`import { QUERY } from 'src/components/Admin/Post/PostsCell'`) + }) + + test('the new component correctly imports the form', async () => { + expect( + filesUpper[ + path.normalize( + '/path/to/project/web/src/components/Admin/Post/NewPost/NewPost.js' + ) + ] + ).toMatch(`import PostForm from 'src/components/Admin/Post/PostForm'`) + }) + test('creates a new component', async () => { expect(filesUpper).toHaveProperty([ path.normalize( diff --git a/packages/cli/src/commands/generate/scaffold/scaffold.js b/packages/cli/src/commands/generate/scaffold/scaffold.js index 92e2c8e038bd..64973690295c 100644 --- a/packages/cli/src/commands/generate/scaffold/scaffold.js +++ b/packages/cli/src/commands/generate/scaffold/scaffold.js @@ -50,23 +50,30 @@ const getImportComponentNames = ( ) => { const pluralName = pascalcase(pluralize(name)) const singularName = pascalcase(pluralize.singular(name)) - // TODO - confirm case for scaffold path - const sP = - scaffoldPath !== '' ? scaffoldPath.split('/').map(pascalcase).join('/') : '' - const cPath = nestScaffoldByModel - ? `src/components/${sP}/${singularName}` - : `src/components/${sP}` + let componentPath + let layoutPath + if (scaffoldPath === '') { + componentPath = nestScaffoldByModel + ? `src/components/${singularName}` + : `src/components` + layoutPath = `src/layouts` + } else { + const sP = scaffoldPath.split('/').map(pascalcase).join('/') + componentPath = nestScaffoldByModel + ? `src/components/${sP}/${singularName}` + : `src/components/${sP}` + layoutPath = `src/layouts/${sP}` + } return { - // default case - importComponentName: `${cPath}/${singularName}`, - importComponentNameCell: `${cPath}/${singularName}Cell`, - importComponentEditNameCell: `${cPath}/Edit${singularName}Cell`, - importComponentNameForm: `${cPath}/${singularName}Form`, - importComponentNewName: `${cPath}/New${singularName}`, - importComponentNames: `${cPath}/${pluralName}`, - importComponentNamesCell: `${cPath}/${pluralName}Cell`, - importLayoutNames: `src/layouts/${sP}/${pluralName}Layout`, + importComponentName: `${componentPath}/${singularName}`, + importComponentNameCell: `${componentPath}/${singularName}Cell`, + importComponentEditNameCell: `${componentPath}/Edit${singularName}Cell`, + importComponentNameForm: `${componentPath}/${singularName}Form`, + importComponentNewName: `${componentPath}/New${singularName}`, + importComponentNames: `${componentPath}/${pluralName}`, + importComponentNamesCell: `${componentPath}/${pluralName}Cell`, + importLayoutNames: `${layoutPath}/${pluralName}Layout`, } } @@ -74,16 +81,11 @@ const getImportComponentNames = ( const getTemplateStrings = (name, scaffoldPath, nestScaffoldByModel = true) => { const pluralPascalName = pascalcase(pluralize(name)) const singularPascalName = pascalcase(pluralize.singular(name)) - //const singularPascalName = pascalcase(pluralize.singular(name)) - //const pluralPascalName = pascalcase(pluralize(name)) - //const singularCamelName = camelcase(singularPascalName) - //const pluralParamName = paramCase(pluralPascalName) const pluralCamelName = camelcase(pluralPascalName) const singularCamelName = camelcase(singularPascalName) const camelScaffoldPath = camelcase(pascalcase(scaffoldPath)) - // ToDo - confirm if the route name should include the model again return { pluralRouteName: scaffoldPath === '' @@ -412,7 +414,6 @@ export const routes = async ({ }) => { if (typeof nestScaffoldByModel === 'undefined') { nestScaffoldByModel = getConfig().generate.nestScaffoldByModel - console.log('nestScaffoldByModel from config: ', nestScaffoldByModel) } const templateNames = getTemplateStrings(name, scaffoldPath) @@ -449,7 +450,6 @@ const addRoutesInsideSetToRouter = async (model, path) => { return addRoutesToRouterTask(await routes({ model, path }), layoutName) } -// TODO const addLayoutImport = ({ model: name, path: scaffoldPath = '' }) => { const pluralPascalName = pascalcase(pluralize(name)) const pascalScaffoldPath =