@tscircuit/cli 0.1.226 → 0.1.228
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/dist/main.js +44 -13
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -63256,7 +63256,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
63256
63256
|
import { execSync as execSync2 } from "node:child_process";
|
|
63257
63257
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
63258
63258
|
// package.json
|
|
63259
|
-
var version = "0.1.
|
|
63259
|
+
var version = "0.1.227";
|
|
63260
63260
|
var package_default = {
|
|
63261
63261
|
name: "@tscircuit/cli",
|
|
63262
63262
|
version,
|
|
@@ -71585,6 +71585,7 @@ var exportSnippet = async ({
|
|
|
71585
71585
|
filePath,
|
|
71586
71586
|
format,
|
|
71587
71587
|
outputPath,
|
|
71588
|
+
platformConfig,
|
|
71588
71589
|
writeFile = true,
|
|
71589
71590
|
onExit = (code) => process.exit(code),
|
|
71590
71591
|
onError = (message) => console.error(message),
|
|
@@ -71600,7 +71601,8 @@ var exportSnippet = async ({
|
|
|
71600
71601
|
const outputDestination = path22.join(projectDir, outputPath ?? outputFileName);
|
|
71601
71602
|
const circuitData = await generateCircuitJson({
|
|
71602
71603
|
filePath,
|
|
71603
|
-
saveToFile: format === "circuit-json"
|
|
71604
|
+
saveToFile: format === "circuit-json",
|
|
71605
|
+
platformConfig
|
|
71604
71606
|
}).catch((err) => {
|
|
71605
71607
|
onError(`Error generating circuit JSON: ${err}`);
|
|
71606
71608
|
return null;
|
|
@@ -72301,10 +72303,14 @@ var resultToCsv = (result) => {
|
|
|
72301
72303
|
import path24 from "node:path";
|
|
72302
72304
|
import { promises as fs24 } from "node:fs";
|
|
72303
72305
|
var registerExport = (program3) => {
|
|
72304
|
-
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", "Output format").option("-o, --output <path>", "Output file path").action(async (file, options) => {
|
|
72305
|
-
const
|
|
72306
|
-
|
|
72307
|
-
|
|
72306
|
+
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", "Output format").option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
72307
|
+
const formatOption = options.format ?? "json";
|
|
72308
|
+
const platformConfig = options.disablePartsEngine === true ? { partsEngineDisabled: true } : undefined;
|
|
72309
|
+
if (formatOption === "spice") {
|
|
72310
|
+
const { circuitJson } = await generateCircuitJson({
|
|
72311
|
+
filePath: file,
|
|
72312
|
+
platformConfig
|
|
72313
|
+
});
|
|
72308
72314
|
if (circuitJson) {
|
|
72309
72315
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
72310
72316
|
const outputSpicePath = options.output ?? path24.join(path24.dirname(file), `${path24.basename(file, path24.extname(file))}.spice.cir`);
|
|
@@ -72317,10 +72323,12 @@ var registerExport = (program3) => {
|
|
|
72317
72323
|
}
|
|
72318
72324
|
return;
|
|
72319
72325
|
}
|
|
72326
|
+
const format = formatOption;
|
|
72320
72327
|
await exportSnippet({
|
|
72321
72328
|
filePath: file,
|
|
72322
72329
|
format,
|
|
72323
72330
|
outputPath: options.output,
|
|
72331
|
+
platformConfig,
|
|
72324
72332
|
onExit: (code) => process.exit(code),
|
|
72325
72333
|
onError: (message) => console.error(message),
|
|
72326
72334
|
onSuccess: ({ outputDestination }) => console.log("Exported to " + outputDestination + "!")
|
|
@@ -173776,10 +173784,22 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
173776
173784
|
|
|
173777
173785
|
// cli/build/register.ts
|
|
173778
173786
|
var registerBuild = (program3) => {
|
|
173779
|
-
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--site", "Generate a static site in the dist directory").action(async (file, options) => {
|
|
173787
|
+
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").action(async (file, options) => {
|
|
173780
173788
|
const { projectDir, circuitFiles } = await getBuildEntrypoints({
|
|
173781
173789
|
fileOrDir: file
|
|
173782
173790
|
});
|
|
173791
|
+
const platformConfig2 = (() => {
|
|
173792
|
+
if (!options?.disablePcb && !options?.disablePartsEngine)
|
|
173793
|
+
return;
|
|
173794
|
+
const config = {};
|
|
173795
|
+
if (options?.disablePcb) {
|
|
173796
|
+
config.pcbDisabled = true;
|
|
173797
|
+
}
|
|
173798
|
+
if (options?.disablePartsEngine) {
|
|
173799
|
+
config.partsEngineDisabled = true;
|
|
173800
|
+
}
|
|
173801
|
+
return config;
|
|
173802
|
+
})();
|
|
173783
173803
|
const distDir = path28.join(projectDir, "dist");
|
|
173784
173804
|
fs29.mkdirSync(distDir, { recursive: true });
|
|
173785
173805
|
let hasErrors = false;
|
|
@@ -173788,7 +173808,11 @@ var registerBuild = (program3) => {
|
|
|
173788
173808
|
const relative9 = path28.relative(projectDir, filePath);
|
|
173789
173809
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
173790
173810
|
const outputPath = path28.join(distDir, outputDirName, "circuit.json");
|
|
173791
|
-
const ok = await buildFile(filePath, outputPath, projectDir,
|
|
173811
|
+
const ok = await buildFile(filePath, outputPath, projectDir, {
|
|
173812
|
+
ignoreErrors: options?.ignoreErrors,
|
|
173813
|
+
ignoreWarnings: options?.ignoreWarnings,
|
|
173814
|
+
platformConfig: platformConfig2
|
|
173815
|
+
});
|
|
173792
173816
|
if (!ok) {
|
|
173793
173817
|
hasErrors = true;
|
|
173794
173818
|
} else if (options?.site) {
|
|
@@ -173861,7 +173885,8 @@ var snapshotProject = async ({
|
|
|
173861
173885
|
forceUpdate = false,
|
|
173862
173886
|
onExit = (code) => process.exit(code),
|
|
173863
173887
|
onError = (msg) => console.error(msg),
|
|
173864
|
-
onSuccess = (msg) => console.log(msg)
|
|
173888
|
+
onSuccess = (msg) => console.log(msg),
|
|
173889
|
+
platformConfig: platformConfig2
|
|
173865
173890
|
} = {}) => {
|
|
173866
173891
|
const projectDir = process.cwd();
|
|
173867
173892
|
const ignore = [
|
|
@@ -173888,7 +173913,10 @@ var snapshotProject = async ({
|
|
|
173888
173913
|
const mismatches = [];
|
|
173889
173914
|
let didUpdate = false;
|
|
173890
173915
|
for (const file of boardFiles) {
|
|
173891
|
-
const { circuitJson } = await generateCircuitJson({
|
|
173916
|
+
const { circuitJson } = await generateCircuitJson({
|
|
173917
|
+
filePath: file,
|
|
173918
|
+
platformConfig: platformConfig2
|
|
173919
|
+
});
|
|
173892
173920
|
const pcbSvg = convertCircuitJsonToPcbSvg3(circuitJson);
|
|
173893
173921
|
const schSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
|
|
173894
173922
|
const svg3d = threeD ? await convertCircuitJsonToSimple3dSvg(circuitJson) : null;
|
|
@@ -173954,7 +173982,7 @@ Run with --update to fix.`);
|
|
|
173954
173982
|
|
|
173955
173983
|
// cli/snapshot/register.ts
|
|
173956
173984
|
var registerSnapshot = (program3) => {
|
|
173957
|
-
program3.command("snapshot").argument("[path]", "Path to the board, circuit file, or directory containing them").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").action(async (target, options) => {
|
|
173985
|
+
program3.command("snapshot").argument("[path]", "Path to the board, circuit file, or directory containing them").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").option("--disable-parts-engine", "Disable the parts engine").action(async (target, options) => {
|
|
173958
173986
|
await snapshotProject({
|
|
173959
173987
|
update: options.update ?? false,
|
|
173960
173988
|
threeD: options["3d"] ?? false,
|
|
@@ -173962,6 +173990,7 @@ var registerSnapshot = (program3) => {
|
|
|
173962
173990
|
schematicOnly: options.schematicOnly ?? false,
|
|
173963
173991
|
forceUpdate: options.forceUpdate ?? false,
|
|
173964
173992
|
filePaths: target ? [target] : [],
|
|
173993
|
+
platformConfig: options.disablePartsEngine ? { partsEngineDisabled: true } : undefined,
|
|
173965
173994
|
onExit: (code) => process.exit(code),
|
|
173966
173995
|
onError: (msg) => console.error(msg),
|
|
173967
173996
|
onSuccess: (msg) => console.log(msg)
|
|
@@ -179794,10 +179823,12 @@ var resultToTable = (result) => {
|
|
|
179794
179823
|
// cli/simulate/register.ts
|
|
179795
179824
|
var registerSimulate = (program3) => {
|
|
179796
179825
|
const simulateCommand = program3.command("simulate").description("Run a simulation");
|
|
179797
|
-
simulateCommand.command("analog").description("Run an analog SPICE simulation").argument("<file>", "Path to tscircuit tsx or circuit json file").action(async (file) => {
|
|
179826
|
+
simulateCommand.command("analog").description("Run an analog SPICE simulation").argument("<file>", "Path to tscircuit tsx or circuit json file").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
179827
|
+
const platformConfig2 = options.disablePartsEngine === true ? { partsEngineDisabled: true } : undefined;
|
|
179798
179828
|
const { circuitJson } = await generateCircuitJson({
|
|
179799
179829
|
filePath: file,
|
|
179800
|
-
saveToFile: false
|
|
179830
|
+
saveToFile: false,
|
|
179831
|
+
platformConfig: platformConfig2
|
|
179801
179832
|
});
|
|
179802
179833
|
if (!circuitJson) {
|
|
179803
179834
|
console.log("error: Failed to generate circuit JSON");
|