ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.59k stars 789 forks source link

Readme changes in watch mode don't trigger docs-json #2560

Closed spaceemotion closed 2 years ago

spaceemotion commented 4 years ago

Stencil version:

 @stencil/core@1.15.0

I'm submitting a:

[x] bug report [ ] feature request [ ] support request

Current behavior: Similar to https://github.com/ionic-team/stencil/issues/1822#issuecomment-636132747 I am experiencing the same problem as https://github.com/ionic-team/stencil/issues/1822 in 1.15.0

Expected behavior: Whenever I update the readme file the json file should update.

Steps to reproduce:

  1. Create new project using the starter template
  2. Enable docs-json
  3. stencil build --dev --watch --docs
  4. Update readme

Related code:

import { Config } from '@stencil/core';

export const config: Config = {
  // ...
  outputTargets: [
    {
      type: 'dist',
      esmLoaderPath: '../loader',
    },
    {
      type: 'docs-json',
      file: 'dist/components.json',
      strict: true,
    },
  ],
};
spaceemotion commented 4 years ago

Just noticed the same behavior with the usage feature (individual .md files).

wollardj commented 2 years ago

Can confirm the usage issue. I'm using docs-custom, not docs-json but I suspect the same code is responsible for the issue in both places.

With docs-custom it seems that watch mode does re-execute my custom doc generating code when any of the content in a usage/*.md file is modified, but the JsonDocComponent object I receive has the usage data that was initially scanned when the watch process started.

To clarify that a bit further:

  1. example/usage/foo.md has content Hello world
  2. start stencil build in watch mode
  3. custom generator code is given {foo: "Hello world"}
  4. change example/usage/foo.md to Hello Stencil
  5. custom generator code is again given {foo: "Hello world"} instead of {foo: "Hello Stencil"}

No matter how many times you change the content of example/usage/foo.md the content that was present when watch mode was started is what will be handed to the custom docs code.

I suspect all of this to be the same for docs-json.


Also of note, @snaptopixel reported something eerily similar back in 2019 in https://github.com/ionic-team/stencil/issues/1822. The issue was marked as resolved, but either it wasn't entirely resolved or we have a possible regression.

rwaskiewicz commented 2 years ago

@wollardj Thanks! The issue you're describing is being tracked by https://github.com/ionic-team/stencil/issues/3299.

@spaceemotion (and anyone else following this issue) - if this is still occurring in Stencil 2.X with docs-json, can someone please create a reproduction case for the team to take a closer look? Thanks!

ionitron-bot[bot] commented 2 years ago

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

rwaskiewicz commented 2 years ago

Hey all 👋

This issue is being closed due to the lack of a code reproduction. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.

Thank you for using Stencil!