Skip to content

refactor(app): restructure plugins into directory modules - #470

Merged
alfredo1996 merged 2 commits into
release/1.1from
refactor/issue-421-plugin-directories-v2
Apr 9, 2026
Merged

refactor(app): restructure plugins into directory modules#470
alfredo1996 merged 2 commits into
release/1.1from
refactor/issue-421-plugin-directories-v2

Conversation

@alfredo1996

@alfredo1996 alfredo1996 commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

Restructures all 17 chart plugins from flat files into self-contained directory modules.

Each plugin now has: component.tsx + settings.ts + transform.ts + index.ts

Also fixes:

  • Restores --webpack flag for production build (Turbopack build not ready for Next.js 16)
  • Removes duplicate nodeClick property in sunburst-chart.tsx

Test plan

  • Build passes (--webpack)
  • 132 files, 1760 tests pass

Closes #421

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Reorganized internal plugin module structure and import paths to improve code organization across all chart plugins and shared utilities.

@alfredo1996 alfredo1996 added pkg:app Next.js application package area:charts Chart rendering refactor Code refactoring labels Apr 9, 2026
@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@alfredo1996 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 59 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 59 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a9ddf2c3-43b2-473f-88f5-69a3024b62fe

📥 Commits

Reviewing files that changed from the base of the PR and between 9f66d84 and 5b4b89a.

📒 Files selected for processing (76)
  • app/src/plugins/bar/component.tsx
  • app/src/plugins/bar/index.ts
  • app/src/plugins/bar/settings.ts
  • app/src/plugins/bar/transform.ts
  • app/src/plugins/form/component.tsx
  • app/src/plugins/form/index.ts
  • app/src/plugins/form/settings.ts
  • app/src/plugins/gauge/component.tsx
  • app/src/plugins/gauge/index.ts
  • app/src/plugins/gauge/settings.ts
  • app/src/plugins/gauge/transform.ts
  • app/src/plugins/graph/component.tsx
  • app/src/plugins/graph/index.ts
  • app/src/plugins/graph/settings.ts
  • app/src/plugins/graph/transform.ts
  • app/src/plugins/iframe/component.tsx
  • app/src/plugins/iframe/index.ts
  • app/src/plugins/iframe/settings.ts
  • app/src/plugins/json/component.tsx
  • app/src/plugins/json/index.ts
  • app/src/plugins/json/settings.ts
  • app/src/plugins/json/transform.ts
  • app/src/plugins/line/component.tsx
  • app/src/plugins/line/index.ts
  • app/src/plugins/line/settings.ts
  • app/src/plugins/line/transform.ts
  • app/src/plugins/map/component.tsx
  • app/src/plugins/map/index.ts
  • app/src/plugins/map/settings.ts
  • app/src/plugins/map/transform.ts
  • app/src/plugins/markdown/component.tsx
  • app/src/plugins/markdown/index.ts
  • app/src/plugins/markdown/settings.ts
  • app/src/plugins/parameter-select/component.tsx
  • app/src/plugins/parameter-select/index.ts
  • app/src/plugins/parameter-select/settings.ts
  • app/src/plugins/parameter-select/transform.ts
  • app/src/plugins/pie/component.tsx
  • app/src/plugins/pie/index.ts
  • app/src/plugins/pie/settings.ts
  • app/src/plugins/pie/transform.ts
  • app/src/plugins/radar/component.tsx
  • app/src/plugins/radar/index.ts
  • app/src/plugins/radar/settings.ts
  • app/src/plugins/radar/transform.ts
  • app/src/plugins/sankey/component.tsx
  • app/src/plugins/sankey/index.ts
  • app/src/plugins/sankey/settings.ts
  • app/src/plugins/sankey/transform.ts
  • app/src/plugins/settings/__tests__/settings-schemas.test.ts
  • app/src/plugins/settings/index.ts
  • app/src/plugins/single-value/component.tsx
  • app/src/plugins/single-value/index.ts
  • app/src/plugins/single-value/settings.ts
  • app/src/plugins/single-value/transform.ts
  • app/src/plugins/sunburst/component.tsx
  • app/src/plugins/sunburst/index.ts
  • app/src/plugins/sunburst/settings.ts
  • app/src/plugins/sunburst/transform.ts
  • app/src/plugins/table/component.tsx
  • app/src/plugins/table/index.ts
  • app/src/plugins/table/settings.ts
  • app/src/plugins/table/transform.ts
  • app/src/plugins/transforms/__tests__/bar.test.ts
  • app/src/plugins/transforms/__tests__/graph.test.ts
  • app/src/plugins/transforms/__tests__/line.test.ts
  • app/src/plugins/transforms/__tests__/pie.test.ts
  • app/src/plugins/transforms/__tests__/remaining.test.ts
  • app/src/plugins/transforms/__tests__/shared.test.ts
  • app/src/plugins/transforms/hierarchical-utils.ts
  • app/src/plugins/transforms/index.ts
  • app/src/plugins/transforms/shared-utils.ts
  • app/src/plugins/treemap/component.tsx
  • app/src/plugins/treemap/index.ts
  • app/src/plugins/treemap/settings.ts
  • app/src/plugins/treemap/transform.ts

