Exporter-SDK
De exporter is een set pure functies over DrawtonomySnapshot.
Een nieuw doelformaat toevoegen is op zichzelf staand: een
nieuwe module, een paar tests en een optionele UI-hook.
Deze pagina is een snelle oriëntatie. De volledige handleiding — architectuur, API, testpatronen, esmini visuele controles — staat in de openbare repo:
➡ Exporter Developer Guide (日本語)
Snelstart
Section titled “Snelstart”git clone https://github.com/kosuke55/drawtonomy.gitcd drawtonomypnpm installcd packages/drawtonomy-sdkpnpm exec vitest exporter # watch modeMinimale nieuwe exporter
Section titled “Minimale nieuwe exporter”import type { DrawtonomySnapshot } from '../types'
export function exportToMyFormat(snapshot: DrawtonomySnapshot): string { // Loop over vormen, zend uw formaat uit. return ''}import { describe, it, expect } from 'vitest'import { exportToMyFormat } from '../../src/exporter/my-format'import { createSnapshot, createLane } from '../../src/index'
describe('my-format exporter', () => { it('emits expected payload for a single lane', () => { const snapshot = createSnapshot([createLane(/* ... */)]) expect(exportToMyFormat(snapshot)).toContain('<expected/>') })})Een echte scène als fixture gebruiken
Section titled “Een echte scène als fixture gebruiken”drawtonomy.svg-bestanden round-trippen door de SDK, dus u kunt
een scène maken in de editor en deze gebruiken als invoer voor
regressietests:
import { readFileSync } from 'node:fs'import { parseDrawtonomySvg } from '@drawtonomy/sdk'
const svg = readFileSync('./fixtures/my-scene.drawtonomy.svg', 'utf-8')const snapshot = parseDrawtonomySvg(svg)!Zie ook
Section titled “Zie ook”- Exporter-architectuur — de pijplijn en waarom deze puur is.
@drawtonomy/sdk-overzicht