Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,10 @@ export interface PlatformConfig {

defaultSpiceEngine?: AutocompleteString<"spicey" | "ngspice">;

unitPreference?: "mm" | "in" | "mil";

pcbDisabled?: boolean;
routingDisabled?: boolean;
schematicDisabled?: boolean;
partsEngineDisabled?: boolean;

Expand Down
3 changes: 3 additions & 0 deletions generated/PROPS_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,10 @@ export interface PlatformConfig {

defaultSpiceEngine?: AutocompleteString<"spicey" | "ngspice">

unitPreference?: "mm" | "in" | "mil"

pcbDisabled?: boolean
routingDisabled?: boolean
schematicDisabled?: boolean
partsEngineDisabled?: boolean

Expand Down
3 changes: 3 additions & 0 deletions lib/platformConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export interface PlatformConfig {

defaultSpiceEngine?: AutocompleteString<"spicey" | "ngspice">

unitPreference?: "mm" | "in" | "mil"

pcbDisabled?: boolean
routingDisabled?: boolean
schematicDisabled?: boolean
Expand Down Expand Up @@ -197,6 +199,7 @@ export const platformConfig = z.object({
)
.optional(),
defaultSpiceEngine: defaultSpiceEngine.optional(),
unitPreference: z.enum(["mm", "in", "mil"]).optional(),
localCacheEngine: z.any().optional(),
pcbDisabled: z.boolean().optional(),
routingDisabled: z.boolean().optional(),
Expand Down
18 changes: 18 additions & 0 deletions tests/platformConfig.unitPreference.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { expect, test } from "bun:test"
import { platformConfig } from "lib/platformConfig"

test("unitPreference accepts mm, in, and mil", () => {
expect(platformConfig.parse({ unitPreference: "mm" }).unitPreference).toBe(
"mm",
)
expect(platformConfig.parse({ unitPreference: "in" }).unitPreference).toBe(
"in",
)
expect(platformConfig.parse({ unitPreference: "mil" }).unitPreference).toBe(
"mil",
)
})

test("unitPreference rejects unsupported values", () => {
expect(() => platformConfig.parse({ unitPreference: "cm" })).toThrow()
})