feat(site): add openstaxToSite to --import-structure - #32
Merged
Merged
Conversation
Refs haxtheweb/issues#2912. Step 3 of the plan on that issue: the converter and its dispatcher case merged in haxtheweb/haxcms-nodejs#40, but `hax site --import-site <book> --import-structure openstaxToSite` had no mapping, so the name fell through to the hidden-methodologies branch and silently did nothing. Maps openstaxToSite to the site/import/:platform dispatcher case 'openstax' - the same in-process on-prem route call the other platform converters make - and lists it in the --import-structure help for both commands and in the man page. xlsxToSite was mapped but absent from both lists, so it is listed now too. IMPORT_STRUCTURE_MAP is exported so the wiring can be asserted, and test/unit/site-imports.test.cjs covers it: every platform importer maps to its dispatcher platform, docx and xlsx keep their own action routes, and every mapped importer appears in both the help text and the man page. That last check is the drift that let the OpenStax importer ship unreachable. The CLI path depends on a published haxcms-nodejs that carries the converter; @haxtheweb/haxcms-nodejs 26.8.1, the version this repo installs today, predates it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Refs haxtheweb/issues#2912 — step 3 of 3 from the implementation plan. The converter and its dispatcher case merged in haxtheweb/haxcms-nodejs#40, which closed the issue, but steps 2 and 3 were never done. This is the CLI half; the dashboard half is haxtheweb/webcomponents#828.
What was missing
openstaxToSitehad no entry inIMPORT_STRUCTURE_MAP, so the name fell through to the hidden-methodologies branch and the command silently did nothing — no import, no error.What this does
src/lib/programs/site.js— mapsopenstaxToSiteto thesite/import/:platformdispatcher caseopenstax, the same in-process on-prem route call the other platform converters make, so no server and no external service are involved.src/create.js— lists it in the--import-structurehelp for both commands.xlsxToSitewas mapped but missing from that help, so it is listed now too.src/docs/hax.1— the same two additions in the man page.IMPORT_STRUCTURE_MAPis exported so the wiring can be asserted from tests.Tests
test/unit/site-imports.test.cjs(4 tests) pins the wiring:openstaxToSiteincluded;openstaxToSiteresolves to theopenstaxcase;docxToSiteandxlsxToSitekeep their own action routes;--import-structurehelp and the man page — the drift that let the OpenStax importer ship unreachable and leftxlsxToSiteundocumented.npm run test:unitnpm run test:smokeRemoving the map entry fails two of the new tests; removing the name from either the help text or the man page fails the drift test. (
node_moduleswas absent in my checkout, so the suite needsnpm cibefore it runs at all.)One dependency note
The CLI reaches the converter through the published
@haxtheweb/haxcms-nodejs, and the version this repo installs today (26.8.1) predates the converter, so this path starts working once a release carrying haxtheweb/haxcms-nodejs#40 is out. The dashboard half has no such wait: it calls the running instance's own route.🤖 Generated with Claude Code