Walkthrough

This PR restructures the plugin system by consolidating per-plugin imports (removing nested subdirectories like transforms/bar), establishing centralized shared utilities, adding plugin-level entry points via index.ts files, and redirecting common imports to parent registry/utils modules.

Changes

Cohort / File(s) Summary
Plugin Components
app/src/plugins/{bar,gauge,graph,form,iframe,json,line,map,markdown,parameter-select,pie,radar,sankey,single-value,sunburst,table,treemap}/component.tsx
Updated import paths: defineChartPlugin from ../registry (was ./registry), transform functions from ./transform (was ./transforms/<chart>), PluginProps/useEChartsClick from ../utils (was ./utils), and settings from ./settings (was ./settings/<chart>).
Plugin Entry Points
app/src/plugins/{bar,gauge,graph,form,iframe,json,line,map,markdown,parameter-select,pie,radar,sankey,single-value,sunburst,table,treemap}/index.ts
Added new barrel exports re-exporting each plugin from ./component for cleaner import paths.
Plugin Transform Utilities
app/src/plugins/{bar,gauge,graph,json,line,map,pie,radar,sankey,single-value,table}/transform.ts
Updated shared utility imports to use ../transforms/shared-utils (was ./shared).
Hierarchical Transform Re-exports
app/src/plugins/{sunburst,treemap}/transform.ts
Updated transformToHierarchicalData to import from ../transforms/hierarchical-utils (was ./hierarchical).
Transform Module Consolidation
app/src/plugins/transforms/index.ts
Retargeted all re-exports: shared utilities from ./shared-utils (was ./shared), per-chart transforms from ../<chart>/transform (was ./<chart>), and hierarchical transforms from ./hierarchical-utils (was ./hierarchical).
Settings Centralization Removal
app/src/plugins/settings/index.ts
Deleted centralized settings barrel export; per-plugin settings now imported directly.
Transform Consolidation
app/src/plugins/transforms/hierarchical-utils.ts, shared-utils.ts
Updated internal imports for shared utilities.
Test Import Updates
app/src/plugins/transforms/__tests__/{bar,graph,line,pie}.test.ts, app/src/plugins/transforms/__tests__/remaining.test.ts, app/src/plugins/settings/__tests__/settings-schemas.test.ts, app/src/plugins/transforms/__tests__/shared.test.ts
Updated test imports to reference new transform module locations (../../<chart>/transform) and shared utilities (../shared-utils).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #380: Introduced plugins/utils with PluginProps and useEChartsClick, and established the plugin registry/component contract that this PR now leverages across all plugins.
  • PR #378: Introduced the plugin registry structure and defineChartPlugin that this PR consolidates into parent-level imports across all plugin components.
  • PR #394: Established foundational plugin infrastructure and registry organization that this restructuring builds upon.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: restructuring plugins into directory modules, which is the primary objective of this refactor.
Linked Issues check ✅ Passed The PR successfully implements the requirements from issue #421: converts 17 chart plugins into directory-based modules, collocates component/settings/transform files, updates import paths, and maintains no behavioral changes.
Out of Scope Changes check ✅ Passed All changes are within scope of issue #421. The PR includes a secondary fix (restoring --webpack flag and removing duplicate nodeClick property), which are minor supporting changes aligned with ensuring the build functions correctly after restructuring.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/issue-421-plugin-directories-v2

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.

@alfredo1996
alfredo1996 force-pushed the refactor/issue-421-plugin-directories-v2 branch from 98adf5e to f02ae44 Compare April 9, 2026 01:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/plugins/index.ts (1)

8-11: ⚠️ Potential issue | 🟡 Minor

Update stale documentation comment.

