generator icon indicating copy to clipboard operation
generator copied to clipboard

feat!: remove nunjucks support and `ag` CLI

Open derberg opened this issue 1 month ago β€’ 14 comments

Blockers removed:

  • [DONE] and this https://asyncapi.slack.com/archives/CQVJXFNQL/p1763542946954309 as I'd like to change Node dependency in project. So this PR now depends on updates needed in https://github.com/asyncapi/.github/blob/master/.github/actions/get-node-version-from-package-lock/action.yml first. We can switch new major to support only latest node
  • [DONE] also clear approval for https://github.com/asyncapi/cli/issues/1904 is needed, so once this PR is merged, I can immediately work on adding v3 to CLI. Maintainer 🟒 light for generator update plans

Resolves: https://github.com/asyncapi/generator/issues/1720

Breaking Changes

  • Node 24 and npm 11 must have
  • Nunjucks renderer removed β€” React is now the sole rendering engine. No need to specify render engine in config anymore
  • Nunjucks filters package and its public filters removed; filter-based template APIs no longer available.
  • ag CLI is no longer available. Long time ago it was already announced that it will be removed and people should move to AsyncAPI CLI. Old CLI code without watcher is still there but moved to tests as purely local-dev solution

Migration Guides

Summary by CodeRabbit

  • Removed Features

    • Legacy Nunjucks renderer, filters package, file-watcher utility, CLI entry points, Docker release workflow, and related test fixtures removed.
  • Breaking Changes

    • React is now the only renderer; Node and npm minimum versions raised.
  • Documentation

    • Nunjucks migration guides and Nunjucks-specific docs removed; docs streamlined for React.
  • Tests

    • Nunjucks-related tests deleted or reduced.
  • Chores

    • Updated configs, templates, manifests, and CI to reflect these removals and dependency updates.

✏️ Tip: You can customize this high-level summary in your review settings.

derberg avatar Nov 14 '25 07:11 derberg

πŸ¦‹ Changeset detected

Latest commit: b31c428645f69b13c72ac134d5cc809de06f74a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@asyncapi/generator Major
@asyncapi/generator-helpers Major
@asyncapi/template-kafka-integration-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Nov 14 '25 07:11 changeset-bot[bot]

Walkthrough

Removes Nunjucks renderer, filters package, in-repo file watcher and test-only ag CLI; makes React the sole render engine; updates generator core, tests, templates, docs, manifests, workflows, and Node/NPM engine requirements.

Changes

Cohort / File(s) Summary
Renderer & filters
apps/generator/lib/renderer/nunjucks.js, apps/generator/lib/filtersRegistry.js, apps/nunjucks-filters/*, apps/nunjucks-filters/src/*, apps/nunjucks-filters/docs/*
Deleted Nunjucks renderer implementation, filters registry, and entire apps/nunjucks-filters package (sources, tests, docs). Public filter APIs and exports removed.
Generator core & utils
apps/generator/lib/generator.js, apps/generator/lib/utils.js, apps/generator/lib/templates/config/validator.js
Removed Nunjucks branches and filter registration; unified rendering to React-only; removed isReactTemplate/isLocalTemplate helpers; updated renderer validation/messages.
Watcher & test CLI
apps/generator/lib/watcher.js, apps/generator/test/cli.js
Removed file-watcher module and watcher-related CLI logic; dropped --watch-template and watcher flows; test CLI imports/path adjustments and deprecation note.
Tests & fixtures
apps/generator/test/*.js, apps/generator/test/test-project/package.json, apps/generator/test/test-templates/nunjucks-template/*, apps/generator/test/test-templates/react-template/.ageneratorrc, apps/generator/lib/__mocks__/utils.js
Deleted Nunjucks-related tests, fixtures, mocks (filtersRegistry, isReactTemplate); updated Jest mappings to drop @asyncapi/nunjucks-filters alias; adjusted test templates and CLI usage.
Package manifests & deps
apps/generator/package.json, apps/nunjucks-filters/package.json, top-level package.json
Removed apps/nunjucks-filters manifest; removed dependencies nunjucks, @asyncapi/nunjucks-filters, chokidar; removed apps/generator bin entries; bumped Node/NPM engine requirements; bumped parser/modelina deps.
Template manifests
packages/templates/.../.ageneratorrc (e.g. packages/templates/clients/.../*.ageneratorrc)
Removed explicit renderer: react entries from multiple template .ageneratorrc files and normalized some description strings.
Docs & migration guides
README.md, Development.md, apps/generator/docs/* (deleted: nunjucks-*, migration-nunjucks-react.md, migration-cli.md, etc.)
Removed Nunjucks-specific docs, Filters section and migration guides; simplified Hooks/docs to React-only and updated development/testing guidance.
Template docs & examples
apps/generator/docs/template*.md, apps/generator/docs/file-templates.md, apps/generator/docs/asyncapi-document.md, apps/generator/docs/template-development.md, apps/generator/docs/generator-template*.md
Removed renderer fields from examples and Nunjucks-specific instructions; updated wording/validation examples to React-only.
Test template content removals
apps/generator/test/test-templates/nunjucks-template/package.json, .../template/test-file.md
Deleted Nunjucks test template manifest and template file content.
CI, Docker & workflows
.github/workflows/*, apps/generator/Dockerfile, packages/templates/.../test/*/microcks-*.yml
Updated workflows to Node 24 or derive Node from lockfile; removed Docker release workflow and apps/generator/Dockerfile; updated Podman test images to Node 24; simplified CI matrix/steps.
Changeset
.changeset/remove-deprecated-nunjucks-cli.md
Added a changeset documenting breaking changes: Node/NPM engine bumps, removal of Nunjucks renderer/filters, and deprecation/removal of ag CLI and watcher features.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • apps/generator/lib/generator.js β€” verify React-only rendering path, template compilation, and no leftover Nunjucks references.
    • tests & mocks β€” ensure all references and Jest mappings for @asyncapi/nunjucks-filters, filtersRegistry, and removed helpers are eliminated.
    • CI/workflows & manifests β€” validate Node/NPM engine bumps, removal of Docker workflow, and bin removal impact on downstream tooling.

