create-zfb 0.1.0-next.26 → 0.1.0-next.27

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/bin/create-zfb.mjs +27 -19
  2. package/package.json +2 -2
@@ -55,27 +55,35 @@ try {
55
55
  const version = ownPkg.version;
56
56
  const controller = new AbortController();
57
57
  const timer = setTimeout(() => controller.abort(), 1500);
58
- const res = await fetch("https://registry.npmjs.org/create-zfb/latest", {
59
- signal: controller.signal,
60
- headers: {
61
- "User-Agent": `create-zfb/${version}`,
62
- Accept: "application/json",
63
- },
64
- });
65
- clearTimeout(timer);
66
- if (res.ok) {
67
- const data = await res.json();
68
- const latest = data?.version;
69
- if (typeof latest === "string" && typeof version === "string") {
70
- if (compareSemver(version, latest) < 0) {
71
- process.stderr.write(
72
- `[create-zfb] You are running create-zfb@${version} but @latest is ${latest}.\n` +
73
- `[create-zfb] pnpm 11's minimumReleaseAge may have downgraded the install.\n` +
74
- `[create-zfb] Re-run with: pnpm create zfb@latest --config.minimumReleaseAge=0\n` +
75
- `[create-zfb] Or use: npm create zfb@latest\n`,
76
- );
58
+ let res;
59
+ try {
60
+ res = await fetch("https://registry.npmjs.org/create-zfb/latest", {
61
+ signal: controller.signal,
62
+ headers: {
63
+ "User-Agent": `create-zfb/${version}`,
64
+ Accept: "application/json",
65
+ },
66
+ });
67
+ if (res.ok) {
68
+ const data = await res.json();
69
+ const latest = data?.version;
70
+ if (typeof latest === "string" && typeof version === "string") {
71
+ if (compareSemver(version, latest) < 0) {
72
+ process.stderr.write(
73
+ `[create-zfb] You are running create-zfb@${version} but @latest is ${latest}.\n` +
74
+ `[create-zfb] pnpm 11's minimumReleaseAge may have downgraded the install.\n` +
75
+ `[create-zfb] Re-run with: pnpm create zfb@latest --config.minimumReleaseAge=0\n` +
76
+ `[create-zfb] Or use: npm create zfb@latest\n`,
77
+ );
78
+ }
77
79
  }
78
80
  }
81
+ } finally {
82
+ // Keep the abort signal armed across both the header and body reads.
83
+ // Only cancel the timer once the body has been fully consumed (or on
84
+ // any error path), so a proxy that stalls after headers cannot hang
85
+ // the scaffolder indefinitely.
86
+ clearTimeout(timer);
79
87
  }
80
88
  } catch {
81
89
  // silently skip on any error: network failure, timeout (AbortError), parse error, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zfb",
3
- "version": "0.1.0-next.26",
3
+ "version": "0.1.0-next.27",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Scaffold a new zfb static-site project: `npm create zfb@latest my-site`",
@@ -35,6 +35,6 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "dependencies": {
38
- "@takazudo/zfb": "0.1.0-next.26"
38
+ "@takazudo/zfb": "0.1.0-next.27"
39
39
  }
40
40
  }