The comment references your-chart.ts (flat file) but the new structure uses directories with component.tsx, settings.ts, transform.ts, and index.ts.

📝 Suggested update
 * To add a new chart plugin:
-*   1. Create `app/src/plugins/your-chart.ts` that exports a plugin
-*      via `defineChartPlugin({ ... })`
+*   1. Create a directory `app/src/plugins/your-chart/` containing:
+*      - component.tsx (exports plugin via `defineChartPlugin`)
+*      - settings.ts, transform.ts, index.ts
 *   2. Add the plugin to the BUILT_IN_PLUGINS array below
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/plugins/index.ts` around lines 8 - 11, Update the stale doc comment
to reflect the new plugin directory structure: instruct contributors to create a
directory under app/src/plugins/your-chart containing component.tsx,
settings.ts, transform.ts and an index.ts that exports the plugin via
defineChartPlugin({...}), and then add that plugin to the BUILT_IN_PLUGINS array
(referencing BUILT_IN_PLUGINS and defineChartPlugin to locate the relevant
code).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/plugins/index.ts`:
- Around line 19-35: Replace the 17 direct component path imports (e.g., import
{ barPlugin } from "./bar/component";) with barrel imports that use each plugin
directory's index.ts re-exports (e.g., import { barPlugin } from "./bar";),
doing this for markdownPlugin, barPlugin, linePlugin, piePlugin,
singleValuePlugin, graphPlugin, mapPlugin, tablePlugin, parameterSelectPlugin,
jsonPlugin, formPlugin, iframePlugin, gaugePlugin, sankeyPlugin, sunburstPlugin,
radarPlugin, and treemapPlugin so the per-plugin index.ts files are actually
used and the component paths are not referenced directly.

In `@app/src/plugins/single-value/index.ts`:
- Line 1: The barrel export currently re-exports singleValuePlugin (export {
singleValuePlugin } from "./component") but the registry bypasses it by
importing directly from "./single-value/component"; update the registry import
in the plugins index to import singleValuePlugin from "./single-value" (so it
uses the barrel), ensuring the exported symbol name singleValuePlugin matches
and removing the direct "./single-value/component" import to keep the directory
module pattern consistent.

---

Outside diff comments:
In `@app/src/plugins/index.ts`:
- Around line 8-11: Update the stale doc comment to reflect the new plugin
directory structure: instruct contributors to create a directory under
app/src/plugins/your-chart containing component.tsx, settings.ts, transform.ts
and an index.ts that exports the plugin via defineChartPlugin({...}), and then
add that plugin to the BUILT_IN_PLUGINS array (referencing BUILT_IN_PLUGINS and
defineChartPlugin to locate the relevant code).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5451119b-9a18-4afe-a48d-f8adf2f938c5

📥 Commits

Reviewing files that changed from the base of the PR and between 2fcd6ed and f02ae44.

