Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fix builder not recognizing <chip />
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Aug 29, 2024
1 parent 7af5309 commit e5c5d2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
19 changes: 15 additions & 4 deletions cli/lib/soupify/soupify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { runEntrypointFile } from "./run-entrypoint-file"

const debug = Debug("tscircuit:soupify")

export const soupify = async (
export const soupifyWithBuilder = async (
params: {
filePath: string
exportName?: string
Expand Down Expand Up @@ -43,14 +43,23 @@ import { createRoot } from "@tscircuit/react-fiber"
import { createProjectBuilder } from "@tscircuit/builder"
import { writeFileSync } from "node:fs"
import * as EXPORTS from "./${Path.basename(filePath)}"
const Component = EXPORTS["${exportName}"]
let Component
try {
const EXPORTS = await import("./${Path.basename(filePath)}")
Component = EXPORTS["${exportName}"]
} catch (e) {
writeFileSync("${tmpOutputPath}", JSON.stringify({
COMPILE_ERROR: e.message + "\\n\\n" + e.stack,
}))
}
if (!Component) {
console.log(JSON.stringify({
COMPILE_ERROR: 'Failed to find "${exportName}" export in "${filePath}"'
}))
writeFileSync("${tmpOutputPath}", JSON.stringify({
COMPILE_ERROR: e.message + "\\n\\n" + e.stack,
}))
process.exit(0)
}
Expand All @@ -64,3 +73,5 @@ writeFileSync("${tmpOutputPath}", JSON.stringify(elements))

return await runEntrypointFile({ tmpEntrypointPath, tmpOutputPath }, ctx)
}

export const soupify = soupifyWithBuilder
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@hono/node-server": "^1.8.2",
"@tscircuit/builder": "*",
"@tscircuit/core": "^0.0.11",
"@tscircuit/react-fiber": "1.2.0",
"archiver": "^7.0.1",
"axios": "^1.6.7",
"chokidar": "^3.6.0",
Expand Down Expand Up @@ -97,7 +98,6 @@
"@tscircuit/layout": "^0.0.25",
"@tscircuit/manual-edit-events": "^0.0.4",
"@tscircuit/pcb-viewer": "^1.4.4",
"@tscircuit/react-fiber": "*",
"@tscircuit/schematic-viewer": "^1.2.14",
"@tscircuit/soup-util": "^0.0.18",
"@tscircuit/table-viewer": "0.0.8",
Expand Down

0 comments on commit e5c5d2c

Please sign in to comment.