After upgrade to RC, I wanted to create yet another playground app, just to get some Redwood feeling and I noticed few things that (as far as I remember) wasn’t there in previous release I try.Maybe they are bugs, possible improvements or it’s just me missing some concepts
Environment:
Windows 10 (working from WSL console)
Node 16.13.2
Redwood: 0.41.0
Create app
It seems that ‘create redwood-app’ choose between plain JS and TypeScript on RoundRobin principle? So, I’m not using explicit --typescript flag but, when I execute create app for first time I get plain js files (as well as all file generated later). On second attempt, I get .tsx extensions. Third one will use .js again while fourth will generate .tsx files. Hope that you get my point
I think that I seen this with earlier versions but, probably didn’t pay attention to it.
As a suggestion, from my point of view, adding ‘–typescript’ as optional flag in create command means that ‘plain/vanilla js’ is default option and it should be used in all occasions when --typescript flag is not used. On the other hand, if project leadership decide that typescript should be default option, I suggest to add some flag for us who still prefer plain js (example: --vanilla).
Scaffolding and Storybook
Well, I’m quite sure that this one changed.
I noticed that, when using ‘generate scaffold’ command, .stories files are not generated for layouts/pages/components/cells. If we are using ‘individual’ generate commands (layout/page/component/cell) then we have optional --stories param (well, it is true by default).
I’m, kind of, understand the concept that mentioned individual generators are web-side specific while generate scaffold targets both API and WEB sides (so, maybe authors didn’t want to mess WEB terminology with API generators).
So, if this behaviour is intentional, my question can you, somehow, add stories to ‘general’ scaffold again? At least as optional parameter?
I @zbubric some others can better comment on the create redwood-app behaviors, but I did want to mention that:
If you already have a Redwood app, but want to configure it for TypeScript, you can use our setup command:
yarn rw setup tsconfig
Remember you don’t need to convert all your files to TypeScript, you can always do it incrementally. > Start by renaming your files from .js to .ts or .tsx
Thanks for suggestion @dthyresson but, I’m actually having opossite case: I’m not (yet) ready to go with Typescript so I’m trying to get plain js project.
Anyway, I posted same question on chat and got response that is probably a bug. Default behavior (without typescript flag) should be to always generate plain js project.
Tried to create 3 new apps in a row (in order to collect logs for bug) but, all 3 went fine, created core .js files and used .js for scaffolded files. But, I’m sure I saw it before so I will keep my eyes open and collect logs next time when I get .tsx files
If you feel there is a bug or someway to improve the experience when creating a new RedwoodJS app (or the documentation), please let the team know by opening an issue.
Now I double-check Rob’s tutorial and, indeed, it seems that scaffold didn’t created strorybook files Maybe I was confused because, during the tutorial, part of app was scaffolded and part was generated with ‘single’ generator commands that produce storybook (and test) files.
If that’s the case, I’m sorry for false alarm but, curious about adding storybook and test files support to scaffold? I mean, we have all ingredients that we need and that would be a cool feature for scaffolding (and, I presume, it will put some additional ‘spotlight’ on Storybook usage)?
Yeah, at the time the scaffold generator was created we hadn’t figured out the Storybook integration, and I don’t think we ever went back and added it. They would definitely be nice to have, if someone wanted to take a stab and open a PR!
As I mention od chat, I will do my best and try to produce something. I can’t promise that I will succeed but, hope to produce at least a skeleton. Probably will take a few days until I get something to show.
However, i found information that significant CLI refactoring is planned/ongoing so, I would like to check with you is there any sense to update current implementation (or, just put a proposal for future one)?
Actually, it seems that dropping new template files for storybook and test will not be enough (I can add it but they end in unexpected location :D) so, I think that I will need to dig a bit into generator logic files.