Create app, scaffold and Storybook


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 :smiley:

Windows 10 (working from WSL console)
Node 16.13.2
Redwood: 0.41.0

  1. 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 :wink:
    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).

  2. 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

If that is an option and may help others who got into a js state and then want to move to TypeScript.

1 Like

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.


Update on ‘Create app’ issues:

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

1 Like

Sounds good.

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.

@zbubric I have to check the history of scaffold, but my memory is that scaffolding never generated storybook files.

@thedavid and @rob what’s your recollection?

Now I double-check Rob’s tutorial and, indeed, it seems that scaffold didn’t created strorybook files :man_shrugging: 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)?

No worries!

It would make sense for scaffold to create storybook files, so please do open an issue and maybe someone can take in on as an enhancement!

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!

1 Like

Hi Rob,

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)?


1 Like

The CLI refactoring shouldn’t mess with the templates that we use to create the scaffold files, so you should be safe!

1 Like

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.

1 Like