📒 Files selected for processing (78)
  • app/package.json
  • app/src/plugins/bar/component.tsx
  • app/src/plugins/bar/index.ts
  • app/src/plugins/bar/settings.ts
  • app/src/plugins/bar/transform.ts
  • app/src/plugins/form/component.tsx
  • app/src/plugins/form/index.ts
  • app/src/plugins/form/settings.ts
  • app/src/plugins/gauge/component.tsx
  • app/src/plugins/gauge/index.ts
  • app/src/plugins/gauge/settings.ts
  • app/src/plugins/gauge/transform.ts
  • app/src/plugins/graph/component.tsx
  • app/src/plugins/graph/index.ts
  • app/src/plugins/graph/settings.ts
  • app/src/plugins/graph/transform.ts
  • app/src/plugins/iframe/component.tsx
  • app/src/plugins/iframe/index.ts
  • app/src/plugins/iframe/settings.ts
  • app/src/plugins/index.ts
  • app/src/plugins/json/component.tsx
  • app/src/plugins/json/index.ts
  • app/src/plugins/json/settings.ts
  • app/src/plugins/json/transform.ts
  • app/src/plugins/line/component.tsx
  • app/src/plugins/line/index.ts
  • app/src/plugins/line/settings.ts
  • app/src/plugins/line/transform.ts
  • app/src/plugins/map/component.tsx
  • app/src/plugins/map/index.ts
  • app/src/plugins/map/settings.ts
  • app/src/plugins/map/transform.ts
  • app/src/plugins/markdown/component.tsx
  • app/src/plugins/markdown/index.ts
  • app/src/plugins/markdown/settings.ts
  • app/src/plugins/parameter-select/component.tsx
  • app/src/plugins/parameter-select/index.ts
  • app/src/plugins/parameter-select/settings.ts
  • app/src/plugins/parameter-select/transform.ts
  • app/src/plugins/pie/component.tsx
  • app/src/plugins/pie/index.ts
  • app/src/plugins/pie/settings.ts
  • app/src/plugins/pie/transform.ts
  • app/src/plugins/radar/component.tsx
  • app/src/plugins/radar/index.ts
  • app/src/plugins/radar/settings.ts
  • app/src/plugins/radar/transform.ts
  • app/src/plugins/sankey/component.tsx
  • app/src/plugins/sankey/index.ts
  • app/src/plugins/sankey/settings.ts
  • app/src/plugins/sankey/transform.ts
  • app/src/plugins/settings/__tests__/settings-schemas.test.ts
  • app/src/plugins/settings/index.ts
  • app/src/plugins/single-value/component.tsx
  • app/src/plugins/single-value/index.ts
  • app/src/plugins/single-value/settings.ts
  • app/src/plugins/single-value/transform.ts
  • app/src/plugins/sunburst/component.tsx
  • app/src/plugins/sunburst/index.ts
  • app/src/plugins/sunburst/settings.ts
  • app/src/plugins/sunburst/transform.ts
  • app/src/plugins/table/component.tsx
  • app/src/plugins/table/index.ts
  • app/src/plugins/table/settings.ts
  • app/src/plugins/table/transform.ts
  • app/src/plugins/transforms/__tests__/bar.test.ts
  • app/src/plugins/transforms/__tests__/graph.test.ts
  • app/src/plugins/transforms/__tests__/line.test.ts
  • app/src/plugins/transforms/__tests__/pie.test.ts
  • app/src/plugins/transforms/__tests__/remaining.test.ts
  • app/src/plugins/transforms/__tests__/shared.test.ts
  • app/src/plugins/transforms/hierarchical-utils.ts
  • app/src/plugins/transforms/index.ts
  • app/src/plugins/transforms/shared-utils.ts
  • app/src/plugins/treemap/component.tsx
  • app/src/plugins/treemap/index.ts
  • app/src/plugins/treemap/settings.ts
  • app/src/plugins/treemap/transform.ts
💤 Files with no reviewable changes (1)
  • app/src/plugins/settings/index.ts

Comment thread app/src/plugins/index.ts Outdated
Comment thread app/src/plugins/single-value/index.ts
@alfredo1996
alfredo1996 force-pushed the refactor/issue-421-plugin-directories-v2 branch 4 times, most recently from 0d39cab to 9f66d84 Compare April 9, 2026 11:59
alfredorubin96 and others added 2 commits April 9, 2026 14:47
Move each chart plugin from flat files into self-contained directories:
  plugins/bar.tsx → plugins/bar/component.tsx + settings.ts + transform.ts + index.ts

All 17 plugins restructured. Each directory colocates component, settings
schema, and data transform. Shared utilities remain in plugins/transforms/.

Also fixes:
- Restore --webpack flag for production build (Turbopack build not ready)
- Remove duplicate nodeClick property in sunburst-chart.tsx

Closes #421

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ack)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alfredo1996
alfredo1996 force-pushed the refactor/issue-421-plugin-directories-v2 branch from 9f66d84 to 5b4b89a Compare April 9, 2026 12:48
@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
71.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@alfredo1996
alfredo1996 merged commit 1b189a2 into release/1.1 Apr 9, 2026
20 of 23 checks passed
alfredo1996 added a commit that referenced this pull request May 10, 2026
* refactor(app): restructure plugins into directory modules, fix build

Move each chart plugin from flat files into self-contained directories:
  plugins/bar.tsx → plugins/bar/component.tsx + settings.ts + transform.ts + index.ts

All 17 plugins restructured. Each directory colocates component, settings
schema, and data transform. Shared utilities remain in plugins/transforms/.

Also fixes:
- Restore --webpack flag for production build (Turbopack build not ready)
- Remove duplicate nodeClick property in sunburst-chart.tsx

Closes #421

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: use barrel imports for plugin directories (CodeRabbit feedback)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: alfredorubin96 <alfredo.rubin@neotechnology.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alfredo1996
alfredo1996 deleted the refactor/issue-421-plugin-directories-v2 branch May 16, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:charts Chart rendering pkg:app Next.js application package refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants