@tscircuit/cli 0.1.817 → 0.1.819
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 +74 -15
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74267,7 +74267,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74267
74267
|
import { execSync as execSync2 } from "node:child_process";
|
|
74268
74268
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74269
74269
|
// package.json
|
|
74270
|
-
var version = "0.1.
|
|
74270
|
+
var version = "0.1.817";
|
|
74271
74271
|
var package_default = {
|
|
74272
74272
|
name: "@tscircuit/cli",
|
|
74273
74273
|
version,
|
|
@@ -173185,6 +173185,39 @@ var applyCiBuildOptions = async ({
|
|
|
173185
173185
|
};
|
|
173186
173186
|
};
|
|
173187
173187
|
|
|
173188
|
+
// cli/build/resolve-build-options.ts
|
|
173189
|
+
var resolveBuildOptions = ({
|
|
173190
|
+
cliOptions,
|
|
173191
|
+
projectConfig: projectConfig2
|
|
173192
|
+
}) => {
|
|
173193
|
+
const configBuild = projectConfig2?.build;
|
|
173194
|
+
const configAppliedOpts = [];
|
|
173195
|
+
if (!cliOptions?.kicad && configBuild?.kicadLibrary) {
|
|
173196
|
+
configAppliedOpts.push("kicad");
|
|
173197
|
+
}
|
|
173198
|
+
if (!cliOptions?.kicadLibrary && configBuild?.kicadLibrary) {
|
|
173199
|
+
configAppliedOpts.push("kicad-library");
|
|
173200
|
+
}
|
|
173201
|
+
if (!cliOptions?.kicadPcm && configBuild?.kicadPcm) {
|
|
173202
|
+
configAppliedOpts.push("kicad-pcm");
|
|
173203
|
+
}
|
|
173204
|
+
if (!cliOptions?.previewImages && configBuild?.previewImages) {
|
|
173205
|
+
configAppliedOpts.push("preview-images");
|
|
173206
|
+
}
|
|
173207
|
+
if (!cliOptions?.transpile && configBuild?.typescriptLibrary) {
|
|
173208
|
+
configAppliedOpts.push("transpile");
|
|
173209
|
+
}
|
|
173210
|
+
const options = {
|
|
173211
|
+
...cliOptions,
|
|
173212
|
+
kicad: cliOptions?.kicad ?? configBuild?.kicadLibrary,
|
|
173213
|
+
kicadLibrary: cliOptions?.kicadLibrary ?? configBuild?.kicadLibrary,
|
|
173214
|
+
kicadPcm: cliOptions?.kicadPcm ?? configBuild?.kicadPcm,
|
|
173215
|
+
previewImages: cliOptions?.previewImages ?? configBuild?.previewImages,
|
|
173216
|
+
transpile: cliOptions?.transpile ?? configBuild?.typescriptLibrary
|
|
173217
|
+
};
|
|
173218
|
+
return { options, configAppliedOpts };
|
|
173219
|
+
};
|
|
173220
|
+
|
|
173188
173221
|
// cli/build/get-build-entrypoints.ts
|
|
173189
173222
|
import fs39 from "node:fs";
|
|
173190
173223
|
import path39 from "node:path";
|
|
@@ -174351,8 +174384,38 @@ var normalizeRelativePath = (projectDir, targetPath) => path50.relative(projectD
|
|
|
174351
174384
|
var registerBuild = (program3) => {
|
|
174352
174385
|
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("--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", "Generate KiCad project directories for each successful build output").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").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) => {
|
|
174353
174386
|
try {
|
|
174354
|
-
const
|
|
174387
|
+
const resolvedRoot = path50.resolve(process.cwd());
|
|
174388
|
+
let projectDir;
|
|
174389
|
+
if (file) {
|
|
174390
|
+
const resolved = path50.resolve(resolvedRoot, file);
|
|
174391
|
+
if (fs50.existsSync(resolved) && fs50.statSync(resolved).isDirectory()) {
|
|
174392
|
+
projectDir = resolvedRoot;
|
|
174393
|
+
} else {
|
|
174394
|
+
let currentDir = path50.dirname(resolved);
|
|
174395
|
+
while (currentDir !== path50.dirname(currentDir)) {
|
|
174396
|
+
if (fs50.existsSync(path50.join(currentDir, "package.json"))) {
|
|
174397
|
+
break;
|
|
174398
|
+
}
|
|
174399
|
+
currentDir = path50.dirname(currentDir);
|
|
174400
|
+
}
|
|
174401
|
+
projectDir = currentDir;
|
|
174402
|
+
}
|
|
174403
|
+
} else {
|
|
174404
|
+
projectDir = resolvedRoot;
|
|
174405
|
+
}
|
|
174406
|
+
const projectConfig2 = loadProjectConfig(projectDir);
|
|
174407
|
+
const { options: optionsWithConfig, configAppliedOpts } = resolveBuildOptions({
|
|
174408
|
+
cliOptions: options,
|
|
174409
|
+
projectConfig: projectConfig2
|
|
174410
|
+
});
|
|
174411
|
+
const { resolvedOptions, handled } = await applyCiBuildOptions({
|
|
174355
174412
|
projectDir,
|
|
174413
|
+
options: optionsWithConfig
|
|
174414
|
+
});
|
|
174415
|
+
if (handled) {
|
|
174416
|
+
return;
|
|
174417
|
+
}
|
|
174418
|
+
const {
|
|
174356
174419
|
circuitFiles,
|
|
174357
174420
|
mainEntrypoint,
|
|
174358
174421
|
previewComponentPath,
|
|
@@ -174360,13 +174423,6 @@ var registerBuild = (program3) => {
|
|
|
174360
174423
|
} = await getBuildEntrypoints({
|
|
174361
174424
|
fileOrDir: file
|
|
174362
174425
|
});
|
|
174363
|
-
const { resolvedOptions, handled } = await applyCiBuildOptions({
|
|
174364
|
-
projectDir,
|
|
174365
|
-
options
|
|
174366
|
-
});
|
|
174367
|
-
if (handled) {
|
|
174368
|
-
return;
|
|
174369
|
-
}
|
|
174370
174426
|
const platformConfig2 = (() => {
|
|
174371
174427
|
if (!resolvedOptions?.disablePcb && !resolvedOptions?.disablePartsEngine) {
|
|
174372
174428
|
return;
|
|
@@ -174551,9 +174607,9 @@ var registerBuild = (program3) => {
|
|
|
174551
174607
|
fileOrDir: file,
|
|
174552
174608
|
includeBoardFiles: false
|
|
174553
174609
|
});
|
|
174554
|
-
const
|
|
174555
|
-
const entryFile =
|
|
174556
|
-
filePath:
|
|
174610
|
+
const projectConfig3 = loadProjectConfig(projectDir);
|
|
174611
|
+
const entryFile = projectConfig3?.kicadLibraryEntrypointPath != null ? await getEntrypoint({
|
|
174612
|
+
filePath: projectConfig3.kicadLibraryEntrypointPath,
|
|
174557
174613
|
projectDir
|
|
174558
174614
|
}) : kicadEntrypoint;
|
|
174559
174615
|
if (!entryFile) {
|
|
@@ -174585,9 +174641,9 @@ var registerBuild = (program3) => {
|
|
|
174585
174641
|
fileOrDir: file,
|
|
174586
174642
|
includeBoardFiles: false
|
|
174587
174643
|
});
|
|
174588
|
-
const
|
|
174589
|
-
const entryFile =
|
|
174590
|
-
filePath:
|
|
174644
|
+
const projectConfig3 = loadProjectConfig(projectDir);
|
|
174645
|
+
const entryFile = projectConfig3?.kicadLibraryEntrypointPath != null ? await getEntrypoint({
|
|
174646
|
+
filePath: projectConfig3.kicadLibraryEntrypointPath,
|
|
174591
174647
|
projectDir
|
|
174592
174648
|
}) : kicadEntrypoint;
|
|
174593
174649
|
if (!entryFile) {
|
|
@@ -174628,6 +174684,9 @@ var registerBuild = (program3) => {
|
|
|
174628
174684
|
if (enabledOpts.length > 0) {
|
|
174629
174685
|
console.log(` Options ${kleur_default.cyan(enabledOpts.join(", "))}`);
|
|
174630
174686
|
}
|
|
174687
|
+
if (configAppliedOpts.length > 0) {
|
|
174688
|
+
console.log(` Config ${kleur_default.magenta(configAppliedOpts.join(", "))} ${kleur_default.dim("(from tscircuit.config.json)")}`);
|
|
174689
|
+
}
|
|
174631
174690
|
console.log(` Output ${kleur_default.dim(path50.relative(process.cwd(), distDir) || "dist")}`);
|
|
174632
174691
|
console.log(hasErrors ? kleur_default.yellow(`
|
|
174633
174692
|
⚠ Build completed with errors`) : kleur_default.green(`
|