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

feat: add webpack spec #1100

Merged
merged 2 commits into from Apr 3, 2022
Merged

feat: add webpack spec #1100

merged 2 commits into from Apr 3, 2022

Conversation

neoncitylights
Copy link
Contributor

@neoncitylights neoncitylights commented Apr 3, 2022

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Adds a new spec for the webpack CLI, which is an open-source bundler for web development.

What is the current behavior? (You can also link to an open issue here)
Fig does not provide autocomplete for webpack.

What is the new behavior (if this is a feature change)?
There is functional autocomplete for webpack:
image

Additional info:
Fixes #1084. The webpack-cli provides almost 1000 options (exactly 957). This spec was mostly generated with a script I wrote. It parses part of the the OPTION.md file in webpack/webpack-cli, and the subcommands I had manually added in.

First, it creates an AST. After, it does some post-processing, which iterates through each Fig.Option by scanning the description. It uses some basic heuristics to check for some more information:

  • If the sentence contains the keyword deprecated, it will mark it as deprecated via deprecated: true.
  • Folders: If the sentence contains the keywords "directory" or "folder", and the option accepts an argument, it will add "folders" to the template property.
  • Filepaths: If the sentence contains the keywords "filename", and the option accepts an argument, it will add "filepaths" to the template property.

Feedback welcome! Thanks a bunch, this tool is really great.

@withfig-bot
Copy link
Collaborator

Overview

src/webpack.ts:

Info:

@withfig-bot
Copy link
Collaborator

Hello @neoncitylights,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

@neoncitylights
Copy link
Contributor Author

So, I just discovered that https://github.com/withfig/cli-help-parser exists, haha. I didn't know about it until just now! Oops.

I'm not sure where to go from here in terms of a CLI help parser now that there's two. If there's any interest in the parser I wrote, I would be willing to help work on making it be more generic and adapt for more tools. I'd also love to contribute to the Fig repo as well if it's accepting contributions! Thanks again.

Copy link
Contributor

@fedeci fedeci left a comment

Choose a reason for hiding this comment

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

Love this PR! Will make my life so much easier when I'm using webpack😄

@fedeci
Copy link
Contributor

fedeci commented Apr 3, 2022

I'm not sure where to go from here in terms of a CLI help parser now that there's two. If there's any interest in the parser I wrote, I would be willing to help work on making it be more generic and adapt for more tools.

That would be great! https://github.com/withfig/cli-help-parser was written some time ago and probably is missing some properties we have added recently so yours is probably more accurate.

I'd also love to contribute to the Fig repo as well if it's accepting contributions! Thanks again.

If by "Fig repo" you mean this repo we would love other contributions, if you are interested in going deeper in the codebase you should get a call with @brendanfalk and see https://fig.io/jobs!

@fedeci fedeci merged commit 3d4f243 into withfig:master Apr 3, 2022
teziovsky added a commit to teziovsky/fig-autocomplete that referenced this pull request Apr 3, 2022
* feat(fig/fig@latest): update spec (withfig#1089)

* feat: update spec

* fix(fig): run linter

Co-authored-by: Grant G <grant0417@users.noreply.github.com>
Co-authored-by: grant0417 <grant@ggurvis.com>

* ci: version bump to 2.174.0

* feat: add webpack spec (withfig#1100)

* ci: version bump to 2.175.0

* feat: add goreleaser spec (withfig#1096)

* ci: version bump to 2.176.0

* feat: add tfsec spec (withfig#1099)

* ci: version bump to 2.177.0

* feat: add trivy spec (withfig#1102)

* ci: version bump to 2.178.0

* feat: add httpy completion spec (withfig#1093)

* ci: version bump to 2.179.0

Co-authored-by: Matt Schrage <matthewschrage@gmail.com>
Co-authored-by: Grant G <grant0417@users.noreply.github.com>
Co-authored-by: grant0417 <grant@ggurvis.com>
Co-authored-by: Automated Version Bump <gh-action-bump-version@users.noreply.github.com>
Co-authored-by: Samantha <sam.t.nguyenn@gmail.com>
Co-authored-by: Engin Diri <engin.diri@ediri.de>
Co-authored-by: Engin Diri <engin.diri@mail.schwarz>
Co-authored-by: Sinan Kanidağlı <82559809+SinanKanidagli@users.noreply.github.com>
@neoncitylights
Copy link
Contributor Author

I'd also love to contribute to the Fig repo as well if it's accepting contributions! Thanks again.

If by "Fig repo" you mean this repo we would love other contributions, if you are interested in going deeper in the codebase you should get a call with @brendanfalk and see https://fig.io/jobs!

Hi, thank you! I'm looking forward to applying to the company within the next few days. :)

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.

[webpack] missing spec
3 participants