@tscircuit/cli 0.1.134 → 0.1.136
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 +13 -15
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -442169,7 +442169,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
442169
442169
|
import { execSync as execSync2 } from "node:child_process";
|
|
442170
442170
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
442171
442171
|
// package.json
|
|
442172
|
-
var version = "0.1.
|
|
442172
|
+
var version = "0.1.135";
|
|
442173
442173
|
var package_default = {
|
|
442174
442174
|
name: "@tscircuit/cli",
|
|
442175
442175
|
version,
|
|
@@ -445714,7 +445714,7 @@ import * as path12 from "node:path";
|
|
|
445714
445714
|
// lib/project-config/project-config-schema.ts
|
|
445715
445715
|
init_lib();
|
|
445716
445716
|
var projectConfigSchema = z.object({
|
|
445717
|
-
|
|
445717
|
+
mainEntrypoint: z.string().optional(),
|
|
445718
445718
|
ignoredFiles: z.array(z.string()).optional()
|
|
445719
445719
|
});
|
|
445720
445720
|
|
|
@@ -445756,8 +445756,8 @@ var getEntrypoint = async ({
|
|
|
445756
445756
|
return path13.resolve(projectDir, filePath);
|
|
445757
445757
|
}
|
|
445758
445758
|
const projectConfig = loadProjectConfig(projectDir);
|
|
445759
|
-
if (projectConfig?.
|
|
445760
|
-
const configEntrypoint = path13.resolve(projectDir, projectConfig.
|
|
445759
|
+
if (projectConfig?.mainEntrypoint) {
|
|
445760
|
+
const configEntrypoint = path13.resolve(projectDir, projectConfig.mainEntrypoint);
|
|
445761
445761
|
if (fs12.existsSync(configEntrypoint)) {
|
|
445762
445762
|
onSuccess(`Using entrypoint from tscircuit.config.json: '${path13.relative(projectDir, configEntrypoint)}'`);
|
|
445763
445763
|
return configEntrypoint;
|
|
@@ -445778,7 +445778,7 @@ var getEntrypoint = async ({
|
|
|
445778
445778
|
const relativePath = path13.relative(projectDir, entrypoint);
|
|
445779
445779
|
onSuccess(`Detected entrypoint: '${relativePath}'`);
|
|
445780
445780
|
const newConfig = projectConfig || {};
|
|
445781
|
-
newConfig.
|
|
445781
|
+
newConfig.mainEntrypoint = relativePath;
|
|
445782
445782
|
saveProjectConfig(newConfig, projectDir);
|
|
445783
445783
|
onSuccess(`Updated tscircuit.config.json with detected entrypoint`);
|
|
445784
445784
|
break;
|
|
@@ -496340,7 +496340,7 @@ async function getBuildEntrypoints({
|
|
|
496340
496340
|
if (fs24.existsSync(resolved) && fs24.statSync(resolved).isDirectory()) {
|
|
496341
496341
|
const projectDir2 = resolved;
|
|
496342
496342
|
const circuitFiles2 = [];
|
|
496343
|
-
const
|
|
496343
|
+
const mainEntrypoint2 = await getEntrypoint({
|
|
496344
496344
|
projectDir: projectDir2,
|
|
496345
496345
|
onError: () => {}
|
|
496346
496346
|
});
|
|
@@ -496353,7 +496353,7 @@ async function getBuildEntrypoints({
|
|
|
496353
496353
|
}
|
|
496354
496354
|
return {
|
|
496355
496355
|
projectDir: projectDir2,
|
|
496356
|
-
|
|
496356
|
+
mainEntrypoint: mainEntrypoint2 || undefined,
|
|
496357
496357
|
circuitFiles: circuitFiles2
|
|
496358
496358
|
};
|
|
496359
496359
|
}
|
|
@@ -496361,10 +496361,7 @@ async function getBuildEntrypoints({
|
|
|
496361
496361
|
}
|
|
496362
496362
|
const projectDir = resolvedRoot;
|
|
496363
496363
|
const circuitFiles = [];
|
|
496364
|
-
const
|
|
496365
|
-
projectDir,
|
|
496366
|
-
onError: () => {}
|
|
496367
|
-
});
|
|
496364
|
+
const mainEntrypoint = await getEntrypoint({ projectDir, onError: () => {} });
|
|
496368
496365
|
const files = globbySync("**/*.circuit.tsx", {
|
|
496369
496366
|
cwd: projectDir,
|
|
496370
496367
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
@@ -496374,7 +496371,7 @@ async function getBuildEntrypoints({
|
|
|
496374
496371
|
}
|
|
496375
496372
|
return {
|
|
496376
496373
|
projectDir,
|
|
496377
|
-
|
|
496374
|
+
mainEntrypoint: mainEntrypoint || undefined,
|
|
496378
496375
|
circuitFiles
|
|
496379
496376
|
};
|
|
496380
496377
|
}
|
|
@@ -496382,13 +496379,13 @@ async function getBuildEntrypoints({
|
|
|
496382
496379
|
// cli/build/register.ts
|
|
496383
496380
|
var registerBuild = (program3) => {
|
|
496384
496381
|
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").action(async (file, options) => {
|
|
496385
|
-
const { projectDir,
|
|
496382
|
+
const { projectDir, mainEntrypoint, circuitFiles } = await getBuildEntrypoints({ fileOrDir: file });
|
|
496386
496383
|
const distDir = path25.join(projectDir, "dist");
|
|
496387
496384
|
fs25.mkdirSync(distDir, { recursive: true });
|
|
496388
496385
|
let hasErrors = false;
|
|
496389
|
-
if (
|
|
496386
|
+
if (mainEntrypoint) {
|
|
496390
496387
|
const outputPath = path25.join(distDir, "circuit.json");
|
|
496391
|
-
const ok = await buildFile(
|
|
496388
|
+
const ok = await buildFile(mainEntrypoint, outputPath, projectDir, options);
|
|
496392
496389
|
if (!ok)
|
|
496393
496390
|
hasErrors = true;
|
|
496394
496391
|
}
|
|
@@ -497100,6 +497097,7 @@ var snapshotProject = async ({
|
|
|
497100
497097
|
const snapPath = path26.join(snapDir, `${base}-${type}.snap.svg`);
|
|
497101
497098
|
if (update || !fs26.existsSync(snapPath)) {
|
|
497102
497099
|
fs26.writeFileSync(snapPath, svg);
|
|
497100
|
+
console.log("✅", kleur_default.gray(path26.relative(projectDir, snapPath)));
|
|
497103
497101
|
} else {
|
|
497104
497102
|
const existing = fs26.readFileSync(snapPath, "utf-8");
|
|
497105
497103
|
if (existing !== svg)
|