@tscircuit/cli 0.1.971 → 0.1.973
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.
|
@@ -2762,6 +2762,7 @@ var workerLog = (...args) => {
|
|
|
2762
2762
|
var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
|
|
2763
2763
|
const errors = [];
|
|
2764
2764
|
const warnings = [];
|
|
2765
|
+
const startedAt = options?.profile ? performance.now() : 0;
|
|
2765
2766
|
try {
|
|
2766
2767
|
process.chdir(projectDir);
|
|
2767
2768
|
workerLog(`Generating circuit JSON for ${path5.relative(projectDir, filePath)}...`);
|
|
@@ -2797,7 +2798,8 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
|
|
|
2797
2798
|
circuit_json_path: outputPath,
|
|
2798
2799
|
ok: !hasErrors,
|
|
2799
2800
|
errors,
|
|
2800
|
-
warnings
|
|
2801
|
+
warnings,
|
|
2802
|
+
durationMs: options?.profile ? performance.now() - startedAt : undefined
|
|
2801
2803
|
};
|
|
2802
2804
|
} catch (err) {
|
|
2803
2805
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -2814,7 +2816,8 @@ var handleBuildFile = async (filePath, outputPath, projectDir, options) => {
|
|
|
2814
2816
|
message: errorMsg
|
|
2815
2817
|
},
|
|
2816
2818
|
errors,
|
|
2817
|
-
warnings
|
|
2819
|
+
warnings,
|
|
2820
|
+
durationMs: options?.profile ? performance.now() - startedAt : undefined
|
|
2818
2821
|
};
|
|
2819
2822
|
}
|
|
2820
2823
|
};
|
package/dist/cli/main.js
CHANGED
|
@@ -71991,6 +71991,12 @@ var shouldBeInteractive = () => {
|
|
|
71991
71991
|
return false;
|
|
71992
71992
|
if (process.env.TSCI_TEST_MODE)
|
|
71993
71993
|
return false;
|
|
71994
|
+
if (process.argv.includes("--non-interactive"))
|
|
71995
|
+
return false;
|
|
71996
|
+
if (process.env.TSCIRCUIT_NON_INTERACTIVE === "1")
|
|
71997
|
+
return false;
|
|
71998
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
71999
|
+
return false;
|
|
71994
72000
|
return true;
|
|
71995
72001
|
};
|
|
71996
72002
|
|
|
@@ -72002,7 +72008,7 @@ var prompts = (...args) => {
|
|
|
72002
72008
|
const result = {};
|
|
72003
72009
|
promptArray.forEach((prompt) => {
|
|
72004
72010
|
if (prompt.type === "confirm") {
|
|
72005
|
-
result[prompt.name] =
|
|
72011
|
+
result[prompt.name] = true;
|
|
72006
72012
|
return;
|
|
72007
72013
|
} else if (prompt.initial) {
|
|
72008
72014
|
result[prompt.name] = prompt.initial;
|
|
@@ -74389,7 +74395,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74389
74395
|
import { execSync as execSync2 } from "node:child_process";
|
|
74390
74396
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74391
74397
|
// package.json
|
|
74392
|
-
var version = "0.1.
|
|
74398
|
+
var version = "0.1.971";
|
|
74393
74399
|
var package_default = {
|
|
74394
74400
|
name: "@tscircuit/cli",
|
|
74395
74401
|
main: "dist/cli/main.js",
|
|
@@ -175741,7 +175747,8 @@ class WorkerPool {
|
|
|
175741
175747
|
ok: completedMsg.ok,
|
|
175742
175748
|
isFatalError: completedMsg.isFatalError,
|
|
175743
175749
|
errors: completedMsg.errors,
|
|
175744
|
-
warnings: completedMsg.warnings
|
|
175750
|
+
warnings: completedMsg.warnings,
|
|
175751
|
+
durationMs: completedMsg.durationMs
|
|
175745
175752
|
});
|
|
175746
175753
|
threadWorker.currentJob = null;
|
|
175747
175754
|
threadWorker.busy = false;
|
|
@@ -175854,7 +175861,7 @@ async function buildFilesWithWorkerPool(options) {
|
|
|
175854
175861
|
// cli/build/register.ts
|
|
175855
175862
|
var normalizeRelativePath = (projectDir, targetPath) => path55.relative(projectDir, targetPath).split(path55.sep).join("/");
|
|
175856
175863
|
var registerBuild = (program3) => {
|
|
175857
|
-
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").action(async (file, options) => {
|
|
175864
|
+
program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--ignore-config", "Ignore options from tscircuit.config.json").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad-project", "Generate KiCad project directories for each successful build output").option("--kicad-library", "Generate KiCad library in dist/kicad-library").option("--kicad-library-name <name>", "Specify the name of the KiCad library").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--glbs", "Generate GLB 3D model files for every successful build").option("--profile", "Log per-circuit circuit.json generation time during build").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").option("--concurrency <number>", "Number of files to build in parallel (default: 1)", "1").action(async (file, options) => {
|
|
175858
175865
|
try {
|
|
175859
175866
|
const resolvedRoot = path55.resolve(process.cwd());
|
|
175860
175867
|
let projectDir;
|
|
@@ -175925,11 +175932,13 @@ var registerBuild = (program3) => {
|
|
|
175925
175932
|
const staticFileReferences = [];
|
|
175926
175933
|
const builtFiles = [];
|
|
175927
175934
|
const kicadProjects = [];
|
|
175935
|
+
const profileEntries = [];
|
|
175928
175936
|
const shouldGenerateKicadProject = resolvedOptions?.kicadProject || resolvedOptions?.kicadLibrary;
|
|
175929
175937
|
const buildOptions = {
|
|
175930
175938
|
ignoreErrors: resolvedOptions?.ignoreErrors,
|
|
175931
175939
|
ignoreWarnings: resolvedOptions?.ignoreWarnings,
|
|
175932
|
-
platformConfig: platformConfig2
|
|
175940
|
+
platformConfig: platformConfig2,
|
|
175941
|
+
profile: resolvedOptions?.profile
|
|
175933
175942
|
};
|
|
175934
175943
|
const processBuildResult = async (filePath, outputPath, buildOutcome) => {
|
|
175935
175944
|
const relative10 = path55.relative(projectDir, filePath);
|
|
@@ -175981,7 +175990,13 @@ var registerBuild = (program3) => {
|
|
|
175981
175990
|
console.log(`Building ${relative10}...`);
|
|
175982
175991
|
const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
175983
175992
|
const outputPath = path55.join(distDir, outputDirName, "circuit.json");
|
|
175993
|
+
const startedAt = resolvedOptions?.profile ? performance.now() : 0;
|
|
175984
175994
|
const buildOutcome = await buildFile(filePath, outputPath, projectDir, buildOptions);
|
|
175995
|
+
if (resolvedOptions?.profile) {
|
|
175996
|
+
const durationMs = performance.now() - startedAt;
|
|
175997
|
+
profileEntries.push({ filePath: relative10, durationMs });
|
|
175998
|
+
console.log(kleur_default.cyan(`[profile] ${relative10}: ${durationMs.toFixed(1)}ms`));
|
|
175999
|
+
}
|
|
175985
176000
|
await processBuildResult(filePath, outputPath, buildOutcome);
|
|
175986
176001
|
}
|
|
175987
176002
|
};
|
|
@@ -176012,6 +176027,13 @@ var registerBuild = (program3) => {
|
|
|
176012
176027
|
console.error(kleur_default.red(` ${error}`));
|
|
176013
176028
|
}
|
|
176014
176029
|
}
|
|
176030
|
+
if (resolvedOptions?.profile && typeof result.durationMs === "number") {
|
|
176031
|
+
profileEntries.push({
|
|
176032
|
+
filePath: relative10,
|
|
176033
|
+
durationMs: result.durationMs
|
|
176034
|
+
});
|
|
176035
|
+
console.log(kleur_default.cyan(`[profile] ${relative10}: ${result.durationMs.toFixed(1)}ms`));
|
|
176036
|
+
}
|
|
176015
176037
|
await processBuildResult(result.filePath, result.outputPath, {
|
|
176016
176038
|
ok: result.ok,
|
|
176017
176039
|
isFatalError: result.isFatalError
|
|
@@ -176170,8 +176192,17 @@ var registerBuild = (program3) => {
|
|
|
176170
176192
|
resolvedOptions?.kicadProject && "kicad-project",
|
|
176171
176193
|
resolvedOptions?.kicadLibrary && "kicad-library",
|
|
176172
176194
|
resolvedOptions?.kicadPcm && "kicad-pcm",
|
|
176173
|
-
resolvedOptions?.previewGltf && "preview-gltf"
|
|
176195
|
+
resolvedOptions?.previewGltf && "preview-gltf",
|
|
176196
|
+
resolvedOptions?.profile && "profile"
|
|
176174
176197
|
].filter(Boolean);
|
|
176198
|
+
if (resolvedOptions?.profile && profileEntries.length > 0) {
|
|
176199
|
+
console.log("");
|
|
176200
|
+
console.log(kleur_default.bold("Profile Summary (slowest first)"));
|
|
176201
|
+
const sortedProfileEntries = [...profileEntries].sort((a3, b3) => b3.durationMs - a3.durationMs);
|
|
176202
|
+
for (const profileEntry of sortedProfileEntries) {
|
|
176203
|
+
console.log(` ${kleur_default.cyan(profileEntry.durationMs.toFixed(1) + "ms")} ${profileEntry.filePath}`);
|
|
176204
|
+
}
|
|
176205
|
+
}
|
|
176175
176206
|
console.log("");
|
|
176176
176207
|
console.log(kleur_default.bold("Build complete"));
|
|
176177
176208
|
console.log(` Circuits ${kleur_default.green(`${successCount} passed`)}${failCount > 0 ? kleur_default.red(` ${failCount} failed`) : ""}`);
|
package/dist/lib/index.js
CHANGED
|
@@ -60414,7 +60414,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
60414
60414
|
}));
|
|
60415
60415
|
};
|
|
60416
60416
|
// package.json
|
|
60417
|
-
var version = "0.1.
|
|
60417
|
+
var version = "0.1.971";
|
|
60418
60418
|
var package_default = {
|
|
60419
60419
|
name: "@tscircuit/cli",
|
|
60420
60420
|
main: "dist/cli/main.js",
|