@tscircuit/cli 0.0.211 → 0.0.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.lockb +0 -0
- package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -1
- package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +7 -2
- package/cli/lib/cmd-fns/soupify.ts +0 -1
- package/cli/lib/cmd-fns/version.ts +0 -4
- package/cli/lib/export-fns/export-bom-csv.ts +5 -3
- package/cli/lib/export-fns/export-pnp-csv.ts +2 -2
- package/cli/lib/soupify/soupify.ts +1 -72
- package/dist/cli.js +74 -118
- package/package.json +4 -4
package/bun.lockb
CHANGED
|
Binary file
|
|
@@ -6,15 +6,20 @@ import fg from "fast-glob"
|
|
|
6
6
|
import fs from "fs"
|
|
7
7
|
import { Project, ts } from "ts-morph"
|
|
8
8
|
import * as Path from "path"
|
|
9
|
-
import type { ManualPcbPosition } from "@tscircuit/builder"
|
|
10
9
|
import { deriveSelectorFromPcbComponentId } from "./derive-selector-from-pcb-component-id"
|
|
11
10
|
import type { EditEvent } from "@tscircuit/manual-edit-events"
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getManualTraceHintFromEvent,
|
|
13
|
+
ManualTraceHint,
|
|
14
|
+
ManualEditFile,
|
|
15
|
+
} from "@tscircuit/layout"
|
|
13
16
|
import JSON5 from "json5"
|
|
14
17
|
import Debug from "debug"
|
|
15
18
|
|
|
16
19
|
const debug = Debug("tscircuit:cli:edit-event-watcher")
|
|
17
20
|
|
|
21
|
+
type ManualPcbPosition = Required<ManualEditFile>["pcb_placements"][number]
|
|
22
|
+
|
|
18
23
|
export const startEditEventWatcher = async (
|
|
19
24
|
{
|
|
20
25
|
devServerAxios,
|
|
@@ -22,10 +22,6 @@ export const versionCmd = async (ctx: AppContext, args: any) => {
|
|
|
22
22
|
name: "@tscircuit/pcb-viewer",
|
|
23
23
|
current: cliPackageJson.devDependencies["@tscircuit/pcb-viewer"],
|
|
24
24
|
})
|
|
25
|
-
table.push({
|
|
26
|
-
name: "@tscircuit/builder",
|
|
27
|
-
current: cliPackageJson.dependencies["@tscircuit/builder"],
|
|
28
|
-
})
|
|
29
25
|
|
|
30
26
|
if (args.showLatest) {
|
|
31
27
|
// Get the latest version for each package
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AppContext } from "../util/app-context"
|
|
2
2
|
import { soupify } from "cli/lib/soupify"
|
|
3
|
-
import { convertSoupToBomRows, convertBomRowsToCsv } from "@tscircuit/builder"
|
|
4
3
|
import kleur from "kleur"
|
|
4
|
+
import {
|
|
5
|
+
convertCircuitJsonToBomRows,
|
|
6
|
+
convertBomRowsToCsv,
|
|
7
|
+
} from "circuit-json-to-bom-csv"
|
|
5
8
|
|
|
6
9
|
export const exportBomCsvToBuffer = async (
|
|
7
10
|
params: {
|
|
@@ -20,8 +23,7 @@ export const exportBomCsvToBuffer = async (
|
|
|
20
23
|
)
|
|
21
24
|
|
|
22
25
|
console.log(kleur.gray("[soup to bom rows]..."))
|
|
23
|
-
|
|
24
|
-
const bom_rows = await convertSoupToBomRows({ soup })
|
|
26
|
+
const bom_rows = await convertCircuitJsonToBomRows({ circuitJson: soup })
|
|
25
27
|
|
|
26
28
|
console.log(kleur.gray("[bom rows to csv]..."))
|
|
27
29
|
const bom_csv = await convertBomRowsToCsv(bom_rows)
|
|
@@ -3,8 +3,8 @@ import { z } from "zod"
|
|
|
3
3
|
import * as Path from "path"
|
|
4
4
|
import { unlink } from "node:fs/promises"
|
|
5
5
|
import { soupify } from "cli/lib/soupify"
|
|
6
|
+
import { convertCircuitJsonToPickAndPlaceCsv } from "circuit-json-to-pnp-csv"
|
|
6
7
|
import * as fs from "fs"
|
|
7
|
-
import { convertSoupToPickAndPlaceCsv } from "@tscircuit/builder"
|
|
8
8
|
import kleur from "kleur"
|
|
9
9
|
import archiver from "archiver"
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ export const exportPnpCsvToBuffer = async (
|
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
console.log(kleur.gray("[soup to pnp csv string]..."))
|
|
28
|
-
const pnp_csv = await
|
|
28
|
+
const pnp_csv = await convertCircuitJsonToPickAndPlaceCsv(soup)
|
|
29
29
|
|
|
30
30
|
return Buffer.from(pnp_csv, "utf-8")
|
|
31
31
|
}
|
|
@@ -1,77 +1,6 @@
|
|
|
1
|
-
import { AppContext } from "../util/app-context"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import $ from "dax-sh"
|
|
4
|
-
import * as Path from "path"
|
|
5
|
-
import { unlink } from "node:fs/promises"
|
|
6
|
-
import kleur from "kleur"
|
|
7
|
-
import { writeFileSync } from "fs"
|
|
8
|
-
import { readFile } from "fs/promises"
|
|
9
1
|
import Debug from "debug"
|
|
10
2
|
import { soupifyWithCore } from "./soupify-with-core"
|
|
11
|
-
import { getExportNameFromFile } from "./get-export-name-from-file"
|
|
12
|
-
import { getTmpEntrypointFilePath } from "./get-tmp-entrpoint-filepath"
|
|
13
|
-
import { runEntrypointFile } from "./run-entrypoint-file"
|
|
14
3
|
|
|
15
4
|
const debug = Debug("tscircuit:soupify")
|
|
16
5
|
|
|
17
|
-
export const
|
|
18
|
-
params: {
|
|
19
|
-
filePath: string
|
|
20
|
-
exportName?: string
|
|
21
|
-
/**
|
|
22
|
-
* Use @tscircuit/core instead of @tscircuit/builder, this will be the
|
|
23
|
-
* default eventually
|
|
24
|
-
*/
|
|
25
|
-
useCore?: boolean
|
|
26
|
-
},
|
|
27
|
-
ctx: Pick<AppContext, "runtime" | "params">,
|
|
28
|
-
) => {
|
|
29
|
-
let { filePath, exportName, useCore = true } = params
|
|
30
|
-
if (useCore) return soupifyWithCore(params, ctx)
|
|
31
|
-
|
|
32
|
-
exportName ??= await getExportNameFromFile(filePath)
|
|
33
|
-
|
|
34
|
-
const { tmpEntrypointPath, tmpOutputPath } =
|
|
35
|
-
await getTmpEntrypointFilePath(filePath)
|
|
36
|
-
|
|
37
|
-
debug(`writing to ${tmpEntrypointPath}`)
|
|
38
|
-
writeFileSync(
|
|
39
|
-
tmpEntrypointPath,
|
|
40
|
-
`
|
|
41
|
-
import React from "react"
|
|
42
|
-
import { createRoot } from "@tscircuit/react-fiber"
|
|
43
|
-
import { createProjectBuilder } from "@tscircuit/builder"
|
|
44
|
-
import { writeFileSync } from "node:fs"
|
|
45
|
-
|
|
46
|
-
let Component
|
|
47
|
-
try {
|
|
48
|
-
const EXPORTS = await import("./${Path.basename(filePath)}")
|
|
49
|
-
Component = EXPORTS["${exportName}"]
|
|
50
|
-
} catch (e) {
|
|
51
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify({
|
|
52
|
-
COMPILE_ERROR: e.message + "\\n\\n" + e.stack,
|
|
53
|
-
}))
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!Component) {
|
|
57
|
-
console.log(JSON.stringify({
|
|
58
|
-
COMPILE_ERROR: 'Failed to find "${exportName}" export in "${filePath}"'
|
|
59
|
-
}))
|
|
60
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify({
|
|
61
|
-
COMPILE_ERROR: e.message + "\\n\\n" + e.stack,
|
|
62
|
-
}))
|
|
63
|
-
process.exit(0)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const projectBuilder = createProjectBuilder()
|
|
67
|
-
const elements = await createRoot().render(<Component />, projectBuilder)
|
|
68
|
-
|
|
69
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify(elements))
|
|
70
|
-
|
|
71
|
-
`.trim(),
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
return await runEntrypointFile({ tmpEntrypointPath, tmpOutputPath }, ctx)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const soupify = soupifyWithBuilder
|
|
6
|
+
export const soupify = soupifyWithCore
|