@tscircuit/cli 0.1.214 → 0.1.215
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 +23 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -63215,7 +63215,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
63215
63215
|
import { execSync as execSync2 } from "node:child_process";
|
|
63216
63216
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
63217
63217
|
// package.json
|
|
63218
|
-
var version = "0.1.
|
|
63218
|
+
var version = "0.1.214";
|
|
63219
63219
|
var package_default = {
|
|
63220
63220
|
name: "@tscircuit/cli",
|
|
63221
63221
|
version,
|
|
@@ -67982,6 +67982,13 @@ var getVersion = () => {
|
|
|
67982
67982
|
};
|
|
67983
67983
|
|
|
67984
67984
|
// cli/dev/register.ts
|
|
67985
|
+
var findSelectableTsxFiles = (projectDir) => {
|
|
67986
|
+
const files = globbySync(["**/*.tsx", "**/*.ts"], {
|
|
67987
|
+
cwd: projectDir,
|
|
67988
|
+
ignore: DEFAULT_IGNORED_PATTERNS
|
|
67989
|
+
});
|
|
67990
|
+
return files.map((file) => path19.resolve(projectDir, file)).filter((file) => fs19.existsSync(file)).sort();
|
|
67991
|
+
};
|
|
67985
67992
|
var registerDev = (program3) => {
|
|
67986
67993
|
program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
|
|
67987
67994
|
let port = parseInt(options.port);
|
|
@@ -68003,7 +68010,7 @@ var registerDev = (program3) => {
|
|
|
68003
68010
|
let absolutePath;
|
|
68004
68011
|
if (file) {
|
|
68005
68012
|
absolutePath = path19.resolve(file);
|
|
68006
|
-
if (!absolutePath.endsWith(".tsx")) {
|
|
68013
|
+
if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
|
|
68007
68014
|
console.error("Error: Only .tsx files are supported");
|
|
68008
68015
|
return;
|
|
68009
68016
|
}
|
|
@@ -68015,8 +68022,13 @@ var registerDev = (program3) => {
|
|
|
68015
68022
|
absolutePath = entrypointPath;
|
|
68016
68023
|
console.log("Found entrypoint at:", entrypointPath);
|
|
68017
68024
|
} else {
|
|
68018
|
-
|
|
68019
|
-
|
|
68025
|
+
const availableFiles = findSelectableTsxFiles(process.cwd());
|
|
68026
|
+
if (availableFiles.length === 0) {
|
|
68027
|
+
console.log("No .tsx or .ts files found in the project. Run 'tsci init' to bootstrap a basic project.");
|
|
68028
|
+
return;
|
|
68029
|
+
}
|
|
68030
|
+
absolutePath = availableFiles[0];
|
|
68031
|
+
console.log("Selected file:", path19.relative(process.cwd(), absolutePath));
|
|
68020
68032
|
}
|
|
68021
68033
|
}
|
|
68022
68034
|
try {
|
|
@@ -71317,7 +71329,7 @@ var debug10 = Debug10("dsn-converter:parse-dsn-to-dsn-json");
|
|
|
71317
71329
|
// lib/shared/generate-circuit-json.tsx
|
|
71318
71330
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
71319
71331
|
import path21 from "node:path/posix";
|
|
71320
|
-
import { relative as
|
|
71332
|
+
import { relative as relative8 } from "node:path";
|
|
71321
71333
|
import fs21 from "node:fs";
|
|
71322
71334
|
import Debug11 from "debug";
|
|
71323
71335
|
|
|
@@ -71379,7 +71391,7 @@ async function generateCircuitJson({
|
|
|
71379
71391
|
});
|
|
71380
71392
|
const projectDir = path21.dirname(filePath);
|
|
71381
71393
|
const resolvedOutputDir = outputDir || projectDir;
|
|
71382
|
-
const relativeComponentPath =
|
|
71394
|
+
const relativeComponentPath = relative8(projectDir, filePath);
|
|
71383
71395
|
const baseFileName = outputFileName || path21.basename(filePath).replace(/\.[^.]+$/, "");
|
|
71384
71396
|
const outputPath = path21.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
71385
71397
|
debug11(`Project directory: ${projectDir}`);
|
|
@@ -119158,10 +119170,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
119158
119170
|
function uniqueSort(nodes) {
|
|
119159
119171
|
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
|
119160
119172
|
nodes.sort((a, b3) => {
|
|
119161
|
-
const
|
|
119162
|
-
if (
|
|
119173
|
+
const relative9 = compareDocumentPosition(a, b3);
|
|
119174
|
+
if (relative9 & DocumentPosition.PRECEDING) {
|
|
119163
119175
|
return -1;
|
|
119164
|
-
} else if (
|
|
119176
|
+
} else if (relative9 & DocumentPosition.FOLLOWING) {
|
|
119165
119177
|
return 1;
|
|
119166
119178
|
}
|
|
119167
119179
|
return 0;
|
|
@@ -172911,8 +172923,8 @@ var registerBuild = (program3) => {
|
|
|
172911
172923
|
fs27.mkdirSync(distDir, { recursive: true });
|
|
172912
172924
|
let hasErrors = false;
|
|
172913
172925
|
for (const filePath of circuitFiles) {
|
|
172914
|
-
const
|
|
172915
|
-
const outputDirName =
|
|
172926
|
+
const relative9 = path26.relative(projectDir, filePath);
|
|
172927
|
+
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
172916
172928
|
const outputPath = path26.join(distDir, outputDirName, "circuit.json");
|
|
172917
172929
|
const ok = await buildFile(filePath, outputPath, projectDir, options);
|
|
172918
172930
|
if (!ok)
|