-
Notifications
You must be signed in to change notification settings - Fork 974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: Scaffold does not produce src/lib/formatters #6840
Comments
Hi @AlvaroPata I'm trying to reproduce this. Could you share your schema for I created a new project and ran Do you have a |
Hi @Josh-Walker-GM ! thanks for checking it out This is the schema for model Portfolio {
id String @id @default(cuid())
type AssetType
properties Property[]
tenant Tenant @relation(fields: [tenantId], references: [id])
tenantId String
assets Asset[]
@@unique([tenantId, type])
} I first generated standalone SDLs with When I tried to scaffold the rest of the files with This is the content of the
Did I do something wrong? Thanks |
I just run I s that the intended behaviour? |
Thanks for the extra details! I'll take a look later today to see if I can spot where we go wrong. My first impression is that we definitely shouldn't be generating files that contain missing imports. From a DX perspective we should either generate it all or error out and let you know we can't do what you want. |
Hi @AlvaroPata, so I've just began running through the steps you described. I'm using the existing userexample model since it already comes with the default project but otherwise I've followed your steps of first generating the sdl and then the scaffold. When I run this the scaffold errors out when it encounters the pre-existing I do end up with |
Hi @Josh-Walker-GM, yeah that's exactly what I saw! |
Thanks for clarifying @AlvaroPata. In an ideal world we would support reverting our generators actions when an error occurs - there are some open issues discussing this. If we did support this then you'd have seen this error and then not have had any half functioning code generated. There are also some open issues on linting generated files which would have detected my example generated code which had the empty import. Was there any particular reason you chose to generate the sdl separately to start with before a full scaffold - just out of interest? If it's a common way to want to work then I can imagine we might want to support this. By for example asking if you want to skip certain steps if you've already implemented them. Your issue raises good thoughts for sure! Am I right in saying this issue isn't blocking any progress for you on your projects? As you said you were able to generate the associated files by scaffolding out a different model. |
Hi @Josh-Walker-GM !
In this particular case, I wanted to focus on the business logic without creating all the related frontend files. Working on the service layer helps me further develop and refine the underlying schema. Since I wouldn't be using these files, it wouldn't make sense to have a lot of pages, cells, components, etc at this point: It would only add unnecessary complexity. I would like to work on the frontend side once the business logic has been developed and tested. Is there a better workflow? I'd be happy to try it out!
Yes, you're right. Thank you for your time! |
Nope that workflow sounds sensible to me and if it's the one you're comfortable and productive with then stick with it I'd say. I'll raise some discussion on how we can improve this sort of situation in the future. Some of the thoughts that come to mind about potential improvements:
Thanks for getting involved and helping me understand what went wrong. |
Having a way to integrate the scaffold generator with the standalone generators (e.g. SDLs, components, cells...) would be great. Generating these files separately–especially on the web side–leads to an inconsistent folder structure, which doesn't follow the logic of the scaffold, but that is a different subject. All of your suggestions are really good! Prompt, flag, better error message and even the possibility to revert the generated files be really useful. In case these files cannot be created unless the SDLs have not been created yet, it would be great to have a clearer error message. Maybe a generator for the formatter library would also be helpful? I don't know, just an Idea... In case these files cannot be created unless the SDLs have not been created yet, it would be great to have a clearer error message. |
What's not working?
When generating a scaffold the resulting cells have an import from
src/lib/formatters
that does not exist.How do we reproduce the bug?
yarn rw g scaffold portfolio
What's your environment? (If it applies)
System: OS: macOS 12.6 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.1 - /private/var/folders/37/hrj2n25s0szb0w7_wg4v0yw80000gn/T/xfs-bed756c4/node Yarn: 3.2.3 - /private/var/folders/37/hrj2n25s0szb0w7_wg4v0yw80000gn/T/xfs-bed756c4/yarn Databases: SQLite: 3.37.0 - /usr/bin/sqlite3 Browsers: Chrome: 107.0.5304.87 Firefox: 106.0.5 Safari: 16.0 npmPackages: @redwoodjs/core: ^3.3.1 => 3.3.1
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: