@tscircuit/cli 0.1.31 → 0.1.33

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.
@@ -4,6 +4,10 @@ import webWorkerBundleUrl from "@tscircuit/eval/blob-url"
4
4
  import { getVirtualFileSystemFromDirPath } from "make-vfs"
5
5
  import path from "node:path"
6
6
  import fs from "node:fs"
7
+ import {
8
+ convertCircuitJsonToSchematicSvg,
9
+ convertCircuitJsonToPcbSvg,
10
+ } from "circuit-to-svg"
7
11
 
8
12
  const ALLOWED_FORMATS = [
9
13
  "json",
@@ -75,13 +79,25 @@ circuit.add(<MyCircuit />)
75
79
  await worker.renderUntilSettled()
76
80
 
77
81
  const circuitJson = await worker.getCircuitJson()
78
-
79
82
  const outputPath = path.join(
80
83
  projectDir,
81
84
  `${output}${OUTPUT_EXTENSIONS[format as Format]}`,
82
85
  )
83
86
 
84
- fs.writeFileSync(outputPath, JSON.stringify(circuitJson))
87
+ let outputContent: string
88
+
89
+ switch (format) {
90
+ case "schematic-svg":
91
+ outputContent = convertCircuitJsonToSchematicSvg(circuitJson)
92
+ break
93
+ case "pcb-svg":
94
+ outputContent = convertCircuitJsonToPcbSvg(circuitJson)
95
+ break
96
+ default:
97
+ outputContent = JSON.stringify(circuitJson)
98
+ }
99
+
100
+ fs.writeFileSync(outputPath, outputContent)
85
101
 
86
102
  console.log(`Exported to ${outputPath}`)
87
103
 
@@ -4,6 +4,7 @@ import * as path from "node:path"
4
4
  import { setupTsciProject } from "lib/shared/setup-tsci-packages"
5
5
  import { generateTsConfig } from "lib/shared/generate-ts-config"
6
6
  import { writeFileIfNotExists } from "lib/shared/write-file-if-not-exists"
7
+ import { generateGitIgnoreFile } from "lib/shared/generate-gitignore-file"
7
8
 
8
9
  export const registerInit = (program: Command) => {
9
10
  program
@@ -55,12 +56,9 @@ export default () => (
55
56
  }
56
57
 
57
58
  // Generate tsconfig.json
58
- try {
59
- generateTsConfig(projectDir)
60
- } catch (error) {
61
- console.error("Failed to generate tsconfig.json:", error)
62
- process.exit(1)
63
- }
59
+ generateTsConfig(projectDir)
60
+ // Create .gitignore file
61
+ generateGitIgnoreFile(projectDir)
64
62
 
65
63
  console.info(
66
64
  `🎉 Initialization complete! Run ${directory ? `"cd ${directory}" & ` : ""}"tsci dev" to start developing.`,