Possibly related PRs

  • asyncapi/generator#1329 β€” edits apps/generator/lib/generator.js; likely overlaps with the rendering refactor.
  • asyncapi/generator#1747 β€” modifies Jest config/moduleNameMapper for @asyncapi/nunjucks-filters; directly related to test mapping removals.
  • asyncapi/generator#1445 β€” changes apps/generator/Dockerfile; related because this PR deletes that Dockerfile and Docker publish workflow.

Pre-merge checks and finishing touches

βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The PR title clearly and concisely identifies the main breaking changes: removal of Nunjucks support and the ag CLI, which align with the primary objectives in the linked issue.
Linked Issues check βœ… Passed The PR comprehensively addresses all coding objectives from issue #1720: removes Nunjucks renderer and filters, removes ag CLI code, makes React the default renderer, and updates documentation accordingly.
Out of Scope Changes check βœ… Passed All changes are directly aligned with the removal of Nunjucks and ag CLI. Dependency updates to @asyncapi/parser and @asyncapi/modelina support the transition to React-only rendering and are within scope.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 14 '25 07:11 coderabbitai[bot]

What reviewer looks at during PR review

The following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

asyncapi-bot avatar Nov 14 '25 07:11 asyncapi-bot

πŸš€ Docs preview deployed Below link points directly to the generator docs preview. May the force be with you! β†’ https://6916d4c0145e21b0ff0e2f12--asyncapi-website.netlify.app/docs/tools/generator

asyncapi-bot avatar Nov 14 '25 07:11 asyncapi-bot

πŸš€ Docs preview deployed Below link points directly to the generator docs preview. May the force be with you! β†’ https://6916d4dab5243f1995309f10--asyncapi-website.netlify.app/docs/tools/generator

asyncapi-bot avatar Nov 14 '25 07:11 asyncapi-bot

πŸš€ Docs preview deployed Below link points directly to the generator docs preview. May the force be with you! β†’ https://693bec5e58e65608ecbf25c7--asyncapi-website.netlify.app/docs/tools/generator

asyncapi-bot avatar Nov 19 '25 08:11 asyncapi-bot

Tests are green but of what is left:

  • double check from my side
  • make sure docs changes actually make sense from a big picture perspective
  • and this https://asyncapi.slack.com/archives/CQVJXFNQL/p1763542946954309 as I'd like to change Node dependency in project

And I did not even touch CLI ag removal topic

derberg avatar Nov 19 '25 09:11 derberg

/bounty

aeworxet avatar Nov 19 '25 09:11 aeworxet

@asyncapi/bounty_team

aeworxet avatar Nov 19 '25 09:11 aeworxet

deprecated cli

derberg avatar Nov 22 '25 19:11 derberg

addressing first blocker that is also blocker for releases after security issues: https://github.com/asyncapi/.github/pull/369

derberg avatar Dec 03 '25 19:12 derberg

@aeworxet I just updated the description. Blockers removed. I continue with the task.

derberg avatar Dec 05 '25 16:12 derberg

@magicmatatjahu ready for review

derberg avatar Dec 08 '25 17:12 derberg

/rtm

derberg avatar Dec 16 '25 10:12 derberg