@tscircuit/cli 0.1.708 → 0.1.710

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 CHANGED
@@ -73249,6 +73249,7 @@ var projectConfigSchema = z.object({
73249
73249
 
73250
73250
  // lib/project-config/index.ts
73251
73251
  var CONFIG_FILENAME = "tscircuit.config.json";
73252
+ var CONFIG_SCHEMA_URL = "https://cdn.jsdelivr.net/npm/@tscircuit/cli/types/tscircuit.config.schema.json";
73252
73253
  var DEFAULT_BOARD_FILE_PATTERNS = [
73253
73254
  "**/*.board.tsx",
73254
73255
  "**/*.circuit.tsx",
@@ -73283,7 +73284,11 @@ var getSnapshotsDir = (projectDir = process.cwd()) => {
73283
73284
  var saveProjectConfig = (config, projectDir = process.cwd()) => {
73284
73285
  const configPath = path9.join(projectDir, CONFIG_FILENAME);
73285
73286
  try {
73286
- fs6.writeFileSync(configPath, JSON.stringify(config, null, 2));
73287
+ const configWithSchema = {
73288
+ $schema: CONFIG_SCHEMA_URL,
73289
+ ...config
73290
+ };
73291
+ fs6.writeFileSync(configPath, JSON.stringify(configWithSchema, null, 2));
73287
73292
  return true;
73288
73293
  } catch (error) {
73289
73294
  console.error(`Error saving tscircuit config: ${error}`);
@@ -74112,7 +74117,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74112
74117
  import { execSync as execSync2 } from "node:child_process";
74113
74118
  var import_semver2 = __toESM2(require_semver2(), 1);
74114
74119
  // package.json
74115
- var version = "0.1.707";
74120
+ var version = "0.1.709";
74116
74121
  var package_default = {
74117
74122
  name: "@tscircuit/cli",
74118
74123
  version,
@@ -188275,9 +188280,24 @@ var validateMainInDist = (projectDir, distDir) => {
188275
188280
  }
188276
188281
  };
188277
188282
 
188283
+ // cli/utils/get-latest-tscircuit-cdn-url.ts
188284
+ var TSCIRCUIT_CDNJS_API_URL = "https://api.cdnjs.com/libraries/tscircuit?fields=version";
188285
+ async function getLatestTscircuitCdnVersion() {
188286
+ const response = await fetch(TSCIRCUIT_CDNJS_API_URL);
188287
+ if (!response.ok) {
188288
+ throw new Error(`Failed to fetch tscircuit version from CDN: ${response.statusText}`);
188289
+ }
188290
+ const data = await response.json();
188291
+ return data.version;
188292
+ }
188293
+ async function getLatestTscircuitCdnUrl() {
188294
+ const version2 = await getLatestTscircuitCdnVersion();
188295
+ return `https://cdn.jsdelivr.net/npm/tscircuit@${version2}/dist/browser.min.js`;
188296
+ }
188297
+
188278
188298
  // cli/build/register.ts
188279
188299
  var registerBuild = (program3) => {
188280
- 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").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("--kicad-footprint-library", "Generate a KiCad footprint library from all successful build outputs").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").action(async (file, options) => {
188300
+ 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").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("--kicad-footprint-library", "Generate a KiCad footprint library from all successful build outputs").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").action(async (file, options) => {
188281
188301
  try {
188282
188302
  const {
188283
188303
  projectDir,
@@ -188394,12 +188414,17 @@ var registerBuild = (program3) => {
188394
188414
  }
188395
188415
  }
188396
188416
  if (options?.site) {
188417
+ let standaloneScriptSrc = "./standalone.min.js";
188418
+ if (options?.useCdnJavascript) {
188419
+ standaloneScriptSrc = await getLatestTscircuitCdnUrl();
188420
+ } else {
188421
+ fs42.writeFileSync(path43.join(distDir, "standalone.min.js"), standalone_min_default);
188422
+ }
188397
188423
  const indexHtml = getStaticIndexHtmlFile({
188398
188424
  files: staticFileReferences,
188399
- standaloneScriptSrc: "./standalone.min.js"
188425
+ standaloneScriptSrc
188400
188426
  });
188401
188427
  fs42.writeFileSync(path43.join(distDir, "index.html"), indexHtml);
188402
- fs42.writeFileSync(path43.join(distDir, "standalone.min.js"), standalone_min_default);
188403
188428
  }
188404
188429
  if (options?.kicadFootprintLibrary) {
188405
188430
  if (kicadProjects.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.708",
3
+ "version": "0.1.710",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@tscircuit/cli/types/tscircuit.config.schema.json",
4
+ "title": "TSCircuit Config",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "format": "uri",
11
+ "description": "JSON schema reference for the config file."
12
+ },
13
+ "mainEntrypoint": {
14
+ "type": "string",
15
+ "description": "Entry file for the circuit project."
16
+ },
17
+ "previewComponentPath": {
18
+ "type": "string",
19
+ "description": "Optional component path used for previews."
20
+ },
21
+ "ignoredFiles": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string"
25
+ },
26
+ "description": "File globs to ignore."
27
+ },
28
+ "includeBoardFiles": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "string"
32
+ },
33
+ "description": "File globs to include as board files."
34
+ },
35
+ "snapshotsDir": {
36
+ "type": "string",
37
+ "description": "Directory path for storing snapshots."
38
+ }
39
+ }
40
+ }