Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Consider add gentype suffix to generate file name #86

Closed
nhducit opened this issue Nov 6, 2018 · 6 comments
Closed

Consider add gentype suffix to generate file name #86

nhducit opened this issue Nov 6, 2018 · 6 comments

Comments

@nhducit
Copy link
Contributor

nhducit commented Nov 6, 2018

Current behavior

source file:

Greeting.re

generate 2 files:

Greeting.bs.js
Greeting.tsx

Motivation:
I don't want to add Greeting.bs.js and Greeting.tsx to git repository. For .bs.js files it is quite easy to add them to .gitignore file. But for generated tsx files, there is no easy way to know which tsx file is generated by genType.

Propose changes:

  • Change generate file name from Greeting.tsx to Greeting.xxx.tsx. for example: Greeting.gentype.tsx for Greeting.gt.tsx
  • This rule should apply for ts files also
  • Should we apply this rule for flowtype?

Impact:

  • It is a breaking change
@cristianoc
Copy link
Collaborator

See how things would look like in #87.
Feel free to play with that and report back.
It's definitely possible to make the extension configurable.

@cristianoc
Copy link
Collaborator

Looks like .re.tsx is problematic for webpack but e.g. .gt.tsx works.

@ryyppy
Copy link
Member

ryyppy commented Nov 6, 2018

I just opened the issue tab to discuss a similar problem for .re.js files.
It would be cool if the user could configure the file-extension in the bsconfig.json / gentypeconfig section.

That would be especially useful in environments where you can't manipulate the resolver logic, like with create-react-app.

@cristianoc
Copy link
Collaborator

@ryyppy added configuration option, e.g. "generatedFileExtension": ".gt"

@cristianoc
Copy link
Collaborator

This is now in master.

@nhducit
Copy link
Contributor Author

nhducit commented Nov 7, 2018

wow. it is super fast. Thank you @cristianoc @ryyppy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants