@tscircuit/cli 0.1.2122 → 0.1.2123

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/cli/main.js CHANGED
@@ -154298,7 +154298,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
154298
154298
  // lib/getVersion.ts
154299
154299
  import { createRequire as createRequire2 } from "node:module";
154300
154300
  // package.json
154301
- var version = "0.1.2121";
154301
+ var version = "0.1.2122";
154302
154302
  var package_default = {
154303
154303
  name: "@tscircuit/cli",
154304
154304
  version,
@@ -375567,6 +375567,17 @@ var registerRegistryPackagesCreate = (program) => {
375567
375567
  // cli/registry/packages/update/register.ts
375568
375568
  import fs69 from "node:fs";
375569
375569
  import path79 from "node:path";
375570
+ var normalizeGithubRepo = (input) => {
375571
+ let repo = input;
375572
+ const urlMatch = /^https?:\/\/(?:www\.)?github\.com\/([^?#]+)(?:[?#].*)?$/i.exec(input);
375573
+ if (urlMatch) {
375574
+ repo = urlMatch[1].replace(/\/$/, "").replace(/\.git$/, "");
375575
+ }
375576
+ if (!/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?\/(?!\.{1,2}$)[a-zA-Z0-9_.-]{1,100}$/.test(repo)) {
375577
+ throw new Error("GitHub repository must be owner/repo or a GitHub repository URL (for example, https://github.com/tscircuit/my-board)");
375578
+ }
375579
+ return repo;
375580
+ };
375570
375581
  var getCurrentDirectoryPackageName = () => {
375571
375582
  const packageJsonPath = path79.join(process.cwd(), "package.json");
375572
375583
  if (!fs69.existsSync(packageJsonPath))
@@ -375589,7 +375600,7 @@ var getPublicDistEnabledFromOptions = ({
375589
375600
  return;
375590
375601
  };
375591
375602
  var registerRegistryPackagesUpdate = (program) => {
375592
- program.commands.find((command) => command.name() === "registry").commands.find((command) => command.name() === "packages").command("update").description("Update a package in the tscircuit registry").option("--package-name <packageName>", "Package name to update").option("--enable-public-dist", "Enable public dist").option("--disable-public-dist", "Disable public dist").action(async (opts) => {
375603
+ program.commands.find((command) => command.name() === "registry").commands.find((command) => command.name() === "packages").command("update").description("Update a package in the tscircuit registry").option("--package-name <packageName>", "Package name to update").option("--enable-public-dist", "Enable public dist").option("--disable-public-dist", "Disable public dist").option("--github-repo <owner/repo-or-url>", "Link a GitHub repository by owner/repo or URL").option("--unlink-github", "Remove the linked GitHub repository").action(async (opts) => {
375593
375604
  const packageName = opts.packageName ?? getCurrentDirectoryPackageName();
375594
375605
  if (!opts.packageName && packageName) {
375595
375606
  console.warn("No package specified, using package in current directory...");
@@ -375602,20 +375613,38 @@ var registerRegistryPackagesUpdate = (program) => {
375602
375613
  console.error("Cannot use both --enable-public-dist and --disable-public-dist");
375603
375614
  process.exit(1);
375604
375615
  }
375616
+ if (opts.githubRepo !== undefined && opts.unlinkGithub) {
375617
+ console.error("Cannot use both --github-repo and --unlink-github");
375618
+ process.exit(1);
375619
+ }
375620
+ let githubRepo;
375621
+ try {
375622
+ if (opts.githubRepo !== undefined)
375623
+ githubRepo = normalizeGithubRepo(opts.githubRepo);
375624
+ } catch (error) {
375625
+ console.error(error instanceof Error ? error.message : String(error));
375626
+ process.exit(1);
375627
+ }
375605
375628
  const publicDistEnabled = getPublicDistEnabledFromOptions({
375606
375629
  enablePublicDist: opts.enablePublicDist,
375607
375630
  disablePublicDist: opts.disablePublicDist
375608
375631
  });
375609
- if (publicDistEnabled === undefined) {
375610
- console.error("You must provide either --enable-public-dist or --disable-public-dist");
375632
+ if (publicDistEnabled === undefined && opts.githubRepo === undefined && !opts.unlinkGithub) {
375633
+ console.error("You must provide --enable-public-dist, --disable-public-dist, --github-repo, or --unlink-github");
375611
375634
  process.exit(1);
375612
375635
  }
375613
375636
  try {
375614
375637
  const ky = getRegistryApiKy();
375638
+ const registryName = packageName.startsWith("@tsci/") ? packageName.slice(6).replace(".", "/") : packageName.replace(/^@/, "");
375639
+ const { package: pkg } = await ky.post("packages/get", {
375640
+ json: { name: registryName }
375641
+ }).json();
375615
375642
  await ky.post("packages/update", {
375616
375643
  json: {
375617
- package_name: packageName,
375618
- public_dist_enabled: publicDistEnabled
375644
+ package_id: pkg.package_id,
375645
+ ...publicDistEnabled !== undefined ? { public_dist_enabled: publicDistEnabled } : {},
375646
+ ...opts.githubRepo !== undefined ? { github_repo_full_name: githubRepo } : {},
375647
+ ...opts.unlinkGithub ? { github_repo_full_name: null } : {}
375619
375648
  }
375620
375649
  });
375621
375650
  console.log(kleur_default.green(`Updated package ${packageName}`));
package/dist/lib/index.js CHANGED
@@ -69109,7 +69109,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
69109
69109
  }));
69110
69110
  };
69111
69111
  // package.json
69112
- var version = "0.1.2121";
69112
+ var version = "0.1.2122";
69113
69113
  var package_default = {
69114
69114
  name: "@tscircuit/cli",
69115
69115
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2122",
3
+ "version": "0.1.2123",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"