_This is a sub-tracking issue of #234_
This is a component of Redwood's initiative to add first-class TypeScript support. 馃帀
Generators are a part of the CLI package and located in this directory:
https://github.com/redwoodjs/redwood/tree/master/packages/cli/src/commands/generate
The CLI package is built with Yargs. Read more here.
The intention is to provide a path for a _collaborative, incremental_ transition to having 100% TypeScript generators. This means the scope of a PR can be an individual generator, which can be merged into the master branch on its own when it's ready.
.ts.ts and .js; this applies to 1) refusing to run if files already exist and 2) overwriting existing files using --force--force option; a clear explanation message should be givents.transpile and prettier, but this needs evaluation)ts.ScriptTarget; "ESNext" seems like a candidate--javascript or --typescriptredwood.toml if given.tsconfig.json exists and there is no redwood.toml override, the generator will automatically set --typescript to true. Therefore, running yarn rw g [option] will target typescript. ...test.ts|js files need to pass yarn rw test and yarn rw lint__tests__ directory files and fixtures to TS[--javascript|--typescript] to each generator CLI command[-js|-ts] respectively--javascript or --typescript option..test.ts/js files pass yarn rw lint and yarn rw test?__tests__/helpers.test.js to TShelpers.js to TSsrc/commands/generatorstemplates/ files to TS__tests__/ fixtures and test.js to TS--javascript as defaulttemplates/ file to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ files to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ files to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ file to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ files to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ files to TS__tests__/ fixtures and test.js to TS--javascript as default templates/ files to TS: components, layouts, and pages__tests__/ fixtures and test.js to TS--javascript as default I've picked up SDL and Service, will post in the forum for volunteers for the rest!
I would start with Helpers 馃槑
@MarkPollmann FYI I've extracted the functionality to transform generated TS into prettier-ified JS, you can take a look at my PR or just branch off it.
Hello hello, I'd like to pick up the Component work next week. It would be what's under packages/cli/src/commands/generate/component, right?
wait, it appears twice in the checklist 馃
@kimadeline That would be amazing, thank you! None of the core folks are TS experts so any help is greatly appreciated.
Looks like @thedavidprice already updated the list to remove that second reference鈥攚e do only have one component generator, honest!
Hi @kimadeline! Grateful in advance for the help --> yes, please 馃殌
For examples of implementation in progress, do check out the work on #515 and #557 (I'm behind on reviews but will make it a priority this weekend.)
It would be what's under
packages/cli/src/commands/generate/component/, right?
^^ yes, indeed
wait, it appears twice in the checklist 馃
^^ 'cause we are _super_ thorough around here... also double pleasure of checking off lists when done!
(great catch, thank you --> edited 馃槈)
@peterp @kimadeline
Question about specific generator behavior from here:
generator refuses to run if files exist in the same language
^^ original idea was to have the generator refuse if _either_ language exists. But I proposed that without any discussion. I have no strong opinion either way other than to defer to what we think user will expect and either warn or refuse if generator behavior might be unanticipated. And to have all the generators behave the same.
Thoughts/recommendations? 1) refuse on either language 2) refuse on same language 3) middle path (e.g. warn)
I have no strong opinion either, mostly from lack of exposure to hybrid projects 馃檲 I agree with your other points though, going with what users would expect and unifying generator behaviour.
Now, what do you think users would expect? 馃
Most helpful comment
@kimadeline That would be amazing, thank you! None of the core folks are TS experts so any help is greatly appreciated.
Looks like @thedavidprice already updated the list to remove that second reference鈥攚e do only have one component generator, honest!