question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are cli options working?

See original GitHub issue

I’m using react-docgen by cli. However, --ignore, --exclude and --resolver seem not working at all. It keeps parsing those unwanted files and output No suitable component definition found, which is really annoying since they’re not meant to be generated docs.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
kryten87commented, Dec 14, 2016

The documentation for the exclude option says “Filename pattern to exclude” - I’m reading that to mean that it will match a pattern and exclude those files. But I can’t find a way to specify a pattern that works.

I can explicitly exclude files by specifying the full file name, but cannot exclude files by pattern. For example, I’m trying:

react-docgen src/components/ -o test.json -e *.spec.js

And getting a whole bunch of “No suitable component definition found” errors.

I’ve tried a number of different ways of specifying that pattern:

# try * wildcards?
react-docgen src/components/ -o test.json -e *.spec.js
react-docgen src/components/ -o test.json -e **/*.spec.js
react-docgen src/components/ -o test.json -e src/components/*.spec.js
react-docgen src/components/ -o test.json -e src/components/**/*.spec.js

# maybe a regex?
react-docgen src/components/ -o test.json -e '/.*.spec.js/'
react-docgen src/components/ -o test.json -e '.*.spec.js'
react-docgen src/components/ -o test.json -e .*.spec.js

EDIT

A little more digging reveals that the problem is with the node-dir package. In short, this package always assumes you want to build an array of “excludes” and passes that to node-dir. However, node-dir either accepts a regular expression or an array of strings, but not both.

Ideally, I think the fix should be with node-dir - it should probably be a little more “open minded” about the list of exclusions it receives and be able to handle an array of regular expressions and strings.

1reaction
fklingcommented, Oct 19, 2016

Only parse files that define components.

Well, we have to parse the file in order to know whether it defines components or not. However, maybe we should create a friendlier output that simply lists in which files it didn’t find component definitions (and provide a CLI option to suppress that information).

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a command-line interface (CLI)? - TechTarget
CLIs accept as input commands that are entered by keyboard; the commands invoked at the command prompt are then run by the computer....
Read more >
Command-Line Options - Catb.org
In the original Unix tradition, command-line options are single letters preceded by a single ... List files to be extracted from an archive...
Read more >
Why Knowing the Command Line Important?
The Command Line Interface or CLI is a text interface that is navigated by typing commands at prompts, instead of using the mouse...
Read more >
Command-line interface - Wikipedia
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of...
Read more >
Understanding Command Line Arguments and How to Use ...
Command line arguments are extra commands you can use when launching a program so that the program's functionality will change.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found