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 definitions. #269

Merged
merged 1 commit into from
Jan 29, 2019
Merged

Add TypeScript definitions. #269

merged 1 commit into from
Jan 29, 2019

Conversation

parkerziegler
Copy link
Contributor

This PR adds basic TypeScript definitions to webpack-dashboard. Since our API surface is so small – it essentially consists of the possible options you can pass to the Dashboard plugin – this is a fairly minor patch. It's really intended for those souls who really, really want to write a webpack.config.ts. I'd ideally like to roll this and the inspectpack upgrade together into a 2.1.0 release if that sounds good to you @ryan-roemer.

Some highlights:

  • We type check the color passed to Dashboard to ensure that it's a supported ANSI color as per the colors outlined here: https://github.com/chalk/ansi-styles#colors. These are the colors supported by chalk, but I noticed that the *-Bright variants don't get picked up 😞. The ones included are confirmed to work.
  • We include type checking the index.d.ts file in check and check-ci commands.
  • I tested these changes by making a simple local webpack.config.ts file and ensuring tsc caught the errors. We'll want to confirm that this holds true after publishing.

This would close #229.

Copy link
Member

@ryan-roemer ryan-roemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🎉

@parkerziegler
Copy link
Contributor Author

@ryan-roemer realized I was type checking the CLI options, not the Dashboard options 🤦‍♂️. Pinging for re-review if you have a second!

@@ -0,0 +1 @@
dist-*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep – this is precautionary. When a user runs yarn dev it'll generate the bundle.js file for the built fixture (whichever one they use). Rather than relying on a user to delete that file in order to pass local linting scripts, I figured we'd just tell ESLint to ignore these files altogether. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

Copy link
Member

@ryan-roemer ryan-roemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment/question, otherwise LGTM!

@parkerziegler parkerziegler merged commit ed6f65e into master Jan 29, 2019
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.

Feature: Add TypeScript definitions.
2 participants