@tscircuit/cli 0.1.708 → 0.1.709

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.
Files changed (2) hide show
  1. package/dist/main.js +24 -4
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -74112,7 +74112,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74112
74112
  import { execSync as execSync2 } from "node:child_process";
74113
74113
  var import_semver2 = __toESM2(require_semver2(), 1);
74114
74114
  // package.json
74115
- var version = "0.1.707";
74115
+ var version = "0.1.708";
74116
74116
  var package_default = {
74117
74117
  name: "@tscircuit/cli",
74118
74118
  version,
@@ -188275,9 +188275,24 @@ var validateMainInDist = (projectDir, distDir) => {
188275
188275
  }
188276
188276
  };
188277
188277
 
188278
+ // cli/utils/get-latest-tscircuit-cdn-url.ts
188279
+ var TSCIRCUIT_CDNJS_API_URL = "https://api.cdnjs.com/libraries/tscircuit?fields=version";
188280
+ async function getLatestTscircuitCdnVersion() {
188281
+ const response = await fetch(TSCIRCUIT_CDNJS_API_URL);
188282
+ if (!response.ok) {
188283
+ throw new Error(`Failed to fetch tscircuit version from CDN: ${response.statusText}`);
188284
+ }
188285
+ const data = await response.json();
188286
+ return data.version;
188287
+ }
188288
+ async function getLatestTscircuitCdnUrl() {
188289
+ const version2 = await getLatestTscircuitCdnVersion();
188290
+ return `https://cdn.jsdelivr.net/npm/tscircuit@${version2}/dist/browser.min.js`;
188291
+ }
188292
+
188278
188293
  // cli/build/register.ts
188279
188294
  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) => {
188295
+ 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
188296
  try {
188282
188297
  const {
188283
188298
  projectDir,
@@ -188394,12 +188409,17 @@ var registerBuild = (program3) => {
188394
188409
  }
188395
188410
  }
188396
188411
  if (options?.site) {
188412
+ let standaloneScriptSrc = "./standalone.min.js";
188413
+ if (options?.useCdnJavascript) {
188414
+ standaloneScriptSrc = await getLatestTscircuitCdnUrl();
188415
+ } else {
188416
+ fs42.writeFileSync(path43.join(distDir, "standalone.min.js"), standalone_min_default);
188417
+ }
188397
188418
  const indexHtml = getStaticIndexHtmlFile({
188398
188419
  files: staticFileReferences,
188399
- standaloneScriptSrc: "./standalone.min.js"
188420
+ standaloneScriptSrc
188400
188421
  });
188401
188422
  fs42.writeFileSync(path43.join(distDir, "index.html"), indexHtml);
188402
- fs42.writeFileSync(path43.join(distDir, "standalone.min.js"), standalone_min_default);
188403
188423
  }
188404
188424
  if (options?.kicadFootprintLibrary) {
188405
188425
  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.709",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",