Files
insights/frontend/bin/docs/build-survey-sdk-docs.ts
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

96 lines
3.4 KiB
TypeScript

#!/usr/bin/env ts-node
;['.scss', '.css', '.svg', '.png', '.jpg', '.jpeg', '.gif'].forEach((ext) => {
require.extensions[ext] = () => {}
})
import * as fs from 'fs'
import * as path from 'path'
import { SURVEY_SDK_REQUIREMENTS, SurveySdkType } from '../../src/scenes/surveys/surveyVersionRequirements'
const SDK_INFO: Record<SurveySdkType, { name: string; docsUrl: string }> = {
'insights-js': { name: 'JavaScript Web', docsUrl: '/docs/libraries/js' },
'insights-react-native': { name: 'React Native', docsUrl: '/docs/libraries/react-native' },
'insights-ios': { name: 'iOS', docsUrl: '/docs/libraries/ios' },
'insights-android': { name: 'Android', docsUrl: '/docs/libraries/android' },
insights_flutter: { name: 'Flutter', docsUrl: '/docs/libraries/flutter' },
}
const SDK_ORDER: SurveySdkType[] = [
'insights-js',
'insights-react-native',
'insights-ios',
'insights-android',
'insights_flutter',
]
function generateMarkdown(): string {
const lines: string[] = [
'---',
'title: SDK feature support',
'sidebar: Docs',
'showTitle: true',
'---',
'',
"import { IconCheck, IconWrench, IconX } from '@hanzo/icons'",
'',
'Not all survey features are available on every SDK. Web has the most complete support, while mobile SDKs have some limitations.',
'',
'For setup instructions, see the [installation guides](/docs/surveys/installation).',
'',
]
const headerCells = ['Feature', ...SDK_ORDER.map((sdk) => `[${SDK_INFO[sdk].name}](${SDK_INFO[sdk].docsUrl})`)]
// Build all data rows first to calculate column widths
const dataRows: string[][] = []
for (const req of SURVEY_SDK_REQUIREMENTS) {
const cells: string[] = [req.feature]
for (const sdk of SDK_ORDER) {
const minVersion = req.sdkVersions[sdk]
const unsupported = req.unsupportedSdks.find((u) => u.sdk === sdk)
if (minVersion) {
cells.push(`<IconCheck className="w-4 h-4 inline text-green" /> ${minVersion}+`)
} else if (unsupported) {
if (unsupported.issue === false) {
cells.push(`<IconX className="w-4 h-4 inline text-red" />`)
} else {
cells.push(
`<a href="${unsupported.issue}"><IconWrench className="w-4 h-4 inline text-muted" /></a>`
)
}
} else {
cells.push('—')
}
}
dataRows.push(cells)
}
// Calculate column widths (max of header and all data cells)
const colWidths = headerCells.map((header, i) => {
const dataMax = Math.max(...dataRows.map((row) => row[i].length))
return Math.max(header.length, dataMax)
})
// Format rows with padding
const formatRow = (cells: string[]): string =>
'| ' + cells.map((cell, i) => cell.padEnd(colWidths[i])).join(' | ') + ' |'
lines.push(formatRow(headerCells))
lines.push('| ' + colWidths.map((w) => '-'.repeat(w)).join(' | ') + ' |')
for (const row of dataRows) {
lines.push(formatRow(row))
}
return lines.join('\n')
}
const outputPath = path.resolve(__dirname, '../../../docs/published/docs/surveys/sdk-feature-support.mdx')
const content = generateMarkdown()
fs.writeFileSync(outputPath, content + '\n', 'utf-8')