Skip to content

[BUG] generate:after hook is executed twice when using entrypoint with fs output #1993

Description

@sahillllllllll-bit

Describe the bug.

When using the Generator API with:

  • entrypoint set
  • output = 'fs' (default)

The generate:after hook is executed twice.

This happens due to duplicate lifecycle invocation inside:

generator/apps/generator/lib/generator.js

The hook is triggered:

  1. Inside handleEntrypoint()
  2. Again inside executeAfterHook() (called from generate())

This causes duplicated side effects during the generation lifecycle.

Expected behavior

Lifecycle execution should be:

generate:before
generate:after

generate:after must run exactly once per generation.

Screenshots

Image Image

How to Reproduce

  1. Create a minimal local template with a generate:after hook that logs to console.

  2. Create a minimal asyncapi.yaml file.

  3. Use the Generator API with:

    • entrypoint set (e.g. index.js)
    • default output = 'fs'
    • forceWrite: true
    • install: false
  4. Run the generation script:

    node repro.js

OR

Manually check : generator/apps/generator/lib/generator.js file

🖥️ Device Information [optional]

  • Operating System (OS):Windows (WSL)
  • Browser:
  • Browser Version:

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions