-
Notifications
You must be signed in to change notification settings - Fork 163
HF-249 bullet 3: generate built-in functions docs from the HF API (single source of truth) #1699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marcin-kordas-hoc
wants to merge
23
commits into
feature/hf-249-function-metadata-api
Choose a base branch
from
feature/hf-249-docs-single-source
base: feature/hf-249-function-metadata-api
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
64746c1
feat(metadata): add formatFunctionSyntax helper (HF-249)
marcin-kordas-hoc 014d735
feat(metadata): add pure built-in functions table renderer and marker…
marcin-kordas-hoc 366e6f5
docs(guide): add autogeneration markers around the functions table (H…
marcin-kordas-hoc 6111bb9
docs(guide): keep functions-count line outside the autogeneration mar…
marcin-kordas-hoc 3738a50
docs(guide): place do-not-edit note above the START marker so regener…
marcin-kordas-hoc 080838c
feat(docs): generate built-in functions table from HF API (HF-249)
marcin-kordas-hoc 2ec0142
feat(metadata): surface OFFSET and VERSION via the function-metadata …
marcin-kordas-hoc f52cbaa
docs(guide): regenerate built-in functions table to include OFFSET an…
marcin-kordas-hoc b8b701f
feat(docs): fail the drift check when the function set changes (HF-249)
marcin-kordas-hoc f25e4c8
style(docs): join id arrays in drift-check message to satisfy lint (H…
marcin-kordas-hoc 4d228dc
build(docs): add docs:generate-functions and drift-check scripts (HF-…
marcin-kordas-hoc 0fce9e2
docs(dev): avoid asserting CI wiring not yet added (HF-249)
marcin-kordas-hoc 52f1096
ci(docs): fail build-docs if the functions table is stale (HF-249)
marcin-kordas-hoc cfa6cd8
fix(metadata): break renderer ties by canonicalName, soften stale pro…
marcin-kordas-hoc 18615a3
docs(metadata): drop internal spec ref, note English-only collator (H…
marcin-kordas-hoc bb9ef76
fix(metadata): keep static getFunctionDetails protected-aware after #…
marcin-kordas-hoc 0fd31f7
build(docs): regenerate the functions table at docs:build; drop the C…
marcin-kordas-hoc 66a5da5
feat(metadata): strip doc markup from getFunctionDetails shortDescrip…
marcin-kordas-hoc 3d7bbe6
chore(metadata): remove the one-time migration script and its danglin…
marcin-kordas-hoc f6dde48
fix(metadata): snake_case OFFSET parameter names to match the catalog…
marcin-kordas-hoc 490c6eb
docs(guide): regenerate built-in functions table from the catalogue (…
marcin-kordas-hoc 7ae63e8
fix(metadata): keep protected metadata resolution fail-safe when stru…
marcin-kordas-hoc b1098fd
chore(docs): drop the vestigial --check mode from the functions-table…
marcin-kordas-hoc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * @license | ||
| * Copyright (c) 2025 Handsoncode. All rights reserved. | ||
| */ | ||
|
|
||
| /** | ||
| * HF-249 bullet 3 — generates the built-in functions table in `docs/guide/built-in-functions.md` from | ||
| * HyperFormula's public API (single source of truth). Dev-only; never shipped (`tsconfig.json` `include` is | ||
| * `["src"]`). Run via `npm run docs:generate-functions`; it also runs as the first step of `docs:build` and | ||
| * `docs:dev`, so the committed table is regenerated on every build and cannot drift from the catalogue. | ||
| */ | ||
|
|
||
| import * as fs from 'fs' | ||
| import * as path from 'path' | ||
| import {HyperFormula} from '../src' | ||
| import {renderBuiltinFunctionsTable, spliceFunctionsTable} from '../src/interpreter/functionMetadata/renderBuiltinFunctionsTable' | ||
|
|
||
| const REPO_ROOT = path.resolve(__dirname, '..') | ||
| const DOC_PATH = path.join(REPO_ROOT, 'docs/guide/built-in-functions.md') | ||
| const LANGUAGE = 'enGB' | ||
|
|
||
| /** Reads the doc file and returns a new version with the generated table region spliced in. */ | ||
| function buildUpdatedFile(): string { | ||
| const entries = HyperFormula.getAvailableFunctions(LANGUAGE) | ||
| const detailsFor = (canonicalName: string) => HyperFormula.getFunctionDetails(canonicalName, LANGUAGE) | ||
| const generated = renderBuiltinFunctionsTable(entries, detailsFor) | ||
| const current = fs.readFileSync(DOC_PATH, 'utf8') | ||
| return spliceFunctionsTable(current, generated) | ||
| } | ||
|
|
||
| /** Regenerates the table region of the doc file from the current catalogue. */ | ||
| function main(): void { | ||
| fs.writeFileSync(DOC_PATH, buildUpdatedFile(), 'utf8') | ||
| process.stdout.write('built-in-functions.md regenerated.\n') | ||
| } | ||
|
|
||
| main() |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.