Repository navigation
refactor(echarts): one function per file, and New-UDEChart in steps - #173
Merged
Merged
Conversation
The functions move unchanged, split by the parser's extents. The .psm1 only loads them, as in the pivot module: a source checkout loads shared/powershell directly, recognised by the missing Private/SHARED.txt. Refs #169 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…b each New-UDEChart registers its handlers, builds the props every chart has, adds those of the parameters given and warns about parameters the chart type ignores, each through a helper. Inputs are passed as parameters; helpers that read many of its parameters get $PSBoundParameters as -Bound. 193 code lines become 121 (108 of them the param() block). The growth baseline is lowered. Refs #169 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ModuleFiles.Tests.ps1 holds the two tests PivotModule.Tests.ps1 had (Public/ matches FunctionsToExport, the -Bound keys) and runs them for both split modules; the build test of Public/ and Private/ runs for both too. AGENTS.md names both split modules and the moved test. Refs #169 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m the review - ECharts.Tests: each New-UDEChart parameter given arrives as its camelCase prop, a choice in lower case; a mistyped map entry or a missing lower-casing fails it. - ModuleFiles.Tests: $script:module, as PSScriptAnalyzer asks; the build test names its module. - Register-UDEChartEvent discards what Endpoint.Register returns. Refs #169 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #169
PowerShellUniversal.Component.ECharts.psm1held 7 functions in 329 code lines, andNew-UDECharthad 193 code lines. This pull request splits the module the way #171 split Pivot and shortensNew-UDEChart. Commands, parameters, help and output stay the same.What changed
Public/: the 3 exported commands, one per file.Private/: the 4 helpers that were in the module file, unchanged, and 4 new ones. The functions moved by the parser's extents, so their text is unchanged in the first commit..psm1only loads, like Pivot's:Export-ModuleMembertakes the file names, and a source checkout loadsshared/powershelldirectly (recognised by the missingPrivate/SHARED.txt).Build-Module.ps1already copiesPublic/andPrivate/.New-UDEChartruns its steps through helpers with one job each:Register-UDEChartEvent: registers the handlers under the chart's id and returns their props.New-UDEChartProp: the props every chart has. The parameters with a default are passed on their own, because they are not in$PSBoundParameters.Get-UDEChartOptionalProp: the props of the parameters given, with the conversions (themes, tooltip mode, colour map, choices in lower case).Write-UDEChartTypeWarning: the warning for a parameter the chart type ignores. It still reaches-WarningActionand-WarningVariableofNew-UDEChart.The order of the steps is the same: handlers first, the props, then the warnings.
FunctionsToExport; every$Bound['key']a helper reads is a parameter of a public command) now live inModuleFiles.Tests.ps1and run for both split modules. The build test that the built module carriesPublic/andPrivate/and exports the manifest's commands runs for both too. I checked that the-Boundtest fails for a misspelled key in an ECharts helper.New-UDEChartgoes from 193 to 121.Growth numbers
PowerShellUniversal.Component.ECharts.psm1(file)New-UDEChartparam()block)New-UDEChartstays over the limit of 100 because itsparam()block alone has 103 parameters on 108 lines. Getting under it would mean changing the command's parameters, which this pull request keeps as they are.Checks
Get-Command -Modulewith parameter sets, parameter attributes andOutputType,Get-Help -Fullof every command, and the exported functions: identical before and after, for the source module and the built module.New-UDEChartfor seven calls that together use every parameter, with all four handlers: identical props, the same handler registrations and the same warnings as onmain.docs/site/Build-Site.ps1:docs/site/generated/is identical before and after. Its examples run the realNew-UDEChart.New-UDEChartand checks that it arrives under its camelCase prop, a choice in lower case. The parameter map had no such test before. I checked that it fails for a mistyped map entry and for a choice left out of the lower-casing.npm test: 165 passed. PSScriptAnalyzer as in CI: no findings. Growth: all four guards ok.Build-Module.ps1for all five modules.docs/(no page names the module file),docs/development, Build-Site, CI, the tests that import the module.Not tested on PSU
I did not run this on a PowerShell Universal instance. Not covered without PSU:
Endpointtype and the asset id).Endpoint.Registerwith PSU's real type: the handlers are now registered from a helper, withNew-UDEChart's$PSCmdletpassed on. Its result is discarded, so a return value could not reach the props.Not in this pull request
.psm1is the same nine lines in Pivot and ECharts. A shared loader would have to be found beforeshared/is loaded, so I kept the copy. If a third module is split, it is worth a shared piece.Endpointstub for tests outside PSU is now in three test files. A shared test helper would hold it once; I left that for a separate change.🤖 Generated with Claude Code