@tscircuit/cli 0.0.227 → 0.0.229

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.
@@ -5,7 +5,7 @@ import {
5
5
  AbstractValueIterator,
6
6
  } from "abstract-level"
7
7
  import { promises as fs } from "fs"
8
- import path from "path"
8
+ import path from "path/posix"
9
9
 
10
10
  interface JSONLevelOptions {}
11
11
 
package/api/db/get-db.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mkdirSync } from "fs"
2
- import * as Path from "path"
2
+ import * as Path from "path/posix"
3
3
  import { ZodLevelDatabase } from "./zod-level-db"
4
4
 
5
5
  let globalDb: ZodLevelDatabase | undefined
package/bun.lockb CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  import { AppContext } from "../../util/app-context"
2
2
  import kleur from "kleur"
3
- import * as Path from "path"
3
+ import * as Path from "path/posix"
4
4
  import { existsSync, readFileSync } from "fs"
5
5
 
6
6
  export const checkIfInitialized = async (ctx: AppContext) => {
@@ -4,7 +4,7 @@ import fs from "fs"
4
4
  import kleur from "kleur"
5
5
  import posthog from "cli/lib/posthog"
6
6
  import open from "open"
7
- import * as Path from "path"
7
+ import * as Path from "path/posix"
8
8
  import prompts from "prompts"
9
9
  import { z } from "zod"
10
10
  import { AppContext } from "../../util/app-context"
@@ -1,5 +1,5 @@
1
1
  import kleur from "kleur"
2
- import { join as joinPath } from "path"
2
+ import { join as joinPath } from "path/posix"
3
3
  import { AxiosInstance } from "axios"
4
4
  import { readdirSync, readFileSync } from "fs"
5
5
  import { soupify } from "cli/lib/soupify"
@@ -5,7 +5,7 @@ import { AppContext } from "cli/lib/util/app-context"
5
5
  import fg from "fast-glob"
6
6
  import fs from "fs"
7
7
  import { Project, ts } from "ts-morph"
8
- import * as Path from "path"
8
+ import * as Path from "path/posix"
9
9
  import { deriveSelectorFromPcbComponentId } from "./derive-selector-from-pcb-component-id"
10
10
  import type { EditEvent } from "@tscircuit/manual-edit-events"
11
11
  import {
@@ -1,5 +1,5 @@
1
1
  import kleur from "kleur"
2
- import { join as joinPath } from "path"
2
+ import { join as joinPath } from "path/posix"
3
3
  import { AxiosInstance } from "axios"
4
4
  import { readdirSync, readFileSync } from "fs"
5
5
  import { soupify } from "cli/lib/soupify"
@@ -1,6 +1,6 @@
1
1
  import { existsSync, writeFileSync } from "fs"
2
2
  import kleur from "kleur"
3
- import * as Path from "path"
3
+ import * as Path from "path/posix"
4
4
  import { getGeneratedNpmrc } from "./get-generated-npmrc"
5
5
  import { AppContext } from "cli/lib/util/app-context"
6
6
 
@@ -8,7 +8,7 @@ import {
8
8
  writeFile,
9
9
  appendFileSync,
10
10
  } from "fs"
11
- import * as Path from "node:path"
11
+ import * as Path from "node:path/posix"
12
12
  import $ from "dax-sh"
13
13
  import { getGeneratedReadme } from "./get-generated-readme"
14
14
  import { getGeneratedTsconfig } from "./get-generated-tsconfig"
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from "fs"
2
2
  import kleur from "kleur"
3
3
  import { AppContext } from "cli/lib/util/app-context"
4
- import * as Path from "path"
4
+ import * as Path from "path/posix"
5
5
  import open from "open"
6
6
 
7
7
  export const openCmd = async (ctx: AppContext, args: any) => {
@@ -1,7 +1,7 @@
1
1
  import kleur from "kleur"
2
2
  import { z } from "zod"
3
3
  import { AppContext } from "../../util/app-context"
4
- import * as Path from "path"
4
+ import * as Path from "path/posix"
5
5
  import * as fs from "fs/promises"
6
6
  import { existsSync, readFileSync } from "fs"
7
7
  import { getAllPackageFiles } from "cli/lib/util/get-all-package-files"
@@ -1,7 +1,7 @@
1
1
  import { soupify } from "cli/lib/soupify"
2
2
  import type { AppContext } from "cli/lib/util/app-context"
3
3
  import fs from "fs"
4
- import path from "path"
4
+ import path from "path/posix"
5
5
 
6
6
  export const renderCmd = async (
7
7
  ctx: AppContext,
@@ -1,6 +1,6 @@
1
1
  import { AppContext } from "../util/app-context"
2
2
  import { z } from "zod"
3
- import * as Path from "path"
3
+ import * as Path from "path/posix"
4
4
  import { unlink } from "node:fs/promises"
5
5
  import { soupify } from "cli/lib/soupify"
6
6
  import { writeFileSync } from "fs"
@@ -1,6 +1,6 @@
1
1
  import { AppContext } from "../util/app-context"
2
2
  import { z } from "zod"
3
- import * as Path from "path"
3
+ import * as Path from "path/posix"
4
4
  import { unlink } from "node:fs/promises"
5
5
  import { soupify } from "cli/lib/soupify"
6
6
  import * as fs from "fs"
@@ -91,7 +91,6 @@ export const exportGerbersToZipBuffer = async (
91
91
  ) => {
92
92
  const tempDir = Path.join(".tscircuit", "tmp-gerber-zip")
93
93
  fs.mkdirSync(tempDir, { recursive: true })
94
-
95
94
  await exportGerbersToFile(
96
95
  {
97
96
  example_file_path: params.example_file_path,
@@ -1,6 +1,6 @@
1
1
  import { AppContext } from "../util/app-context"
2
2
  import { z } from "zod"
3
- import * as Path from "path"
3
+ import * as Path from "path/posix"
4
4
  import { unlink } from "node:fs/promises"
5
5
  import { soupify } from "cli/lib/soupify"
6
6
  import { convertCircuitJsonToPickAndPlaceCsv } from "circuit-json-to-pnp-csv"
@@ -1,4 +1,4 @@
1
- import Path from "node:path"
1
+ import Path from "node:path/posix"
2
2
  import fs from "fs/promises"
3
3
 
4
4
  export const getTmpEntrypointFilePath = async (filePath: string) => {
@@ -22,11 +22,11 @@ export const runEntrypointFile = async (
22
22
  ctx.runtime === "node"
23
23
  ? $`npx tsx ${tmpEntrypointPath}`
24
24
  : $`bun ${tmpEntrypointPath}`
25
-
26
25
  debug(`starting process....`)
26
+
27
27
  const processResult = await processCmdPart1
28
- .stdout(debug.enabled ? "inheritPiped" : "piped")
29
28
  .stderr(debug.enabled ? "inheritPiped" : "piped")
29
+ .stdout(debug.enabled ? "inheritPiped" : "piped")
30
30
  .noThrow()
31
31
 
32
32
  const rawSoup = await readFile(tmpOutputPath, "utf-8")
@@ -48,7 +48,6 @@ export const runEntrypointFile = async (
48
48
  console.log(kleur.red(soup.COMPILE_ERROR))
49
49
  throw new Error(soup.COMPILE_ERROR)
50
50
  }
51
-
52
51
  return soup
53
52
  } catch (e: any) {
54
53
  // console.log(kleur.red(`Failed to parse result of soupify: ${e.toString()}`))
@@ -1,7 +1,7 @@
1
1
  import { AppContext } from "../util/app-context"
2
2
  import { z } from "zod"
3
3
  import $ from "dax-sh"
4
- import * as Path from "path"
4
+ import * as Path from "path/posix"
5
5
  import { unlink } from "node:fs/promises"
6
6
  import kleur from "kleur"
7
7
  import { writeFileSync } from "fs"
@@ -104,6 +104,10 @@ export const createContextAndRunProgram = async (process_args: any) => {
104
104
  },
105
105
  )
106
106
 
107
+ function isBunRuntime() {
108
+ return typeof process !== "undefined" && "isBun" in process
109
+ }
110
+
107
111
  const ctx: AppContext = {
108
112
  cmd: args._,
109
113
  cwd: args.cwd ?? process.cwd(),
@@ -112,7 +116,7 @@ export const createContextAndRunProgram = async (process_args: any) => {
112
116
  axios,
113
117
  global_config,
114
118
  profile_config,
115
- runtime: global_config.get("runtime") ?? "node",
119
+ runtime: isBunRuntime() ? "bun" : (global_config.get("runtime") ?? "node"),
116
120
  args: {
117
121
  cmd: args._,
118
122
  yes: args.y ?? args.yes,
@@ -1,6 +1,6 @@
1
1
  import * as ts from "typescript"
2
2
  import * as fs from "fs"
3
- import * as path from "path"
3
+ import * as path from "path/posix"
4
4
 
5
5
  interface LintResult {
6
6
  filePath: string
@@ -1,7 +1,7 @@
1
1
  import { test, expect, describe } from "bun:test"
2
2
  import { $ } from "bun"
3
3
  import { temporaryDirectory } from "tempy"
4
- import { join } from "path"
4
+ import { join } from "path/posix"
5
5
  import { existsSync } from "fs"
6
6
 
7
7
  test("tsci export gerbers --input example-project/examples/macrokeypad.tsx", async () => {
@@ -1,7 +1,7 @@
1
1
  import { test, expect, describe } from "bun:test"
2
2
  import { $ } from "bun"
3
3
  import { temporaryDirectory } from "tempy"
4
- import { join } from "path"
4
+ import { join } from "path/posix"
5
5
  import { existsSync, readdirSync, readFileSync } from "fs"
6
6
  import extract from "extract-zip"
7
7
  import pcbStackup from "pcb-stackup"
@@ -1,7 +1,7 @@
1
1
  import { test, expect, describe } from "bun:test"
2
2
  import { $ } from "bun"
3
3
  import { temporaryDirectory } from "tempy"
4
- import { join } from "path"
4
+ import { join } from "path/posix"
5
5
  import { existsSync, readFileSync } from "fs"
6
6
 
7
7
  test("tsci export kicad_pcb --input example-project/examples/macrokeypad.tsx", async () => {