Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript support and fix config bug #20

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

robert-orlinski
Copy link

Hi!

I am a huge fan of this flat components' structure and this simple CLI. Also, I am a huge fan of TypeScript and the lack of support for this language was a little pain for me when it comes to that utility.

That's the reason for this PR 😌

Added:

  • TypeScript support;
  • Some README tweaks that explain new features.

Fixed:

  • config's object assign, because of which custom configs weren't working.

Hope it will be useful!

@yasinkavakliat
Copy link

@joshwcomeau Would really love to get this merged as I only use TypeScript these days. Wanted to use this utility for a project, but I refuse to use plain JS 😄

@matt123miller
Copy link

@robert-orlinski @Coupz I'm using version 4.0.1 and it works for me. I originally came here to update the README to mention it supports TSX, mine is configured for TSX via the JSON file which is located in my home directory.

❯ cat ~/.new-component-config.json
{"extension":"tsx"}

I also just changed that to "ts" and created a quick component, it worked fine.

Screenshot 2022-06-05 at 11 31 12

I also checked using the -x flag as shown and that all worked fine:

Screenshot 2022-06-05 at 11 34 56

Screenshot 2022-06-05 at 11 35 15

Seems to work for whatever value you provide so wanna try again on your machines?

matt123miller added a commit to matt123miller/new-component that referenced this pull request Jun 5, 2022
As discussed here joshwcomeau#20 (comment) the tool supports more than just js and jsx so I've updated to README accordingly.
@yasinkavakliat
Copy link

yasinkavakliat commented Jun 14, 2022

I've just tested it again, completely new installation of new-component and it still generates .js files for me @matt123miller
I'm on Windows, maybe that is the difference?
image

Edit: it works with the -x tsx flag and I've only created the config file in the root directory of my app.

@matt123miller
Copy link

Ah, I'm on mac. Maybe it is a Windows issue?

To clarify do you mean that it works with the config file at the root of your app? Or it doesn't and is only respecting the -x flag?

@yasinkavakliat
Copy link

Exactly. It ignores the config file and only respects the -x flag.

@fmdiaz
Copy link

fmdiaz commented Dec 14, 2022

Exactly. It ignores the config file and only respects the -x flag.

The same for me in Linux (Ubuntu 20.04). Tried both local project and global locations for the config file.

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

Successfully merging this pull request may close these issues.

5 participants