Add getLanguage() helper for project typescript | javascript default and settings#633
Add getLanguage() helper for project typescript | javascript default and settings#633thedavidprice wants to merge 9 commits intomainfrom
Conversation
|
This looks good, but I think a bunch of your questions lead me to think that this should probably not be a configuration option, but rather something that's determined by a We can then create a I would love to see a |
|
@peterp I've created
I tested all these on Windows (including a project with space in base path) and confirmed they are working correctly. (This is also why I’m using
|
|
@thedavidprice It looks like things are failing here, do you want to fix those up and then I can review? |
|
@peterp Ah, I had to remember where I left off on this one. Actually, the tests are where I needed help --> specifically mocking the paths (which apparently I left off trying to use existing fixtures): see But before you work on helping with the tests, why don't you review the code in |
| /** | ||
| * Returns array of a project's existing sides | ||
| */ | ||
| export const getSides = (): string[] => { |
There was a problem hiding this comment.
Not a big fan of this lint rule that forces you declare return types. Inferred types are better for long term maintenance because you don't have to change them as function definition changes.
| export const getSides = (): string[] => { | |
| export const getSides = () => { |
| import { getPaths } from './paths' | ||
|
|
||
| // TODO: make this dynamic | ||
| export enum SidesEnum { |
There was a problem hiding this comment.
Using a Set data structure seems more reasonable for this.
|
We decided that this functionality should belong in |
@peterp How's this for a first attempt at TS?
The goal is to create a helper that a) can return the default project language based on a check for
tsconfigin root or b) return a redwood.toml config target if given, and if not falls back to project default. I'd like a helper like this to be used for all generator commands (when converted to TS support) as the default setting for the commandlanguageoption.One high-level question: I'm assuming there should be one config for the entire project, but should this (somehow) take into account each Side and do a similar a) what's the Side's default, e.g. does
tsconfigexist and b) does the Side have a language target config inredwood.toml? I've been thinking too simply about hybrid language projects -- it's not the project that can be hybrid as much as each side can be a hybrid. Right?Next Steps:
getLanguage?unknownpassed lint, but was also a statement of my level of understanding 😉