runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
501 stars 63 forks source link

outFiles #149

Closed bennypowers closed 4 years ago

bennypowers commented 4 years ago

Maybe I'm doing this wrong, but

npx wca analyze 'src/components/**/*.ts' --outFiles '{dir}/README.md' 

prints to the console but does not write files

runem commented 4 years ago

The command seems correct, and it seems to works on my machine :-)

I have couple of questions in order to fix the problem:

  1. What's the output if you run the command with the --dry flag?
  2. If --dry doesn't anything, what happens if you run it with the --verbose flag?
  3. Does the README.md files already exist?
bennypowers commented 4 years ago

Doesn't seem to make any difference at all

> the-binah-tree@1.0.0 analyze /Users/bennyp/Documents/the-binah-tree
> wca analyze 'src/components/**/*.ts' --outFiles '{dir}/README.md' --dry --verbose

Analyzing 10 files...
# define-element
## Properties

| Property | Type               | Default      |
|----------|--------------------|--------------|
| `mo`     | `MutationObserver` | **required** |

# tbt-account
## Properties

| Property | Attribute | Type      | Default |
|----------|-----------|-----------|---------|
| `active` | `active`  | `boolean` | false   |
| `state`  |           | `any`     |         |
| `target` |           | `any`     |         |

# tbt-app
## Properties

| Property      | Attribute     | Type                      | Default      |
|---------------|---------------|---------------------------|--------------|
| `pages`       |               | `NodeListOf<PageElement>` | **required** |
| `state`       |               | `any`                     |              |
| `testimonial` | `testimonial` | `any`                     |              |

# tbt-auth
## Properties

| Property    | Attribute | Type          | Default      |
|-------------|-----------|---------------|--------------|
| `container` |           | `HTMLElement` | **required** |
| `hidden`    | `hidden`  | `boolean`     | false        |
| `loaded`    | `loaded`  | `boolean`     | false        |
| `state`     |           | `any`         |              |

# tbt-info
## Properties

| Property  | Type                 | Default      |
|-----------|----------------------|--------------|
| `details` | `HTMLDetailsElement` | **required** |

# tbt-subscribe
## Properties

| Property               | Attribute | Type                   | Default      |
|------------------------|-----------|------------------------|--------------|
| `active`               | `active`  | `boolean`              | false        |
| `pricingTable`         |           | `HTMLElement`          | **required** |
| `state`                |           | `any`                  |              |
| `stripeElements`       |           | `StripeElements`       |              |
| `stripePaymentRequest` |           | `StripePaymentRequest` |              |
| `target`               |           | `HTMLElement`          | **required** |

same for just --dry or just --verbose

There are READMEs in that glob, but not under dirs that also have .ts

$ ls src/components/**/*.md 
src/components/tbt-blurb/README.md         src/components/tbt-loader/README.md        src/components/tbt-testimonial/README.md
src/components/tbt-card/README.md          src/components/tbt-pricing-table/README.md src/components/tbt-tier/README.md
$  ls src/components/**/*.ts
src/components/define-element/define-element.ts src/components/tbt-app/tbt-app.test.ts          src/components/tbt-info/tbt-info.ts
src/components/define-element/define.ts         src/components/tbt-app/tbt-app.ts               src/components/tbt-subscribe/tbt-subscribe.ts
src/components/tbt-account/account-state.ts     src/components/tbt-auth/auth-state.ts
src/components/tbt-account/tbt-account.ts       src/components/tbt-auth/tbt-auth.ts
runem commented 4 years ago

It seems like it doesn't pick up on the flags at all. Eg. if it picked up on the --outFiles it wouldn't log the content of the components.

I have some more questions just to rule out things:

  1. Are you running the latest version of WCA? npx wca --version / npm ls web-component-analyzer (latest version is 1.0.3)
  2. What happens if you switch the order of parameters given to the command, such as having 'src/components/**/*.ts' as the last parameter?
  3. What happens if you change the flag to --out-files or remove analyze from the command?
bennypowers commented 4 years ago

Definitely an old version. derp!

thanks for helping me debug

runem commented 4 years ago

No problem, I’m glad I was able to help :-)