@tscircuit/cli 0.1.500 → 0.1.502
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 +34 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72387
72387
|
import { execSync as execSync2 } from "node:child_process";
|
|
72388
72388
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72389
72389
|
// package.json
|
|
72390
|
-
var version = "0.1.
|
|
72390
|
+
var version = "0.1.501";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -77218,6 +77218,25 @@ function resolveNodeModuleImport(importPath, projectDir) {
|
|
|
77218
77218
|
resolvedFiles.push(entryPath);
|
|
77219
77219
|
}
|
|
77220
77220
|
}
|
|
77221
|
+
if (resolvedFiles.length === 0) {
|
|
77222
|
+
const fallbackPaths = [
|
|
77223
|
+
path18.join(packageDir, "index.js"),
|
|
77224
|
+
path18.join(packageDir, "index.mjs"),
|
|
77225
|
+
path18.join(packageDir, "index.ts"),
|
|
77226
|
+
path18.join(packageDir, "index.tsx"),
|
|
77227
|
+
path18.join(packageDir, "dist", "index.js"),
|
|
77228
|
+
path18.join(packageDir, "dist", "index.mjs"),
|
|
77229
|
+
path18.join(packageDir, "lib", "index.js"),
|
|
77230
|
+
path18.join(packageDir, "src", "index.ts"),
|
|
77231
|
+
path18.join(packageDir, "src", "index.tsx")
|
|
77232
|
+
];
|
|
77233
|
+
for (const p of fallbackPaths) {
|
|
77234
|
+
if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
|
|
77235
|
+
resolvedFiles.push(p);
|
|
77236
|
+
break;
|
|
77237
|
+
}
|
|
77238
|
+
}
|
|
77239
|
+
}
|
|
77221
77240
|
return resolvedFiles;
|
|
77222
77241
|
}
|
|
77223
77242
|
function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth = 10) {
|
|
@@ -77713,6 +77732,19 @@ var findSelectableTsxFiles = (projectDir) => {
|
|
|
77713
77732
|
});
|
|
77714
77733
|
return files.map((file) => path21.resolve(projectDir, file)).filter((file) => fs21.existsSync(file)).sort();
|
|
77715
77734
|
};
|
|
77735
|
+
var warnIfTsconfigMissingTscircuitType = (projectDir) => {
|
|
77736
|
+
const tsconfigPath = path21.join(projectDir, "tsconfig.json");
|
|
77737
|
+
if (!fs21.existsSync(tsconfigPath)) {
|
|
77738
|
+
return;
|
|
77739
|
+
}
|
|
77740
|
+
try {
|
|
77741
|
+
const tsconfig = JSON.parse(fs21.readFileSync(tsconfigPath, "utf-8"));
|
|
77742
|
+
const types = tsconfig?.compilerOptions?.types;
|
|
77743
|
+
if (!Array.isArray(types) || !types.includes("tscircuit")) {
|
|
77744
|
+
console.warn(kleur_default.yellow('Warning: "tscircuit" is missing from tsconfig.json compilerOptions.types. Add it (e.g. "types": ["tscircuit"]) to ensure CLI-provided types work correctly.'));
|
|
77745
|
+
}
|
|
77746
|
+
} catch {}
|
|
77747
|
+
};
|
|
77716
77748
|
var registerDev = (program3) => {
|
|
77717
77749
|
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) => {
|
|
77718
77750
|
let port = parseInt(options.port);
|
|
@@ -77755,6 +77787,7 @@ var registerDev = (program3) => {
|
|
|
77755
77787
|
console.log("Selected file:", path21.relative(process.cwd(), absolutePath));
|
|
77756
77788
|
}
|
|
77757
77789
|
}
|
|
77790
|
+
warnIfTsconfigMissingTscircuitType(process.cwd());
|
|
77758
77791
|
try {
|
|
77759
77792
|
process.stdout.write(kleur_default.gray("Installing types for imported packages..."));
|
|
77760
77793
|
await installNodeModuleTypesForSnippet(absolutePath);
|