@quickdapp/cli 3.7.0 → 3.9.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.
- package/README.md +10 -5
- package/dist/index.js +20 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,22 +6,27 @@ CLI tool to scaffold new QuickDapp projects.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Using bunx (recommended)
|
|
9
|
-
bunx
|
|
9
|
+
bunx @quickdapp/cli create my-project
|
|
10
10
|
|
|
11
11
|
# Using npx
|
|
12
|
-
npx
|
|
12
|
+
npx @quickdapp/cli create my-project
|
|
13
|
+
|
|
14
|
+
# The 'create' command is the default, so this also works:
|
|
15
|
+
bunx @quickdapp/cli my-project
|
|
13
16
|
|
|
14
17
|
# With variant selection
|
|
15
|
-
bunx
|
|
16
|
-
bunx
|
|
18
|
+
bunx @quickdapp/cli create my-project --variant web3 # Web3 variant
|
|
19
|
+
bunx @quickdapp/cli create my-project --variant base # Base (default)
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
## Options
|
|
20
23
|
|
|
21
24
|
| Option | Description |
|
|
22
25
|
|--------|-------------|
|
|
23
|
-
|
|
|
26
|
+
| `-v, --variant <name>` | Choose package variant: `base` or `web3` (default: `base`) |
|
|
24
27
|
| `--skip-install` | Skip running `bun install` after scaffolding |
|
|
28
|
+
| `-r, --release <version>` | Use a specific release version |
|
|
29
|
+
| `--list-versions` | List available QuickDapp versions |
|
|
25
30
|
| `--help` | Show help |
|
|
26
31
|
|
|
27
32
|
## Prerequisites
|
package/dist/index.js
CHANGED
|
@@ -6866,11 +6866,12 @@ class Unpack extends Parser {
|
|
|
6866
6866
|
}
|
|
6867
6867
|
[STRIPABSOLUTEPATH](entry, field) {
|
|
6868
6868
|
const p = entry[field];
|
|
6869
|
+
const { type } = entry;
|
|
6869
6870
|
if (!p || this.preservePaths)
|
|
6870
6871
|
return true;
|
|
6871
6872
|
const parts = p.split("/");
|
|
6872
6873
|
if (parts.includes("..") || isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) {
|
|
6873
|
-
if (field === "path") {
|
|
6874
|
+
if (field === "path" || type === "Link") {
|
|
6874
6875
|
this.warn("TAR_ENTRY_ERROR", `${field} contains '..'`, {
|
|
6875
6876
|
entry,
|
|
6876
6877
|
[field]: p
|
|
@@ -7654,9 +7655,12 @@ function getGithubDownloadBase() {
|
|
|
7654
7655
|
function getSampleContractsUrl() {
|
|
7655
7656
|
return process.env.QUICKDAPP_SAMPLE_CONTRACTS_URL ?? "https://github.com/QuickDapp/sample-contracts.git";
|
|
7656
7657
|
}
|
|
7658
|
+
async function fetchWithTimeout(url, timeoutMs) {
|
|
7659
|
+
return fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
7660
|
+
}
|
|
7657
7661
|
function checkCommand(command, displayName) {
|
|
7658
7662
|
try {
|
|
7659
|
-
execSync(`which ${command}`, { stdio: "ignore" });
|
|
7663
|
+
execSync(`which ${command}`, { stdio: "ignore", timeout: 5000 });
|
|
7660
7664
|
return true;
|
|
7661
7665
|
} catch {
|
|
7662
7666
|
console.error(`Error: ${displayName} is not installed.`);
|
|
@@ -7670,7 +7674,7 @@ function checkPrerequisites() {
|
|
|
7670
7674
|
return hasGit && hasBun;
|
|
7671
7675
|
}
|
|
7672
7676
|
async function getLatestRelease() {
|
|
7673
|
-
const response = await
|
|
7677
|
+
const response = await fetchWithTimeout(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases/latest`, 1e4);
|
|
7674
7678
|
if (!response.ok) {
|
|
7675
7679
|
throw new Error(`Failed to fetch latest release: ${response.statusText}`);
|
|
7676
7680
|
}
|
|
@@ -7678,7 +7682,7 @@ async function getLatestRelease() {
|
|
|
7678
7682
|
return data.tag_name;
|
|
7679
7683
|
}
|
|
7680
7684
|
async function listReleases() {
|
|
7681
|
-
const response = await
|
|
7685
|
+
const response = await fetchWithTimeout(`${getGithubApiBase()}/repos/${GITHUB_REPO}/releases`, 1e4);
|
|
7682
7686
|
if (!response.ok) {
|
|
7683
7687
|
throw new Error(`Failed to fetch releases: ${response.statusText}`);
|
|
7684
7688
|
}
|
|
@@ -7689,7 +7693,7 @@ async function downloadAndExtract(variant, version, targetDir) {
|
|
|
7689
7693
|
const assetName = `${packageName}-${version}.tar.gz`;
|
|
7690
7694
|
const downloadUrl = `${getGithubDownloadBase()}/${GITHUB_REPO}/releases/download/${version}/${assetName}`;
|
|
7691
7695
|
console.log(`Downloading ${assetName}...`);
|
|
7692
|
-
const response = await
|
|
7696
|
+
const response = await fetchWithTimeout(downloadUrl, 60000);
|
|
7693
7697
|
if (!response.ok) {
|
|
7694
7698
|
throw new Error(`Failed to download: ${response.statusText}`);
|
|
7695
7699
|
}
|
|
@@ -7729,14 +7733,16 @@ async function cloneSampleContracts(targetDir) {
|
|
|
7729
7733
|
Cloning sample-contracts...`);
|
|
7730
7734
|
const cloneResult = spawnSync("git", ["clone", getSampleContractsUrl(), "sample-contracts"], {
|
|
7731
7735
|
cwd: targetDir,
|
|
7732
|
-
stdio: "inherit"
|
|
7736
|
+
stdio: "inherit",
|
|
7737
|
+
timeout: 120000
|
|
7733
7738
|
});
|
|
7734
7739
|
if (cloneResult.status !== 0) {
|
|
7735
7740
|
throw new Error(`git clone failed with code ${cloneResult.status}`);
|
|
7736
7741
|
}
|
|
7737
7742
|
const submoduleResult = spawnSync("git", ["submodule", "update", "--init", "--recursive"], {
|
|
7738
7743
|
cwd: join2(targetDir, "sample-contracts"),
|
|
7739
|
-
stdio: "inherit"
|
|
7744
|
+
stdio: "inherit",
|
|
7745
|
+
timeout: 120000
|
|
7740
7746
|
});
|
|
7741
7747
|
if (submoduleResult.status !== 0) {
|
|
7742
7748
|
throw new Error(`git submodule update failed with code ${submoduleResult.status}`);
|
|
@@ -7745,11 +7751,12 @@ Cloning sample-contracts...`);
|
|
|
7745
7751
|
async function initGit(targetDir) {
|
|
7746
7752
|
console.log(`
|
|
7747
7753
|
Initializing git repository...`);
|
|
7748
|
-
execSync("git init", { cwd: targetDir, stdio: "inherit" });
|
|
7749
|
-
execSync("git add .", { cwd: targetDir, stdio: "inherit" });
|
|
7754
|
+
execSync("git init", { cwd: targetDir, stdio: "inherit", timeout: 1e4 });
|
|
7755
|
+
execSync("git add .", { cwd: targetDir, stdio: "inherit", timeout: 30000 });
|
|
7750
7756
|
execSync('git commit -m "Initial commit from create-quickdapp"', {
|
|
7751
7757
|
cwd: targetDir,
|
|
7752
|
-
stdio: "inherit"
|
|
7758
|
+
stdio: "inherit",
|
|
7759
|
+
timeout: 30000
|
|
7753
7760
|
});
|
|
7754
7761
|
}
|
|
7755
7762
|
async function createProject(projectName, options) {
|
|
@@ -7794,8 +7801,8 @@ Error:`, error instanceof Error ? error.message : String(error));
|
|
|
7794
7801
|
}
|
|
7795
7802
|
}
|
|
7796
7803
|
var program2 = new Command;
|
|
7797
|
-
program2.name("create-quickdapp").description("
|
|
7798
|
-
program2.
|
|
7804
|
+
program2.name("create-quickdapp").description("CLI to scaffold QuickDapp projects").version(CLI_VERSION);
|
|
7805
|
+
program2.command("create [project-name]", { isDefault: true }).description("Create a new QuickDapp project").option("-v, --variant <variant>", "Project variant (base or web3)", "base").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
7806
|
if (options.listVersions) {
|
|
7800
7807
|
try {
|
|
7801
7808
|
const releases = await listReleases();
|
|
@@ -7815,7 +7822,7 @@ program2.argument("[project-name]", "Name of the project to create").option("-v,
|
|
|
7815
7822
|
}
|
|
7816
7823
|
if (!projectName) {
|
|
7817
7824
|
console.error("Error: project-name is required");
|
|
7818
|
-
console.error("Usage: create-quickdapp <project-name>");
|
|
7825
|
+
console.error("Usage: create-quickdapp create <project-name>");
|
|
7819
7826
|
process.exit(1);
|
|
7820
7827
|
}
|
|
7821
7828
|
if (!checkPrerequisites()) {
|