@quickdapp/cli 3.5.3 → 3.6.0

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/index.js +34 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7677,6 +7677,13 @@ async function getLatestRelease() {
7677
7677
  const data = await response.json();
7678
7678
  return data.tag_name;
7679
7679
  }
7680
+ async function listReleases() {
7681
+ const response = await fetch(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases`);
7682
+ if (!response.ok) {
7683
+ throw new Error(`Failed to fetch releases: ${response.statusText}`);
7684
+ }
7685
+ return await response.json();
7686
+ }
7680
7687
  async function downloadAndExtract(variant, version, targetDir) {
7681
7688
  const packageName = variant === "base" ? "base" : "variant-web3";
7682
7689
  const assetName = `${packageName}-${version}.tar.gz`;
@@ -7755,7 +7762,7 @@ async function createProject(projectName, options) {
7755
7762
  Creating QuickDapp project: ${projectName}`);
7756
7763
  console.log(`Variant: ${options.variant}`);
7757
7764
  try {
7758
- const version = await getLatestRelease();
7765
+ const version = options.release ?? await getLatestRelease();
7759
7766
  console.log(`Using version: ${version}`);
7760
7767
  await downloadAndExtract(options.variant, version, targetDir);
7761
7768
  if (options.variant === "web3") {
@@ -7788,7 +7795,29 @@ Error:`, error instanceof Error ? error.message : String(error));
7788
7795
  }
7789
7796
  var program2 = new Command;
7790
7797
  program2.name("create-quickdapp").description("Create a new QuickDapp project").version(CLI_VERSION);
7791
- program2.argument("<project-name>", "Name of the project to create").option("-v, --variant <variant>", "Project variant (base or web3)", "web3").option("--skip-install", "Skip running bun install", false).action(async (projectName, options) => {
7798
+ program2.argument("[project-name]", "Name of the project to create").option("-v, --variant <variant>", "Project variant (base or web3)", "web3").option("--skip-install", "Skip running bun install", false).option("-r, --release <version>", "Use a specific release version").option("--list-versions", "List available QuickDapp versions").action(async (projectName, options) => {
7799
+ if (options.listVersions) {
7800
+ try {
7801
+ const releases = await listReleases();
7802
+ const latest = await getLatestRelease();
7803
+ console.log("Available versions:");
7804
+ for (const release of releases) {
7805
+ const isLatest = release.tag_name === latest;
7806
+ const prerelease = release.prerelease ? " (prerelease)" : "";
7807
+ const latestLabel = isLatest ? " (latest)" : "";
7808
+ console.log(` ${release.tag_name}${latestLabel}${prerelease}`);
7809
+ }
7810
+ } catch (error) {
7811
+ console.error("Error:", error instanceof Error ? error.message : String(error));
7812
+ process.exit(1);
7813
+ }
7814
+ return;
7815
+ }
7816
+ if (!projectName) {
7817
+ console.error("Error: project-name is required");
7818
+ console.error("Usage: create-quickdapp <project-name>");
7819
+ process.exit(1);
7820
+ }
7792
7821
  if (!checkPrerequisites()) {
7793
7822
  process.exit(1);
7794
7823
  }
@@ -7799,7 +7828,8 @@ program2.argument("<project-name>", "Name of the project to create").option("-v,
7799
7828
  }
7800
7829
  await createProject(projectName, {
7801
7830
  variant,
7802
- skipInstall: options.skipInstall
7831
+ skipInstall: options.skipInstall,
7832
+ release: options.release
7803
7833
  });
7804
7834
  });
7805
7835
  var isDirectRun = import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith("/create-quickdapp") || process.argv[1]?.endsWith("\\create-quickdapp");
@@ -7808,6 +7838,7 @@ if (isDirectRun) {
7808
7838
  }
7809
7839
  export {
7810
7840
  runBunInstall,
7841
+ listReleases,
7811
7842
  initGit,
7812
7843
  getLatestRelease,
7813
7844
  downloadAndExtract,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quickdapp/cli",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },