Skip to content

Commit a08f405

Browse files
committed
feat: dynamically load export converters from jsdelivr CDN
1 parent c0f4e21 commit a08f405

12 files changed

Lines changed: 447 additions & 75 deletions

File tree

bun.lock

Lines changed: 7 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/components/BomTable/BomTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { convertCircuitJsonToBomRows } from "circuit-json-to-bom-csv"
21
import { useEffect, useState } from "react"
32
import type React from "react"
3+
import { loadBomCsvConverter } from "../../optional-features/exporting/dynamic-converters"
44
import { getBomCellDescriptors, getBomMetadata } from "./bom-table.columns"
55
import type { BomRow, BomTableProps } from "./bom-table.types"
66

@@ -16,6 +16,7 @@ export const BomTable: React.FC<BomTableProps> = ({ circuitJson }) => {
1616
setError(null)
1717
setRows(null)
1818

19+
const { convertCircuitJsonToBomRows } = await loadBomCsvConverter()
1920
const bomRows = await convertCircuitJsonToBomRows({
2021
circuitJson,
2122
})

lib/components/BomTable/bom-table.types.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import type { AnyCircuitElement } from "circuit-json"
2-
import type { convertCircuitJsonToBomRows } from "circuit-json-to-bom-csv"
32
import type React from "react"
43

54
export interface BomTableProps {
65
circuitJson: AnyCircuitElement[]
76
}
87

9-
export type BomRow = Awaited<
10-
ReturnType<typeof convertCircuitJsonToBomRows>
11-
>[number]
8+
export type BomRow = {
9+
designator?: string
10+
comment?: string
11+
value?: string
12+
footprint?: string
13+
supplier_part_number_columns?: Record<string, string>
14+
extra_columns?: Record<string, string>
15+
manufacturer_mpn_pairs?: Array<{
16+
manufacturer: string
17+
mpn: string
18+
}>
19+
}
1220

1321
export type BomMetadata = {
1422
extraColumnNames: string[]

0 commit comments

Comments
 (0)